@libxai/board 0.17.369 → 0.17.370

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,8 +1,8 @@
1
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,useEffect,useCallback,useMemo,useImperativeHandle,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 kc 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,Scissors,Settings,Eye,EyeOff,ArrowDown,ArrowUp,ArrowUpDown,BarChart3,Link2,Minus,Plus,Trash2,Pencil,Edit3,AlertTriangle,Moon,Sun,Palette,ZoomOut,ZoomIn,Keyboard,ChevronRight,Image,FileText,File,Sparkles,Maximize2,MoreHorizontal,X,User,ChevronDown,Check,CalendarDays,Flag,Clock,Tag,Diamond,ListChecks,Upload,MessageSquare,Send,Rows3,Filter,FileImage,FileSpreadsheet,FileJson,FolderKanban,Download,Calendar,ChevronLeft,GripVertical,AlertCircle,CircleDot,Users,Milestone,List,Search}from'lucide-react';import {Command}from'cmdk';import Vu from'react-markdown';import ju from'remark-gfm';import Ku from'rehype-sanitize';import {ResponsiveContainer,LineChart,CartesianGrid,XAxis,YAxis,Tooltip,Legend,Line,AreaChart,Area,PieChart,Pie,Cell,BarChart,Bar}from'recharts';var Zo=(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 en=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 [en.Translate.toString(e),en.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function f(...e){return twMerge(clsx(e))}function tn(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 op(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function ns(e,t){return e.length===0?1e3:t===0?tn(null,e[0].position):t>=e.length?tn(e[e.length-1].position,null):tn(e[t-1].position,e[t].position)}function Cl(e,t=100){return e>t}var np=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 sp(e,t,a,r){let o=t*Math.pow(a,e-1),s=o*.2*Math.random();return Math.min(o+s,r)}async function an(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:n=np,onRetry:p}=t,m,i=0;for(let u=1;u<=a;u++){i=u;try{return {data:await e(),attempts:i,success:!0}}catch(d){if(m=d,u===a||!n(m,u))return {error:m,attempts:i,success:false};let h=sp(u,r,o,s);if(p)try{p(m,u,h);}catch(C){console.error("Error in retry callback:",C);}await new Promise(C=>setTimeout(C,h));}}return {error:m||new Error("Unknown error"),attempts:i,success:false}}function ip(e,t=3){let a;for(let r=1;r<=t;r++)try{return {data:e(),success:!0}}catch(o){if(a=o,r===t)return {error:a,success:false}}return {error:a||new Error("Unknown error"),success:false}}function lp(e,t={}){return async(...a)=>an(()=>e(...a),t)}var ss=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 Tl=(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))(Tl||{}),Or=class Or{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...n}=t,p=`[${a}] [${r}] [${s}]`,m=Object.keys(n).length>0;switch(r){case "DEBUG":console.debug(p,o,m?n:"");break;case "INFO":console.info(p,o,m?n:"");break;case "WARN":console.warn(p,o,m?n:"");break;case "ERROR":console.error(p,o,m?n:""),t.error?.stack&&console.error(t.error.stack);break}};let a=process.env.NODE_ENV==="development";this.options={minLevel:t.minLevel??(a?0:1),enabled:t.enabled??true,onLog:t.onLog??this.defaultLogHandler,enableTiming:t.enableTiming??true,componentName:t.componentName??"ASAKAA",...Or.globalOptions};}static configure(t){Or.globalOptions={...Or.globalOptions,...t};}child(t){return new Or({...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 rn((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new rn(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:Tl[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};Or.globalOptions={};var is=Or,rn=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}},Nl=new is;function cp(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 mp(e,t){let a=["Card ID","Title","Description","Column","Priority","Labels","Assigned Users","Start Date","End Date","Created At","Updated At"],r=e.cards.map(s=>{let n=e.columns.find(p=>p.id===s.columnId);return [s.id,ls(s.title),ls(s.description||""),ls(n?.title||""),s.priority||"",(s.labels||[]).join(";"),(s.assignedUserIds||[]).join(";"),s.startDate||"",s.endDate||"",s.createdAt||"",s.updatedAt||""]});return [a.join(","),...r.map(s=>s.join(","))].join(`
2
2
  `)}async function pp(e,t,a){let r=t;if(!r){let n=document.querySelector(".asakaa-board");n&&(r=n.parentElement||n);}if(r)try{let n=await kc(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),p=n.toDataURL("image/png"),m=297,i=210,u=n.width/n.height,d=m-20,g=d/u;g>i-20&&(g=i-20,d=g*u);let h=new jsPDF({orientation:"landscape",unit:"mm",format:"a4"});h.setFontSize(16),h.setTextColor(255,255,255),h.setFillColor(10,10,10),h.rect(0,0,m,15,"F"),h.text(e.title||"Kanban Board",10,10);let C=(m-d)/2;return h.addImage(p,"PNG",C,20,d,g),h}catch(n){console.error("Error capturing board:",n);}let o=new jsPDF,s=20;return o.setFontSize(20),o.text(e.title||"Kanban Board",20,s),s+=10,o.setFontSize(10),o.setTextColor(128,128,128),o.text(`Exported on ${new Date().toLocaleString()}`,20,s),s+=15,o.setTextColor(0,0,0),e.columns.forEach(n=>{let p=e.cards.filter(m=>m.columnId===n.id);s>250&&(o.addPage(),s=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(n.title,20,s),s+=8,p.length===0?(o.setFontSize(10),o.setFont("helvetica","italic"),o.setTextColor(128,128,128),o.text("No cards in this column",20,s),o.setTextColor(0,0,0),s+=10):p.forEach(m=>{if(s>260&&(o.addPage(),s=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(m.title,25,s),s+=6,m.description){o.setFontSize(9),o.setFont("helvetica","normal");let u=o.splitTextToSize(m.description,160);o.text(u,25,s),s+=u.length*5;}let i=[];if(m.priority&&i.push(`Priority: ${m.priority}`),m.labels&&m.labels.length>0&&i.push(`Labels: ${m.labels.join(", ")}`),m.assignedUserIds&&m.assignedUserIds.length>0&&i.push(`Assigned: ${m.assignedUserIds.length} user(s)`),m.startDate||m.endDate){let u=[];m.startDate&&u.push(`Start: ${m.startDate}`),m.endDate&&u.push(`End: ${m.endDate}`),i.push(u.join(" \u2192 "));}i.length>0&&(o.setFontSize(8),o.setTextColor(100,100,100),o.text(i.join(" \u2022 "),25,s),o.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),o}function ls(e){return e.includes(",")||e.includes('"')||e.includes(`
3
3
  `)?`"${e.replace(/"/g,'""')}"`:e}async function Sl(e,t,a,r){switch(t){case "json":return cp(e,r);case "csv":return mp(e);case "pdf":return await pp(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function El(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]}`,n={json:"application/json",csv:"text/csv",pdf:"application/pdf"},p=new Blob([e],{type:n[t]}),m=URL.createObjectURL(p),i=document.createElement("a");i.href=m,i.download=s,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(m);}function up(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 gp(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=Pl(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let p=Pl(t[n]||"");if(p.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-p.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${p.length})`);continue}for(;p.length<a.length;)p.push("");let i={};a.forEach((h,C)=>{i[h]=p[C]||"";});let u=i.Column||"Unnamed";o.has(u)||o.set(u,{id:`col-${o.size+1}`,title:u,position:o.size+1,cardIds:[]});let d=o.get(u),g={id:i["Card ID"]||`card-${n}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:d.id,position:d.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};r.push(g),d.cardIds.push(g.id);}catch(p){s.push(`Line ${n+1}: ${p instanceof Error?p.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function Pl(e){let t=[],a="",r=false;for(let o=0;o<e.length;o++){let s=e[o],n=e[o+1];s==='"'&&r&&n==='"'?(a+='"',o++):s==='"'?r=!r:s===","&&!r?(t.push(a),a=""):a+=s;}return t.push(a),t}function Ml(e,t){switch(t){case "json":return up(e);case "csv":return gp(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function Al(e){return new Promise((t,a)=>{let r=new FileReader;r.onload=o=>{o.target?.result?t(o.target.result):a(new Error("Failed to read file"));},r.onerror=()=>a(new Error("Failed to read file")),r.readAsText(e);})}var ds=createContext(null);function Fl(){return useContext(ds)}var Ll=createContext(null);function Il({children:e,themeName:t}){return jsx(Ll.Provider,{value:{themeName:t},children:e})}function oo(){return useContext(Ll)}function lt({children:e,container:t}){let[a,r]=useState(false),o=Fl(),s=oo();if(useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let n=t||(typeof document<"u"?document.body:null);if(!n)return null;if(o){let{theme:p,themeName:m}=o,i={"--asakaa-color-background-primary":p.bgPrimary,"--asakaa-color-background-secondary":p.bgSecondary,"--asakaa-color-background-card":p.bgGrid,"--asakaa-color-background-hover":p.hoverBg,"--asakaa-color-text-primary":p.textPrimary,"--asakaa-color-text-secondary":p.textSecondary,"--asakaa-color-text-tertiary":p.textTertiary,"--asakaa-color-text-inverse":p.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":p.border,"--asakaa-color-border-hover":p.borderLight,"--asakaa-color-border-subtle":p.borderLight,"--asakaa-color-interactive-primary":p.accent,"--asakaa-color-interactive-primaryHover":p.accentHover,"--asakaa-color-interactive-primaryBorder":`${p.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${p.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${p.accent}33`,"--asakaa-color-status-success":p.statusCompleted,"--asakaa-color-status-warning":p.milestone,"--asakaa-color-status-error":p.criticalPath,"--asakaa-color-danger":p.criticalPath,"--asakaa-color-danger-border":`${p.criticalPath}4D`,"--asakaa-color-danger-background":`${p.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${p.criticalPath}26`};return createPortal(jsx("div",{"data-theme":m,"data-gantt-portal":"true",style:i,children:e}),n)}return s?createPortal(jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),n):createPortal(e,n)}var zl={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},wp="#BDC3C7",Cp=({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 zr({priority:e,onChange:t,className:a}){let[r,o]=useState(false),[s,n]=useState({top:0,left:0}),p=useRef(null),m=useRef(null),i=()=>{if(!m.current)return;let h=m.current.getBoundingClientRect(),C=window.innerHeight,T=window.innerWidth,c=160,b=220,y=4,l=h.right-c;l<10&&(l=h.left),l+c>T-10&&(l=T-c-10);let x=C-h.bottom,v=h.top,S;x>=b+y?S=h.bottom+y:v>=b+y?S=h.top-b-y:S=x>=v?h.bottom+y:Math.max(10,h.top-b-y),n({top:S,left:l}),o(true);};useEffect(()=>{let h=C=>{p.current&&!p.current.contains(C.target)&&!m.current?.contains(C.target)&&o(false);};if(r)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[r]),useEffect(()=>{let h=C=>{C.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[r]);let u=h=>{t(h),o(false);},d=e?zl[e]:null,g=d?.color||wp;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:m,onClick:()=>r?o(false):i(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${g}10`:"transparent",boxShadow:e?`0 0 0 2px ${g}30 inset`:"none"},title:d?.label||"Set priority",children:jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:g,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:g,fillOpacity:e?"0.6":"0.4"})})}),r&&jsx(lt,{children:jsxs("div",{ref:p,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(zl).map(([h,C])=>jsxs("button",{onClick:()=>u(h),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:C.color,background:"transparent"},onMouseEnter:T=>{T.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:T=>{T.currentTarget.style.background="transparent";},children:[jsx(Cp,{color:C.color}),jsx("span",{className:"font-semibold text-sm",children:C.label}),e===h&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},h)),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:h=>{h.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:h=>{h.currentTarget.style.background="transparent";},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"#9CA3AF",strokeWidth:"1.5",strokeDasharray:"2 2",opacity:"0.6"})}),jsx("span",{className:"font-semibold text-sm",children:"Clear"}),!e&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var Tp=[{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 To({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=useState(false),[n,p]=useState({top:0,left:0}),m=useRef(null),i=useRef(null),g=(oo()?.themeName||"dark")==="dark",h=()=>{if(!i.current)return;let l=i.current.getBoundingClientRect(),x=window.innerHeight,v=window.innerWidth,S=320,k=380,w=4,B=l.left;B+S>v-10&&(B=v-S-10),B<10&&(B=10);let M=x-l.bottom,D=l.top,I;M>=k+w?I=l.bottom+w:D>=k+w?I=l.top-k-w:I=M>=D?l.bottom+w:Math.max(10,l.top-k-w),p({top:I,left:B}),s(true);};useEffect(()=>{let l=x=>{m.current&&!m.current.contains(x.target)&&!i.current?.contains(x.target)&&s(false);};if(o)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[o]),useEffect(()=>{let l=x=>{x.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[o]);let C=l=>{let x=new Date,v=B=>{let M=B.getFullYear(),D=String(B.getMonth()+1).padStart(2,"0"),I=String(B.getDate()).padStart(2,"0");return `${M}-${D}-${I}`},S=v(x),k=new Date(x);k.setDate(k.getDate()+l);let w=v(k);a(S,w),s(false);},T=()=>{if(!e||!t)return "Set date";let l=k=>{if(k instanceof Date)return k;if(typeof k!="string"||!k.match(/^\d{4}-\d{2}-\d{2}$/))return null;let w=k.split("-").map(Number);if(w.length!==3||w.some(I=>isNaN(I)))return null;let B=w[0],M=w[1],D=w[2];return B===void 0||M===void 0||D===void 0?null:new Date(B,M-1,D)},x=l(e),v=l(t);if(!x||!v||isNaN(x.getTime())||isNaN(v.getTime()))return "Set date";let S=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${S[x.getMonth()]} ${x.getDate()} \u2013 ${S[v.getMonth()]} ${v.getDate()}`},c=e&&t,y=(()=>{if(!t)return false;let l=typeof t=="string"?new Date(t):t,x=new Date;return x.setHours(0,0,0,0),l<x})();return jsxs("div",{className:`relative ${r||""}`,children:[jsxs("button",{ref:i,onClick:()=>o?s(false):h(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${y?"asakaa-date-overdue":"asakaa-date"}`,title:c?`${T()}`:"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:T()})]}),o&&jsx(lt,{children:jsxs("div",{ref:m,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,background:g?"#1A1D25":"#FFFFFF",border:`1px solid ${g?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:g?"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:g?"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:g?"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:Tp.map(l=>jsx("button",{onClick:()=>C(l.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:g?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${g?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:g?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:x=>{x.currentTarget.style.backgroundColor=g?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",x.currentTarget.style.border=`1px solid ${g?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:x=>{x.currentTarget.style.backgroundColor=g?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",x.currentTarget.style.border=`1px solid ${g?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:l.label},l.label))})]}),jsxs("div",{className:"p-4",children:[jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:g?"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:l=>a(l.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:g?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:g?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:g?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:g?"dark":"light"}}),jsx("input",{type:"date",value:t||"",onChange:l=>a(e,l.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:g?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:g?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:g?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:g?"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:l=>{l.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:l=>{l.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function Hr({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=useState(false),[p,m]=useState(""),[i,u]=useState({top:0,left:0}),d=useRef(null),g=useRef(null),h=()=>{if(!g.current)return;let y=g.current.getBoundingClientRect(),l=window.innerHeight,x=window.innerWidth,v=300,S=380,k=4,w=y.right-v;w<10&&(w=y.left),w+v>x-10&&(w=x-v-10);let B=l-y.bottom,M=y.top,D;B>=S+k?D=y.bottom+k:M>=S+k?D=y.top-S-k:D=B>=M?y.bottom+k:Math.max(10,y.top-S-k),u({top:D,left:w}),n(true);};useEffect(()=>{let y=l=>{d.current&&!d.current.contains(l.target)&&!g.current?.contains(l.target)&&(n(false),m(""));};if(s)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[s]),useEffect(()=>{let y=l=>{l.key==="Escape"&&(n(false),m(""));};if(s)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[s]);let C=y=>{let l=e.some(x=>x.id===y.id);a(l?e.filter(x=>x.id!==y.id):[...e,y]);},T=t.filter(y=>y.name.toLowerCase().includes(p.toLowerCase())),c=e.slice(0,o),b=e.length-o;return jsxs("div",{className:`relative ${r||""}`,children:[jsx("button",{ref:g,onClick:()=>s?n(false):h(),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:[c.map(y=>jsx("div",{className:"asakaa-avatar",title:y.name,children:y.avatar?jsx("img",{src:y.avatar,alt:y.name,className:"asakaa-avatar-img"}):y.initials},y.id)),b>0&&jsxs("div",{className:"asakaa-avatar",children:["+",b]})]}):jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center transition-all",style:{background:"rgba(96, 165, 250, 0.15)",border:"1.5px solid rgba(96, 165, 250, 0.4)",color:"#60a5fa"},children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M8 8a3 3 0 100-6 3 3 0 000 6zM4 14c0-2.21 1.79-4 4-4s4 1.79 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),s&&jsx(lt,{children:jsxs("div",{ref:d,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("input",{type:"text",value:p,onChange:y=>m(y.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:T.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"}):T.map(y=>{let l=e.some(x=>x.id===y.id);return jsxs("button",{onClick:()=>C(y),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:x=>{x.currentTarget.style.background="transparent";},children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor:y.color,color:"#fff"},children:y.avatar?jsx("img",{src:y.avatar,alt:y.name,className:"w-full h-full rounded-full object-cover"}):y.initials}),jsx("span",{className:"font-semibold flex-1 text-left truncate",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:y.name}),jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:l?"#3b82f6":"transparent"},children:l?"\u2713":""})]},y.id)})}),e.length>0&&jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsx("button",{onClick:()=>{a([]),n(false);},className:"w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all hover:bg-red-600/30 active:scale-95 border",style:{color:"#f87171",borderColor:"rgba(248, 113, 113, 0.3)",background:"rgba(248, 113, 113, 0.08)"},children:"Clear All"})})]})})]})}function on(e,t,a){let r=new Map;e.forEach(m=>{if(m.dependencies&&Array.isArray(m.dependencies)){let i=m.dependencies.map(u=>{if(typeof u=="string")return u;let d=u;return d.taskId||d.targetId||""}).filter(Boolean);r.set(m.id,i);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,p=m=>{if(!s.has(m)){s.add(m),n.add(m);let i=r.get(m)||[];for(let u of i){if(!s.has(u)&&p(u))return true;if(n.has(u))return true}}return n.delete(m),false};return p(a)}function Do({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[p,m]=useState(false),[i,u]=useState(""),[d,g]=useState(t.length>0),[h,C]=useState({top:0,left:0}),[T,c]=useState(null),b=useRef(null),y=useRef(null),l=()=>{if(!y.current)return;let w=y.current.getBoundingClientRect(),B=window.innerHeight,M=window.innerWidth,D=300,I=d?380:120,R=4,Y=w.right-D;Y<10&&(Y=w.left),Y+D>M-10&&(Y=M-D-10);let te=B-w.bottom,ye=w.top,De;te>=I+R?De=w.bottom+R:ye>=I+R?De=w.top-I-R:De=te>=ye?w.bottom+R:Math.max(10,w.top-I-R),C({top:De,left:Y}),m(true);};useEffect(()=>{if(!p||!y.current)return;let w=y.current.getBoundingClientRect(),B=window.innerHeight,M=window.innerWidth,D=300,I=d?380:120,R=4,Y=w.right-D;Y<10&&(Y=w.left),Y+D>M-10&&(Y=M-D-10);let te=B-w.bottom,ye=w.top,De;te>=I+R?De=w.bottom+R:ye>=I+R?De=w.top-I-R:De=te>=ye?w.bottom+R:Math.max(10,w.top-I-R),C({top:De,left:Y});},[d,p]),useEffect(()=>{let w=B=>{b.current&&!b.current.contains(B.target)&&!y.current?.contains(B.target)&&(m(false),u(""));};if(p)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[p]),useEffect(()=>{let w=B=>{B.key==="Escape"&&(m(false),u(""));};if(p)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[p]);let x=w=>{let B=t.includes(w),M=a.find(D=>D.id===w);if(c(null),B){let D=t.filter(I=>I!==w);r(D),D.length===0&&g(false);}else {if(s&&on(a,w,e)){let I=`Cannot add "${M?.title||w}" as dependency - would create circular reference`;c(I),n?.(w,M?.title||w),setTimeout(()=>c(null),3e3);return}r([...t,w]),g(true);}},v=()=>{let w=!d;g(w),w||r([]);},S=a.filter(w=>w.id!==e).filter(w=>w.title.toLowerCase().includes(i.toLowerCase())||w.id.toLowerCase().includes(i.toLowerCase())),k=t.length>0?"#3B82F6":"#BDC3C7";return jsxs("div",{className:`relative ${o||""}`,children:[jsxs("button",{ref:y,onClick:()=>p?m(false):l(),className:"flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5",title:t.length>0?`${t.length} dependencies`:"Add dependencies",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M7 9L9 7M11.5 3.5L10 2C8.89543 0.89543 7.10457 0.89543 6 2C4.89543 3.10457 4.89543 4.89543 6 6L7.5 7.5M4.5 12.5L6 14C7.10457 15.1046 8.89543 15.1046 10 14C11.1046 12.8954 11.1046 11.1046 10 10L8.5 8.5",stroke:k,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsx("span",{className:"text-xs font-medium",style:{color:k},children:t.length})]}),p&&jsx(lt,{children:jsxs("div",{ref:b,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${h.top}px`,left:`${h.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:[T&&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:T})]}),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:v,children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:d?"#3b82f6":"transparent",borderColor:d?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:d&&jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),d&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsx("input",{type:"text",value:i,onChange:w=>u(w.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:S.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"}):S.map(w=>{let B=t.includes(w.id);return jsxs("button",{onClick:()=>x(w.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:M=>{M.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:M=>{M.currentTarget.style.background="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0 mt-0.5 transition-all",style:{background:B?"#3b82f6":"transparent",borderColor:B?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:B&&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:w.title}),jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:w.id})]})]},w.id)})})]}),t.length>0&&jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsx("button",{onClick:()=>{r([]),g(false),m(false);},className:"w-full px-3 py-2 rounded-md text-xs font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#E74C3C"},children:"Clear All Dependencies"})})]})})]})}var ur=memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:p=[],allCards:m=[]})=>{let{attributes:i,listeners:u,setNodeRef:d,transform:g,transition:h,isDragging:C}=useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),T={transform:en.Transform.toString(g),transition:h};if(t)return jsx("div",{ref:d,style:T,...i,...u,onClick:()=>a?.(e),children:t(e)});let c=p.filter(x=>e.assignedUserIds?.includes(x.id)),b=e.progress===100,y=(e.attachments||[]).filter(x=>x.type.startsWith("image/")),l={...T,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxs("div",{ref:d,style:l,className:f("asakaa-card",C&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...u,onClick:x=>{x.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||a?.(e);},children:[e.coverImage&&jsx("div",{className:"asakaa-card-cover mb-3",children:jsx("img",{src:e.coverImage,alt:`Cover for ${e.title}`,className:"w-full h-32 object-cover rounded-md",loading:"lazy",onError:x=>{x.currentTarget.style.display="none";}})}),y.length>0&&!e.coverImage&&jsx("div",{className:"asakaa-card-attachments mb-3",children:y.length===1&&y[0]?jsx("img",{src:y[0].url,alt:y[0].name,className:"w-full h-32 object-cover rounded-md",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:x=>{x.currentTarget.style.display="none";}}):jsx("div",{className:"grid grid-cols-2 gap-1",children:y.slice(0,4).map((x,v)=>jsxs("div",{className:"relative",children:[jsx("img",{src:x.url,alt:x.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:S=>{S.currentTarget.style.display="none";}}),v===3&&y.length>4&&jsx("div",{className:"absolute inset-0 bg-black/60 rounded flex items-center justify-center",children:jsxs("span",{className:"text-white text-sm font-medium",children:["+",y.length-4]})})]},x.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:x=>x.stopPropagation(),className:"priority-selector",children:jsx(zr,{priority:e.priority,onChange:x=>n?.(e.id,{priority:x})})}),jsx("div",{onClick:x=>x.stopPropagation(),className:"date-picker",children:jsx(To,{startDate:e.startDate?typeof e.startDate=="string"?e.startDate:e.startDate.toISOString().split("T")[0]:void 0,endDate:e.endDate?typeof e.endDate=="string"?e.endDate:e.endDate.toISOString().split("T")[0]:void 0,onChange:(x,v)=>n?.(e.id,{startDate:x,endDate:v})})}),p.length>0&&jsx("div",{onClick:x=>x.stopPropagation(),className:"user-selector",children:jsx(Hr,{assignedUsers:c,availableUsers:p,onChange:x=>n?.(e.id,{assignedUserIds:x.map(v=>v.id)})})}),jsx("div",{onClick:x=>x.stopPropagation(),className:"dependencies-selector",children:jsx(Do,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(x=>typeof x=="string"?x:x.taskId):[],availableTasks:m,onChange:x=>n?.(e.id,{dependencies:x})})})]}),e.labels&&e.labels.length>0&&jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(x=>jsx("span",{className:"asakaa-label",children:x},x))}),typeof e.progress=="number"&&jsxs("div",{className:"mt-3 pt-2 border-t border-white/5",children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:"text-[10px] text-[#6B7280]",children:"Progreso"}),jsxs("span",{className:"text-[10px] font-medium",style:{color:"#3B82F6"},children:[Math.round(e.progress),"%"]})]}),jsx("div",{className:"h-1.5 rounded-full bg-white/5 overflow-hidden",children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(100,Math.max(0,e.progress))}%`,backgroundColor:"#3B82F6"}})})]})]})},(e,t)=>e.card.id===t.card.id&&e.card.title===t.card.title&&e.card.description===t.card.description&&e.card.position===t.card.position&&e.card.columnId===t.card.columnId&&e.card.priority===t.card.priority&&e.card.color===t.card.color&&e.card.progress===t.card.progress&&e.card.startDate===t.card.startDate&&e.card.endDate===t.card.endDate&&e.isSelected===t.isSelected&&JSON.stringify(e.card.labels)===JSON.stringify(t.card.labels)&&JSON.stringify(e.card.assignedUserIds)===JSON.stringify(t.card.assignedUserIds)&&JSON.stringify(e.card.dependencies)===JSON.stringify(t.card.dependencies)&&JSON.stringify(e.card.attachments?.map(a=>a.id))===JSON.stringify(t.card.attachments?.map(a=>a.id)));ur.displayName="Card";var nn={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"}},ql=({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 Xl({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=useState(false),[n,p]=useState({top:0,left:0}),m=useRef(null),i=useRef(null),u=[...Object.entries(nn).map(([c,b])=>({id:c,label:b.label,color:b.color,icon:b.icon})),...r.filter(c=>!Object.keys(nn).includes(c.id)).map(c=>({id:c.id,label:c.title,color:c.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let c=nn[e];if(c)return {...c,id:e};let b=r.find(y=>y.id===e);return b?{id:b.id,label:b.title,color:b.color||"#8B5CF6",icon:"circle-dot"}:{...nn.todo,id:"todo"}},g=()=>{if(!i.current)return;let c=i.current.getBoundingClientRect(),b=window.innerHeight,y=window.innerWidth,l=180,x=280,v=4,S=c.right-l;S<10&&(S=c.left),S+l>y-10&&(S=y-l-10);let k=b-c.bottom,w=c.top,B;k>=x+v?B=c.bottom+v:w>=x+v?B=c.top-x-v:B=k>=w?c.bottom+v:Math.max(10,c.top-x-v),p({top:B,left:S}),s(true);};useEffect(()=>{let c=b=>{m.current&&!m.current.contains(b.target)&&!i.current?.contains(b.target)&&s(false);};if(o)return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[o]),useEffect(()=>{let c=b=>{b.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[o]);let h=c=>{t(c),s(false);},C=d(),T=C.color;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:i,onClick:()=>o?s(false):g(),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:`${T}10`,boxShadow:`0 0 0 2px ${T}30 inset`},title:C.label,children:jsx(ql,{icon:C.icon,color:T})}),o&&jsx(lt,{children:jsxs("div",{ref:m,className:"status-selector-menu",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsx("div",{className:"py-1",children:u.map(c=>jsxs("button",{onClick:()=>h(c.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:c.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(ql,{icon:c.icon,color:c.color}),jsx("span",{className:"font-semibold",children:c.label}),e===c.id&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},c.id))})]})})]})}function Jl({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[s,n]=useState(false),[p,m]=useState(false),[i,u]=useState(e),[d,g]=useState({top:0,left:0}),h=useRef(null),C=useRef(null),T=useRef(null);useEffect(()=>{if(s&&C.current){let l=C.current.getBoundingClientRect();g({top:l.bottom+window.scrollY+8,left:l.left+window.scrollX});}},[s]),useEffect(()=>{let l=x=>{h.current&&!h.current.contains(x.target)&&!C.current?.contains(x.target)&&(n(false),m(false));};if(s)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[s]),useEffect(()=>{let l=x=>{x.key==="Escape"&&(n(false),m(false),u(e));};if(s)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[s,e]),useEffect(()=>{p&&T.current&&(T.current.focus(),T.current.select());},[p]);let c=()=>{m(true),u(e);},b=()=>{let l=i.trim();l&&l!==e&&t(l),m(false),n(false),u(e);},y=l=>{l.key==="Enter"?b():l.key==="Escape"&&(m(false),u(e));};return jsxs("div",{className:`relative ${o||""}`,children:[jsx("button",{ref:C,onClick:()=>n(!s),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:"Column options","aria-label":"Column menu",children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),s&&jsx(lt,{children:jsx("div",{ref:h,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${d.top}px`,left:`${d.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:p?jsxs("div",{className:"p-3",children:[jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:"Rename Column"}),jsx("input",{ref:T,type:"text",value:i,onChange:l=>u(l.target.value),onKeyDown:y,onBlur:b,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:"Column name",maxLength:50})]}):jsxs("div",{className:"py-1",children:[jsxs("button",{onClick:c,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-white/90 hover:bg-white/10 transition-all",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-medium",children:"Rename"})]}),r&&a&&jsxs(Fragment,{children:[jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxs("button",{onClick:()=>{a(),n(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-red-400 hover:bg-red-500/10 transition-all",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M2 4H14M5 4V2.5C5 2.22386 5.22386 2 5.5 2H10.5C10.7761 2 11 2.22386 11 2.5V4M12.5 4V13.5C12.5 13.7761 12.2761 14 12 14H4C3.72386 14 3.5 13.7761 3.5 13.5V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M6.5 7V11M9.5 7V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),jsx("span",{className:"font-medium",children:"Delete"})]})]})]})})})]})}var io=memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:p,availableUsers:m,allCards:i,enableVirtualization:u,cardHeight:d=120,isCollapsed:g,onToggleCollapse:h,onColumnRename:C,onColumnDelete:T,isDeletable:c=false,className:b})=>{let{setNodeRef:y,isOver:l}=useDroppable({id:e.id,data:{type:"column",column:e}}),x=useRef(null),v=u??Cl(t.length),S=useVirtualizer({count:t.length,getScrollElement:()=>x.current,estimateSize:()=>d,enabled:v});if(a)return jsx("div",{ref:y,className:b,children:a(e,t)});let w=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let D=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:D}:D>=80?{state:"warning",percentage:D}:D>=60?{state:"approaching",percentage:D}:{state:"ok",percentage:D}})(),B=w.state==="exceeded",M=()=>"asakaa-column-count";return jsxs("div",{ref:y,className:f("asakaa-column",l&&"ring-2 ring-asakaa-accent-blue",B&&"ring-2 ring-asakaa-accent-red",b),children:[o?o(e,t.length):jsxs("div",{className:"asakaa-column-header group",children:[jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:f(M()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&w.state!=="none"&&jsxs("span",{className:"text-xs font-medium flex items-center",title:`${w.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[w.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"})]}),w.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"})]}),w.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"})}),w.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"})]})]}),(C||T)&&jsx(Jl,{columnTitle:e.title,onRename:D=>C?.(e.id,D),onDelete:T?()=>T(e.id):void 0,isDeletable:c}),h&&jsx("button",{onClick:h,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":g?"Expand column":"Collapse column",children:g?"\u25B6":"\u25BC"})]})]}),!g&&jsx("div",{ref:x,className:"asakaa-column-cards",style:{maxHeight:v?"600px":void 0},children:jsx(SortableContext,{items:t.map(D=>D.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"})}):v?jsx("div",{style:{height:`${S.getTotalSize()}px`,position:"relative"},children:S.getVirtualItems().map(D=>{let I=t[D.index];return I?jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${D.start}px)`},children:jsx(ur,{card:I,render:r,onClick:n,onUpdate:p,availableUsers:m,allCards:i})},I.id):null})}):t.map(D=>jsx(ur,{card:D,render:r,onClick:n,onUpdate:p,availableUsers:m,allCards:i},D.id))})})]})});io.displayName="Column";function gs({title:e,onSave:t,className:a}){let[r,o]=useState(false),[s,n]=useState(e),p=useRef(null);useEffect(()=>{r&&p.current&&(p.current.focus(),p.current.select());},[r]);let m=()=>{let u=s.trim();u&&u!==e?t(u):n(e),o(false);},i=u=>{u.key==="Enter"?m():u.key==="Escape"&&(n(e),o(false));};return r?jsx("input",{ref:p,type:"text",value:s,onChange:u=>n(u.target.value),onBlur:m,onKeyDown:i,className:f("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsx("h2",{className:f("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}var cn=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function nr({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[p,m]=useState(false),[i,u]=useState(""),[d,g]=useState(false),[h,C]=useState(cn[10]||"#3B82F6"),[T,c]=useState({top:0,left:0}),b=useRef(null),y=useRef(null),l=useRef(null),x=useRef(null),v=t.filter(D=>D.name.toLowerCase().includes(i.toLowerCase())),S=t.some(D=>D.name.toLowerCase()===i.toLowerCase());useEffect(()=>{if(p&&y.current){let D=y.current.getBoundingClientRect();c({top:D.bottom+6,left:D.left});}},[p]),useEffect(()=>{let D=I=>{let R=I.target,Y=b.current?.contains(R),te=l.current?.contains(R);!Y&&!te&&(m(false),u(""),g(false));};if(p)return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[p]),useEffect(()=>{p&&x.current&&x.current.focus();},[p]);let k=D=>{let I=e.some(R=>R.id===D.id);a(I?e.filter(R=>R.id!==D.id):[...e,D]);},w=async()=>{if(!(!r||!i.trim())){g(true);try{let D=await r(i.trim(),h);D&&(a([...e,D]),u(""),C(cn[Math.floor(Math.random()*cn.length)]||"#3B82F6"));}finally{g(false);}}},B=(D,I)=>{I.stopPropagation(),a(e.filter(R=>R.id!==D));},M={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxs("div",{ref:b,className:"relative",children:[jsxs("button",{ref:y,type:"button",onClick:()=>!s&&m(!p),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:M,disabled:s,children:[jsx(Tag,{className:"w-3.5 h-3.5"}),e.length>0?jsxs("div",{className:"flex items-center gap-1",children:[e.slice(0,2).map(D=>jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${D.color}20`,color:D.color},children:D.name},D.id)),e.length>2&&jsxs("span",{className:"text-xs",style:{color:o.textTertiary},children:["+",e.length-2]})]}):jsx("span",{children:"Agregar"}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:o.textTertiary}})]}),typeof document<"u"&&createPortal(jsx(AnimatePresence,{children:p&&jsxs(motion.div,{ref:l,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:T.top,left:T.left,zIndex:99999,backgroundColor:o.bgPrimary,border:`1px solid ${o.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsx("div",{className:"p-2 border-b",style:{borderColor:o.border},children:jsx("input",{ref:x,type:"text",value:i,onChange:D=>u(D.target.value),placeholder:"Buscar o crear etiqueta...",className:"w-full px-3 py-1.5 text-sm rounded-md outline-none",style:{backgroundColor:o.bgSecondary,color:o.textPrimary,border:`1px solid ${o.borderLight}`},onKeyDown:D=>{D.key==="Enter"&&i.trim()&&!S&&r&&w();}})}),e.length>0&&jsxs("div",{className:"p-2 border-b",style:{borderColor:o.border},children:[jsx("p",{className:"text-xs mb-1.5",style:{color:o.textTertiary},children:"Seleccionadas"}),jsx("div",{className:"flex flex-wrap gap-1",children:e.map(D=>jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium cursor-pointer hover:opacity-80",style:{backgroundColor:`${D.color}20`,color:D.color},onClick:I=>B(D.id,I),children:[D.name,jsx(X,{className:"w-3 h-3"})]},D.id))})]}),jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:v.length>0?v.map(D=>{let I=e.some(R=>R.id===D.id);return jsxs("button",{type:"button",onClick:()=>k(D),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:I?`${D.color}15`:"transparent",color:o.textPrimary},onMouseEnter:R=>{I||(R.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:R=>{I||(R.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:D.color}}),jsx("span",{className:"flex-1 text-left",children:D.name}),I&&jsx(Check,{className:"w-4 h-4",style:{color:D.color}})]},D.id)}):i.trim()?jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No se encontraron etiquetas"}):jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No hay etiquetas disponibles"})}),i.trim()&&!S&&r&&jsxs("div",{className:"p-2 border-t",style:{borderColor:o.border},children:[jsx("div",{className:"flex items-center gap-2 mb-2",children:jsx("p",{className:"text-xs",style:{color:o.textTertiary},children:"Crear nueva etiqueta"})}),jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:cn.map(D=>jsx("button",{type:"button",onClick:()=>C(D),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:D,outline:h===D?`2px solid ${D}`:"none",outlineOffset:"2px"}},D))}),jsxs("button",{type:"button",onClick:w,disabled:d,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:h,color:"#FFFFFF",opacity:d?.7:1},children:[d?jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsx(Plus,{className:"w-4 h-4"}),'Crear "',i.trim(),'"']})]})]})}),document.body)]})}function hs({tag:e,onRemove:t,size:a="sm"}){return jsxs("span",{className:`inline-flex items-center gap-1 rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:`${e.color}20`,color:e.color},children:[e.name,t&&jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),t();},className:"hover:opacity-70",children:jsx(X,{className:"w-3 h-3"})})]})}function td({tags:e,maxVisible:t=3,size:a="sm"}){if(!e||e.length===0)return null;let r=e.slice(0,t),o=e.length-t;return jsxs("div",{className:"flex flex-wrap gap-1",children:[r.map(s=>jsx(hs,{tag:s,size:a},s.id)),o>0&&jsxs("span",{className:`inline-flex items-center rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:"rgba(100,100,100,0.2)",color:"#9CA3AF"},children:["+",o]})]})}var sr=[{name:"Azul",value:"#6366F1",light:"#818CF8"},{name:"P\xFArpura",value:"#A855F7",light:"#C084FC"},{name:"Rosa",value:"#EC4899",light:"#F472B6"},{name:"Rojo",value:"#EF4444",light:"#F87171"},{name:"Naranja",value:"#F59E0B",light:"#FBBF24"},{name:"Amarillo",value:"#EAB308",light:"#FACC15"},{name:"Lima",value:"#84CC16",light:"#A3E635"},{name:"Verde",value:"#10B981",light:"#34D399"},{name:"Esmeralda",value:"#059669",light:"#10B981"},{name:"Cyan",value:"#06B6D4",light:"#22D3EE"},{name:"Azul Cielo",value:"#0EA5E9",light:"#38BDF8"},{name:"\xCDndigo",value:"#4F46E5",light:"#6366F1"},{name:"Violeta",value:"#8B5CF6",light:"#A78BFA"},{name:"Fucsia",value:"#D946EF",light:"#E879F9"},{name:"Coral",value:"#F97316",light:"#FB923C"},{name:"Magenta",value:"#E11D48",light:"#FB7185"}];function sd(e,t=[]){if("title"in e&&!("name"in e)){let a=e,r=(a.assignedUserIds||[]).map(o=>{let s=t.find(n=>n.id===o);return s||null}).filter(o=>o!==null);return {id:a.id,name:a.title,startDate:a.startDate?new Date(a.startDate):void 0,endDate:a.endDate?new Date(a.endDate):void 0,progress:a.progress||0,status:a.columnId,priority:a.priority?.toLowerCase(),assignees:r,dependencies:Array.isArray(a.dependencies)?a.dependencies.map(o=>typeof o=="string"?o:o.taskId):[],tags:a.tags,subtasks:a.subtasks?.map(o=>({id:o.id,name:o.title,progress:o.completed?100:0,startDate:new Date,endDate:new Date})),color:a.color,description:a.description}}return e}function cu(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}}function _r({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:p=[],availableTags:m=[],onCreateTag:i,attachments:u=[],onUploadAttachments:d,onDeleteAttachment:g,availableTasks:h=[],comments:C=[],onAddComment:T,currentUser:c}){let b=s==="dark",y={textTertiary:b?"#6B7280":"#9CA3AF",textSecondary:b?"#9CA3AF":"#6B7280",textPrimary:b?"#FFFFFF":"#111827",borderLight:b?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:b?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:b?"#1A1D25":"#FFFFFF",bgSecondary:b?"#0F1117":"#F9FAFB",hoverBg:b?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},l=e&&"title"in e&&!("name"in e),x=e,[v,S]=useState(e?sd(e,p):null),[k,w]=useState(false),[B,M]=useState(false),[D,I]=useState(false),[R,Y]=useState(null),[te,ye]=useState(new Date),[De,Se]=useState(false),[O,V]=useState(false),[$,G]=useState(""),[A,X$1]=useState(false),[q,U]=useState(false),[fe,Me]=useState(false),[Oe,he]=useState(""),Ye=useRef(null),[We,et]=useState(""),vt=useRef(null),[Mt,mt]=useState(""),[z,ie]=useState(false);useEffect(()=>{if(e){let N=sd(e,p);S(N),he(N.description||""),et(N.name||"");}},[e?.id,p]),useEffect(()=>()=>{Ye.current&&clearTimeout(Ye.current),vt.current&&clearTimeout(vt.current);},[]);let ve=useCallback(N=>{S(N),l&&o&&x?o(cu(N,x)):r&&r(N);},[l,x,o,r]),Pe=useCallback(()=>{w(false),M(false),I(false),Y(null),V(false),G(""),X$1(false);},[]),ze=useCallback((N,ee)=>{if(!v)return;let se={...v,[N]:ee};ve(se);},[v,ve]),at=useCallback(N=>{he(N),Ye.current&&clearTimeout(Ye.current),Ye.current=setTimeout(()=>{if(v){let ee={...v,description:N};ve(ee);}},800);},[v,ve]),Et=useCallback(N=>{et(N),vt.current&&clearTimeout(vt.current),vt.current=setTimeout(()=>{if(v&&N.trim()){let ee={...v,name:N.trim()};ve(ee);}},800);},[v,ve]),Fe=useCallback(async()=>{if(!(!v||!Mt.trim()||!T)){ie(true);try{await T(v.id,Mt.trim()),mt("");}finally{ie(false);}}},[v,Mt,T]),Xt=useCallback(N=>{let ee=typeof N=="string"?new Date(N):N,Te=new Date().getTime()-ee.getTime(),$e=Math.floor(Te/6e4),tt=Math.floor(Te/36e5),Ge=Math.floor(Te/864e5);return $e<1?n==="es"?"Ahora":"Just now":$e<60?n==="es"?`Hace ${$e} min`:`${$e}m ago`:tt<24?n==="es"?`Hace ${tt}h`:`${tt}h ago`:Ge<7?n==="es"?`Hace ${Ge}d`:`${Ge}d ago`:ee.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),Ot=useCallback(N=>{if(!v)return;let ee=v.progress||0;N==="completed"?ee=100:N==="in-progress"&&ee===0?ee=10:N==="todo"&&(ee=0);let se={...v,status:N,progress:ee};ve(se),w(false);},[v,ve]),Nt=useCallback((N,ee)=>{if(!v)return;let se={...v,startDate:N,endDate:ee};ve(se);},[v,ve]),ct=useCallback(()=>{let N=te.getFullYear(),ee=te.getMonth(),se=new Date(N,ee,1),$e=new Date(N,ee+1,0).getDate(),tt=se.getDay(),Ge=[],Be=new Date(N,ee,0).getDate();for(let _=tt-1;_>=0;_--)Ge.push({date:new Date(N,ee-1,Be-_),isCurrentMonth:false});for(let _=1;_<=$e;_++)Ge.push({date:new Date(N,ee,_),isCurrentMonth:true});let rt=42-Ge.length;for(let _=1;_<=rt;_++)Ge.push({date:new Date(N,ee+1,_),isCurrentMonth:false});return Ge},[te]),Jt=useCallback(async N=>{if(N.preventDefault(),N.stopPropagation(),U(false),!v||!d)return;let ee=Array.from(N.dataTransfer.files);if(ee.length!==0){Me(true);try{await d(v.id,ee);}finally{Me(false);}}},[v,d]),Ea=useCallback(async N=>{if(!v||!d||!N.target.files)return;let ee=Array.from(N.target.files);if(ee.length!==0){Me(true);try{await d(v.id,ee);}finally{Me(false);}N.target.value="";}},[v,d]),oe=useCallback(N=>{N.preventDefault(),N.stopPropagation(),U(true);},[]),me=useCallback(N=>{N.preventDefault(),N.stopPropagation(),U(false);},[]),pa=useCallback(N=>N<1024?`${N} B`:N<1024*1024?`${(N/1024).toFixed(1)} KB`:`${(N/(1024*1024)).toFixed(1)} MB`,[]),ya=useCallback(N=>N.startsWith("image/")?Image:N.includes("pdf")||N.includes("document")?FileText:File,[]);return !t||!v?null:jsx(AnimatePresence,{children:t&&v&&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:f("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",b?"bg-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxs("div",{className:f("px-6 py-3 border-b flex items-center gap-3",b?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Circle,{className:f("w-4 h-4",b?"text-[#9CA3AF]":"text-gray-500")}),jsxs("span",{className:f("text-xs px-2 py-0.5 rounded",b?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsx("span",{className:f("text-xs font-mono",b?"text-[#6B7280]":"text-gray-400"),children:v.id.slice(0,8)}),jsxs("button",{className:f("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",b?"bg-purple-500/20 text-purple-400 hover:bg-purple-500/30":"bg-purple-100 text-purple-700 hover:bg-purple-200"),children:[jsx(Sparkles,{className:"w-3 h-3"}),"Ask AI"]})]}),jsx("div",{className:"flex-1"}),jsx("button",{className:f("p-1.5 rounded transition-colors",b?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(Maximize2,{className:"w-4 h-4"})}),jsx("button",{className:f("p-1.5 rounded transition-colors",b?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(MoreHorizontal,{className:"w-5 h-5"})}),jsx("button",{onClick:a,className:f("p-1.5 rounded transition-colors",b?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-5 h-5"})})]}),jsx("div",{className:"px-6 py-4",children:jsxs("div",{className:"flex items-start gap-3",children:[jsx("button",{onClick:()=>{let N=v.progress===100?0:100,se={...v,progress:N,status:N===100?"completed":"todo"};ve(se);},className:f("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",v.progress===100?"bg-green-500 border-green-500":b?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:v.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("input",{type:"text",value:We,onChange:N=>Et(N.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:f("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",v.progress===100?"line-through text-[#6B7280]":b?"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:f("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsx("button",{onClick:()=>{Pe(),w(!k);},className:f("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",v.progress===100||v.status==="completed"?"bg-green-500/20 text-green-400":v.progress&&v.progress>0||v.status==="in-progress"?"bg-blue-500/20 text-blue-400":b?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:v.progress===100||v.status==="completed"?n==="es"?"COMPLETADO":"DONE":v.progress&&v.progress>0||v.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsx(AnimatePresence,{children:k&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>w(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500"}].map(N=>jsxs("button",{onClick:()=>Ot(N.id),className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",b?"hover:bg-white/5":"hover:bg-gray-50",v.status===N.id&&(b?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:f("w-2 h-2 rounded-full",N.color)}),jsx("span",{className:b?"text-white":"text-gray-900",children:N.label})]},N.id))})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(User,{className:f("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxs("button",{onClick:()=>{Pe(),I(!D);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",b?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[v.assignees&&v.assignees.length>0?jsxs("div",{className:"flex items-center gap-1",children:[v.assignees.slice(0,3).map((N,ee)=>jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:N.color||"#8B5CF6"},title:N.name,children:N.initials||N.name.slice(0,2).toUpperCase()},ee)),v.assignees.length>3&&jsxs("span",{className:f("text-xs",b?"text-[#6B7280]":"text-gray-400"),children:["+",v.assignees.length-3]})]}):jsx("span",{className:f("text-sm",b?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsx(ChevronDown,{className:f("w-3 h-3",b?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:D&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>I(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:p.length>0?p.map(N=>{let ee=v.assignees?.some(se=>se.name===N.name);return jsxs("button",{onClick:()=>{let se=v.assignees||[],Te;ee?Te=se.filter($e=>$e.name!==N.name):Te=[...se,N],ze("assignees",Te);},className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",b?"hover:bg-white/5":"hover:bg-gray-50",ee&&(b?"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:N.color||"#8B5CF6"},children:N.initials||N.name.slice(0,2).toUpperCase()}),jsx("span",{className:f("flex-1",b?"text-white":"text-gray-900"),children:N.name}),ee&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},N.name)}):jsx("div",{className:f("px-3 py-4 text-sm text-center",b?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CalendarDays,{className:f("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxs("button",{onClick:()=>{Y(R?null:"start"),ye(v.startDate||new Date);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",b?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[v.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsx("span",{className:f("mx-1",b?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),v.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsx(AnimatePresence,{children:R&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Y(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:f("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:N=>N.stopPropagation(),children:[jsxs("div",{className:f("w-44 py-2 border-r",b?"border-white/10":"border-gray-200"),children:[(()=>{let N=new Date,ee=new Date(N);ee.setDate(N.getDate()+1);let se=new Date(N);se.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 $e=new Date(N);$e.setDate(N.getDate()+(6-N.getDay()+7)%7+7);let tt=new Date(N);tt.setDate(N.getDate()+14);let Ge=new Date(N);return Ge.setDate(N.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:N,display:N.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:ee,display:ee.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:se,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:Te,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:$e,display:$e.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:tt,display:tt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Ge,display:Ge.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((rt,_)=>jsxs("button",{className:f("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",b?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(R==="start"){let ae=v.endDate&&rt.date>v.endDate?rt.date:v.endDate;Nt(rt.date,ae),Y("end");}else {let ae=v.startDate&&rt.date<v.startDate?rt.date:v.startDate;Nt(ae,rt.date),Y(null);}},children:[jsx("span",{children:rt.label}),jsx("span",{className:f("text-xs",b?"text-[#6B7280]":"text-gray-400"),children:rt.display})]},_))})(),jsx("div",{className:f("border-t mt-2 pt-2",b?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{Nt(void 0,void 0),Y(null);},className:f("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",b?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:n==="es"?"Quitar fechas":"Clear dates"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[jsx("div",{className:f("text-xs mb-3 px-2 py-1 rounded",b?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:R==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("span",{className:f("font-medium",b?"text-white":"text-gray-900"),children:te.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>ye(new Date),className:f("p-1 rounded text-sm transition-colors",b?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>ye(new Date(te.getFullYear(),te.getMonth()-1)),className:f("p-1 rounded",b?"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:()=>ye(new Date(te.getFullYear(),te.getMonth()+1)),className:f("p-1 rounded",b?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(N=>jsx("div",{className:f("w-8 h-8 flex items-center justify-center text-xs",b?"text-[#6B7280]":"text-gray-400"),children:N},N))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:ct().map((N,ee)=>{let se=N.date.toDateString()===new Date().toDateString(),Te=v.startDate?.toDateString()===N.date.toDateString(),$e=v.endDate?.toDateString()===N.date.toDateString(),tt=Te||$e,Ge=v.startDate&&v.endDate&&N.date>=v.startDate&&N.date<=v.endDate;return jsx("button",{onClick:()=>{let Be=new Date(N.date);if(R==="start"){let rt=v.endDate&&Be>v.endDate?Be:v.endDate;Nt(Be,rt),Y("end");}else {let rt=v.startDate&&Be<v.startDate?Be:v.startDate;Nt(rt,Be),Y(null);}},className:f("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!N.isCurrentMonth&&(b?"text-[#4B5563]":"text-gray-300"),N.isCurrentMonth&&(b?"text-white":"text-gray-900"),se&&"ring-2 ring-[#3B82F6]",Te&&"bg-[#3B82F6] text-white",$e&&!Te&&"bg-[#7C3AED] text-white",Ge&&!tt&&(b?"bg-[#7C3AED]/20":"bg-purple-100"),!tt&&(b?"hover:bg-white/10":"hover:bg-gray-100")),children:N.date.getDate()},ee)})})]})]})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Flag,{className:f("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsx("button",{onClick:()=>{Pe(),M(!B);},className:f("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",v.priority==="high"||v.priority==="urgent"?"bg-red-500/20 text-red-400":v.priority==="medium"?"bg-yellow-500/20 text-yellow-400":v.priority==="low"?"bg-green-500/20 text-green-400":b?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:v.priority?v.priority==="high"||v.priority==="urgent"?n==="es"?"Alta":"High":v.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsx(AnimatePresence,{children:B&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>M(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(N=>jsxs("button",{onClick:()=>{ze("priority",N.id),M(false);},className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",b?"hover:bg-white/5":"hover:bg-gray-50",v.priority===N.id&&(b?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:f("w-2 h-2 rounded-full",N.color)}),jsx("span",{className:b?"text-white":"text-gray-900",children:N.label})]},N.id||"none"))})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:f("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsx("span",{className:f("text-sm",b?"text-white":"text-gray-900"),children:v.startDate&&v.endDate?`${Math.ceil((v.endDate.getTime()-v.startDate.getTime())/(1e3*60*60*24))} ${n==="es"?"d\xEDas":"days"}`:n==="es"?"Sin definir":"Not set"})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:f("w-4 h-4 rounded-full border-2",b?"border-[#6B7280]":"border-gray-400")}),jsx("span",{className:f("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[De?jsx("input",{type:"range",min:"0",max:"100",step:"5",value:v.progress||0,onChange:N=>{let ee=parseInt(N.target.value),se=v.status;ee===100?se="completed":ee>0?se="in-progress":se="todo";let Te={...v,progress:ee,status:se};ve(Te);},onBlur:()=>Se(false),className:f("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",b?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsx("button",{onClick:()=>Se(true),className:f("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",b?"bg-white/10":"bg-gray-200"),children:jsx("div",{className:f("h-full rounded-full transition-all",v.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${v.progress||0}%`}})}),jsxs("span",{className:f("text-sm font-medium min-w-[40px]",b?"text-white":"text-gray-900"),children:[v.progress||0,"%"]})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Tag,{className:f("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsx(nr,{selectedTags:v.tags||[],availableTags:m,onChange:N=>{ze("tags",N);},onCreateTag:i,theme:y})]}),jsxs("div",{className:"flex items-start gap-3 relative",children:[jsx(Link2,{className:f("w-4 h-4 mt-1.5",b?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-24 mt-1",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxs("div",{className:"flex-1",children:[v.dependencies&&v.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:v.dependencies.map(N=>{let ee=h.find(se=>se.id===N);return jsxs("span",{className:f("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",b?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[ee?.name||N.slice(0,8),jsx("button",{onClick:()=>{let se=(v.dependencies||[]).filter(Te=>Te!==N);ze("dependencies",se);},className:f("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsx(X,{className:"w-3 h-3"})})]},N)})}),jsxs("button",{onClick:()=>{Pe(),V(!O);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",b?"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:f("text-sm",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsx(AnimatePresence,{children:O&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{V(false),G("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsx("div",{className:f("p-2 border-b",b?"border-white/10":"border-gray-200"),children:jsx("input",{type:"text",value:$,onChange:N=>G(N.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:f("w-full px-3 py-2 rounded-md text-sm outline-none",b?"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:h.length>0?h.filter(N=>N.id!==v.id).filter(N=>$===""||N.name.toLowerCase().includes($.toLowerCase())).map(N=>{let ee=v.dependencies?.includes(N.id);return jsxs("button",{onClick:()=>{let se=v.dependencies||[],Te;ee?Te=se.filter($e=>$e!==N.id):Te=[...se,N.id],ze("dependencies",Te);},className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",b?"hover:bg-white/5":"hover:bg-gray-50",ee&&(b?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:f("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",ee?"bg-blue-500 border-blue-500":b?"border-white/30":"border-gray-300"),children:ee&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:f("block truncate",b?"text-white":"text-gray-900"),children:N.name}),jsx("span",{className:f("text-xs",b?"text-[#6B7280]":"text-gray-400"),children:N.id.slice(0,8)})]})]},N.id)}):jsx("div",{className:f("px-3 py-4 text-sm text-center",b?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Palette,{className:f("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxs("button",{onClick:()=>{Pe(),X$1(!A);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",b?"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:v.color||"#6366F1"}}),jsx("span",{className:f("text-sm",b?"text-white":"text-gray-900"),children:sr.find(N=>N.value===v.color)?.name||(n==="es"?"Azul":"Blue")}),jsx(ChevronDown,{className:f("w-3 h-3",b?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:A&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>X$1(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-6 gap-1.5",children:sr.map(N=>{let ee=v.color===N.value;return jsx("button",{onClick:()=>{ze("color",N.value),X$1(false);},className:f("w-7 h-7 rounded-full flex items-center justify-center transition-all",ee&&"ring-2 ring-offset-2",b?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:N.value,outlineColor:ee?N.value:void 0},title:N.name,children:ee&&jsx(Check,{className:"w-3.5 h-3.5 text-white"})},N.value)})})})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Diamond,{className:f("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Hito":"Milestone"}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",checked:v.isMilestone||false,onChange:N=>ze("isMilestone",N.target.checked),className:f("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",v.isMilestone?"bg-purple-500 border-purple-500":b?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsx("span",{className:f("text-sm",b?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxs("div",{className:f("mt-6 pt-4 border-t",b?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsx(FileText,{className:f("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsx("h3",{className:f("text-sm font-semibold",b?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsx("textarea",{value:Oe,onChange:N=>at(N.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:f("w-full min-h-[100px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors",b?"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("button",{className:f("flex items-center gap-2 text-sm mt-2 transition-colors",b?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsx(Sparkles,{className:"w-4 h-4"}),n==="es"?"Escribe con IA":"Write with AI"]})]}),jsxs("div",{className:f("mt-6 pt-4 border-t",b?"border-white/10":"border-gray-200"),children:[jsx("h3",{className:f("text-sm font-semibold mb-3",b?"text-white":"text-gray-900"),children:n==="es"?"Campos personalizados":"Custom fields"}),jsxs("button",{className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",b?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsx(Plus,{className:"w-4 h-4"}),n==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxs("div",{className:f("mt-6 pt-4 border-t",b?"border-white/10":"border-gray-200"),children:[jsx("h3",{className:f("text-sm font-semibold mb-3",b?"text-white":"text-gray-900"),children:n==="es"?"Subtareas":"Subtasks"}),v.subtasks&&v.subtasks.length>0&&jsx("div",{className:"space-y-2 mb-3",children:v.subtasks.map(N=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:f("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",N.progress===100?"bg-green-500 border-green-500":b?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:N.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("span",{className:f("text-sm",N.progress===100?"line-through text-[#6B7280]":b?"text-white":"text-gray-900"),children:N.name})]},N.id))}),jsxs("button",{className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",b?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsx(Plus,{className:"w-4 h-4"}),n==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxs("div",{className:f("mt-6 pt-4 border-t",b?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("h3",{className:f("text-sm font-semibold",b?"text-white":"text-gray-900"),children:n==="es"?"Listas de control":"Checklists"}),jsx("button",{className:f("p-1 rounded transition-colors",b?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(Plus,{className:"w-4 h-4"})})]}),jsxs("button",{className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",b?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsx(ListChecks,{className:"w-4 h-4"}),n==="es"?"Crear lista de control":"Create checklist"]})]}),jsxs("div",{className:f("mt-6 pt-4 border-t",b?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:f("text-sm font-semibold mb-3",b?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",u.length>0&&jsxs("span",{className:f("ml-2 text-xs font-normal",b?"text-[#6B7280]":"text-gray-400"),children:["(",u.length,")"]})]}),u.length>0&&jsx("div",{className:"space-y-2 mb-4",children:u.map(N=>{let ee=ya(N.type),se=N.type.startsWith("image/");return jsxs("div",{className:f("flex items-center gap-3 p-2 rounded-lg group transition-colors",b?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[se&&N.thumbnailUrl?jsx("img",{src:N.thumbnailUrl,alt:N.name,className:"w-10 h-10 rounded object-cover"}):jsx("div",{className:f("w-10 h-10 rounded flex items-center justify-center",b?"bg-white/10":"bg-gray-200"),children:jsx(ee,{className:f("w-5 h-5",b?"text-[#9CA3AF]":"text-gray-500")})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("a",{href:N.url,target:"_blank",rel:"noopener noreferrer",className:f("text-sm font-medium truncate block hover:underline",b?"text-white":"text-gray-900"),children:N.name}),jsx("p",{className:f("text-xs",b?"text-[#6B7280]":"text-gray-400"),children:pa(N.size)})]}),g&&jsx("button",{onClick:()=>g(N.id),className:f("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",b?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:n==="es"?"Eliminar":"Delete",children:jsx(Trash2,{className:"w-4 h-4"})})]},N.id)})}),jsxs("div",{onDragOver:oe,onDragLeave:me,onDrop:Jt,className:f("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",q?b?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":b?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",fe&&"pointer-events-none opacity-50"),children:[jsx("input",{type:"file",multiple:true,onChange:Ea,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!d||fe}),fe?jsxs(Fragment,{children:[jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),jsx("p",{className:f("text-sm",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxs(Fragment,{children:[jsx(Upload,{className:f("w-6 h-6 mx-auto mb-2",q?"text-blue-500":b?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:f("text-sm",b?"text-[#9CA3AF]":"text-gray-500"),children:q?n==="es"?"Suelta los archivos aqu\xED":"Drop files here":n==="es"?jsxs(Fragment,{children:["Suelta tus archivos aqu\xED o ",jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxs(Fragment,{children:["Drop your files here or ",jsx("span",{className:"underline",children:"click to upload"})]})}),!d&&jsx("p",{className:f("text-xs mt-1",b?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxs("div",{className:f("w-80 border-l flex flex-col",b?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsx("div",{className:f("px-4 py-3 border-b",b?"border-white/10":"border-gray-200"),children:jsxs("h3",{className:f("text-sm font-semibold",b?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",C.length>0&&jsxs("span",{className:f("ml-2 text-xs font-normal",b?"text-[#6B7280]":"text-gray-400"),children:["(",C.length,")"]})]})}),jsx("div",{className:"flex-1 overflow-y-auto p-4",children:C.length>0?jsx("div",{className:"space-y-4",children:C.map(N=>jsxs("div",{className:"flex gap-3",children:[jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:N.user?.color||"#8B5CF6"},children:N.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:f("text-sm font-medium",b?"text-white":"text-gray-900"),children:N.user?.name||(n==="es"?"Usuario":"User")}),jsx("span",{className:f("text-xs",b?"text-[#6B7280]":"text-gray-400"),children:Xt(N.createdAt)})]}),jsx("p",{className:f("text-sm break-words",b?"text-[#9CA3AF]":"text-gray-600"),children:N.content})]})]},N.id))}):jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsx(MessageSquare,{className:f("w-10 h-10 mb-3",b?"text-[#3B4252]":"text-gray-300")}),jsx("p",{className:f("text-sm",b?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsx("div",{className:f("p-4 border-t",b?"border-white/10":"border-gray-200"),children:jsxs("div",{className:"flex items-start gap-2",children:[c&&jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:c.color||"#8B5CF6"},children:c.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:f("flex-1 flex items-center gap-2 px-3 py-2 rounded-lg",b?"bg-white/5":"bg-white border border-gray-200"),children:[jsx("input",{type:"text",value:Mt,onChange:N=>mt(N.target.value),onKeyDown:N=>{N.key==="Enter"&&!N.shiftKey&&(N.preventDefault(),Fe());},placeholder:n==="es"?"Escribe un comentario...":"Write a comment...",disabled:z||!T,className:f("flex-1 bg-transparent text-sm outline-none",b?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400",(z||!T)&&"opacity-50")}),jsx("button",{onClick:Fe,disabled:z||!Mt.trim()||!T,className:f("p-1.5 rounded transition-colors",Mt.trim()&&T?"bg-blue-500 text-white hover:bg-blue-600":b?"text-[#6B7280]":"text-gray-400",z&&"opacity-50 cursor-not-allowed"),children:z?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"})})]})]})})]})]})]})})}function ks(){let[e,t]=useState(()=>dragStore.getState());useEffect(()=>dragStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{dragStore.setState(r);},[]);return [e,a]}function Er({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:p,isLoading:m,error:i,children:u,availableTags:d=[],onCreateTag:g,attachmentsByCard:h,onUploadAttachments:C,onDeleteAttachment:T,comments:c,onAddComment:b,currentUser:y,onTaskOpen:l}){let[x,v]=ks(),[S,k]=useState(null),w=o?.theme||"dark",B=w==="dark"||w==="neutral",M=B?"dark":"",D=useCallback((A,X)=>{t.onCardUpdate?.(A,X);},[t]),I=useCallback((A,X)=>{t.onColumnUpdate?.(A,{title:X});},[t]),R=useCallback(A=>{t.onColumnDelete?.(A);},[t]),Y=["todo","in-progress","completed"],te=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),ye=useMemo(()=>{let A=new Map;return e.columns.forEach(X=>{let q=X.cardIds.map(U=>e.cards.find(fe=>fe.id===U)).filter(U=>U!==void 0).sort((U,fe)=>U.position-fe.position);A.set(X.id,q);}),A},[e.cards,e.columns]),De=useMemo(()=>e.cards.map(A=>({id:A.id,name:A.title,startDate:A.startDate?new Date(A.startDate):void 0,endDate:A.endDate?new Date(A.endDate):void 0,progress:A.progress||0,status:A.columnId,priority:A.priority?.toLowerCase(),dependencies:Array.isArray(A.dependencies)?A.dependencies.map(X=>typeof X=="string"?X:X.taskId):[]})),[e.cards]),Se=useCallback(A=>{let{active:X}=A,q=e.cards.find(U=>U.id===X.id);q&&v({isDragging:true,draggedCardId:q.id,sourceColumnId:q.columnId,targetColumnId:q.columnId});},[e.cards,v]),O=useCallback(A=>{let{active:X,over:q}=A;if(!q||!e.cards.find(Me=>Me.id===X.id))return;let fe=null;q.data.current?.type==="column"?fe=q.id:q.data.current?.type==="card"&&(fe=e.cards.find(Oe=>Oe.id===q.id)?.columnId||null),fe&&fe!==x.targetColumnId&&v({...x,targetColumnId:fe});},[e.cards,x,v]),V=useCallback(async A=>{let{active:X,over:q}=A;if(v({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!q)return;let U=e.cards.find(he=>he.id===X.id);if(!U)return;let fe,Me;if(q.data.current?.type==="column"){fe=q.id;let he=ye.get(fe)||[];Me=ns(he,0);}else {let he=e.cards.find(et=>et.id===q.id);if(!he)return;fe=he.columnId;let Ye=ye.get(fe)||[],We=Ye.findIndex(et=>et.id===q.id);Me=ns(Ye,We);}let Oe=e.columns.find(he=>he.id===fe);if(Oe&&Oe.wipLimit&&Oe.wipLimitType==="hard"){let he=ye.get(fe)||[];if(U.columnId!==fe&&he.length>=Oe.wipLimit){t.onWipLimitExceeded?.(Oe,U);return}}(U.columnId!==fe||U.position!==Me)&&await t.onCardMove?.(U.id,fe,Me);},[e.cards,e.columns,ye,t,v]),$=useCallback(A=>{k(A),a?.(A),l?.(A.id);},[a,l]),G=useCallback(A=>{t.onCardUpdate?.(A.id,A),k(A);},[t]);return m?jsx("div",{className:f("asakaa-board",M,n),style:p,children:jsx(wu,{columnCount:3})}):i?jsx("div",{className:f("asakaa-board",M,n),style:p,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(Il,{themeName:w,children:[jsxs(DndContext,{sensors:te,collisionDetection:closestCorners,onDragStart:Se,onDragOver:O,onDragEnd:V,children:[jsxs("div",{className:f("asakaa-board",M,n),style:p,"data-theme":w,children:[e.columns.sort((A,X)=>A.position-X.position).map(A=>{let X=ye.get(A.id)||[],q=!Y.includes(A.id);return jsx(io,{column:A,cards:X,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:$,onCardUpdate:D,onColumnRename:I,onColumnDelete:R,isDeletable:q,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},A.id)}),u]}),jsx(DragOverlay,{children:x.draggedCardId?jsx(ur,{card:e.cards.find(A=>A.id===x.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),jsx(_r,{task:S,isOpen:!!S,onClose:()=>k(null),onCardUpdate:G,theme:B?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:d,onCreateTag:g,attachments:S?h?.get(S.id)||[]:[],onUploadAttachments:C,onDeleteAttachment:T,availableTasks:De,comments:c,onAddComment:b,currentUser:y})]})}function wu({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 Su={bgGrid:"#0F1117",bgSecondary:"#1A1D25",border:"rgba(255, 255, 255, 0.1)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"#E5E7EB",textSecondary:"#9CA3AF",textTertiary:"#6B7280",accent:"#3B82F6",accentLight:"rgba(59, 130, 246, 0.15)",hoverBg:"rgba(255, 255, 255, 0.05)"},Eu={bgGrid:"#FFFFFF",bgSecondary:"#F9FAFB",border:"rgba(0, 0, 0, 0.1)",borderLight:"rgba(0, 0, 0, 0.05)",textPrimary:"#111827",textSecondary:"#6B7280",textTertiary:"#9CA3AF",accent:"#3B82F6",accentLight:"rgba(59, 130, 246, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},Pu={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},Mu={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function Au({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=useState(false),p=useRef(null);useEffect(()=>{let i=u=>{p.current&&!p.current.contains(u.target)&&n(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let m=i=>{t(i),n(false);};return jsxs("div",{ref:p,className:"relative",children:[jsxs(motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:o||r.newTask}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((i,u)=>i.position-u.position).map((i,u)=>jsxs(motion.button,{onClick:()=>m(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom: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 Fu({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=useState(false),[p,m]=useState(null),i=useRef(null);if(useEffect(()=>{let h=C=>{i.current&&!i.current.contains(C.target)&&n(false);};return s&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]),!(a||r||o))return null;let d=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(h=>h.handler),g=async(h,C)=>{if(C){m(h);try{await C();}catch(T){console.error(`Export ${h} failed:`,T);}finally{m(null),n(false);}}};return jsxs("div",{ref:i,className:"relative",children:[jsxs(motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:t.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsx("div",{className:"py-1",children:d.map((h,C)=>jsxs(motion.button,{onClick:()=>g(h.id,h.handler),disabled:p!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:C<d.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:C*.03},children:[jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:p===h.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-4 h-4"})}):h.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:h.label}),jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:h.description})]})]},h.id))})})})]})}function Lu({onClick:e,label:t}){return jsxs(motion.button,{onClick:e,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:t})]})}function Cs({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:p,onExportExcel:m,translations:i}){let u=r==="dark"?Su:Eu,d={...o==="es"?Pu:Mu,...i},g=n||p||m;return jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:u.bgGrid,borderColor:u.border},children:jsxs("div",{className:"flex items-center gap-3",children:[g&&jsxs(Fragment,{children:[jsx(Fu,{theme:u,t:d,onExportCSV:n,onExportJSON:p,onExportExcel:m}),t&&jsx("div",{className:"w-px h-6",style:{backgroundColor:u.borderLight}})]}),t&&(s?jsx(Au,{columns:e,onSelect:t,theme:u,t:d,createTaskLabel:a}):jsx(Lu,{onClick:()=>t(),label:a||d.newTask}))]})})}function Ns({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=useState(false),[p,m]=useState(""),i=useCallback(()=>{let g=p.trim();g&&(e(g),m(""),n(false));},[p,e]),u=useCallback(g=>{g.key==="Enter"?(g.preventDefault(),i()):g.key==="Escape"&&(m(""),n(false));},[i]),d=useCallback(()=>{setTimeout(()=>{p.trim()||n(false);},150);},[p]);return s?jsx("div",{className:f("asakaa-add-column asakaa-add-column--editing",t),children:jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsx("input",{type:"text",value:p,onChange:g=>m(g.target.value),onKeyDown:u,onBlur:d,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxs("div",{className:"asakaa-add-column__actions",children:[jsx("button",{onClick:i,disabled:!p.trim(),className:"asakaa-add-column__submit",type:"button",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsx("button",{onClick:()=>{m(""),n(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsx("div",{className:f("asakaa-add-column",t),children:jsxs("button",{onClick:()=>n(true),disabled:o,className:"asakaa-add-column__button",type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),r]})})}function Ds({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:s,disabled:n=false,theme:p="dark",locale:m="es"}){let[i,u]=useState(false),[d,g]=useState(false),[h,C]=useState(""),[T,c]=useState([]),[b,y]=useState(""),[l,x]=useState(""),[v,S]=useState(""),[k,w]=useState(false),[B,M]=useState(false),[D,I]=useState(false),R=useRef(null),Y=useRef(null),te={placeholder:o||(m==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:s||(m==="es"?"Agregar Tarea":"Add Task"),save:m==="es"?"Guardar":"Save",addAssignee:m==="es"?"Agregar asignado":"Add assignee",addDates:m==="es"?"Agregar fechas":"Add dates",addPriority:m==="es"?"Agregar prioridad":"Add priority",startDate:m==="es"?"Inicio":"Start",endDate:m==="es"?"Fin":"End",low:m==="es"?"Baja":"Low",medium:m==="es"?"Media":"Medium",high:m==="es"?"Alta":"High",urgent:m==="es"?"Urgente":"Urgent"},ye=useCallback(()=>{C(""),c([]),y(""),x(""),S(""),w(false),M(false),I(false),u(false);},[]);useEffect(()=>{i&&R.current&&R.current.focus();},[i]),useEffect(()=>{if(!i)return;let $=G=>{Y.current&&!Y.current.contains(G.target)&&(h.trim()||ye());};return document.addEventListener("mousedown",$),()=>document.removeEventListener("mousedown",$)},[i,h,ye]);let De=useCallback(async()=>{let $=h.trim();if(!(!$||d)){g(true);try{await t({name:$,columnId:e,assigneeIds:T.length>0?T:void 0,startDate:b?new Date(b):void 0,endDate:l?new Date(l):void 0,priority:v||void 0}),C(""),c([]),y(""),x(""),S(""),w(!1),M(!1),I(!1),R.current?.focus();}catch(G){console.error("Error creating card:",G);}finally{g(false);}}},[h,e,T,b,l,v,t,d]),Se=useCallback($=>{$.key==="Enter"&&!$.shiftKey?($.preventDefault(),De()):$.key==="Escape"&&ye();},[De,ye]),O=useCallback($=>{c(G=>G.includes($)?G.filter(A=>A!==$):[...G,$]);},[]),V=p==="dark";return i?jsxs("div",{ref:Y,className:f("rounded-lg overflow-hidden shadow-lg",V?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxs("div",{className:"p-3",children:[jsx("input",{ref:R,type:"text",value:h,onChange:$=>C($.target.value),onKeyDown:Se,placeholder:te.placeholder,disabled:d,className:f("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",V?"text-gray-100 placeholder-gray-500":"text-gray-800 placeholder-gray-400")}),jsxs("div",{className:"flex items-center gap-1 mt-3",children:[a.length>0&&jsxs("button",{onClick:()=>w(!k),className:f("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",k||T.length>0?"bg-emerald-500/20 text-emerald-400":V?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:te.addAssignee,children:[jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),T.length>0&&jsx("span",{className:"ml-0.5",children:T.length})]}),jsx("button",{onClick:()=>M(!B),className:f("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",B||b||l?"bg-blue-500/20 text-blue-400":V?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:te.addDates,children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]})}),jsx("button",{onClick:()=>I(!D),className:f("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",D||v?v==="urgent"?"bg-red-500/20 text-red-400":v==="high"?"bg-orange-500/20 text-orange-400":v==="medium"?"bg-yellow-500/20 text-yellow-400":v==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":V?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:te.addPriority,children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"}),jsx("line",{x1:"4",y1:"22",x2:"4",y2:"15"})]})}),jsx("div",{className:"flex-1"}),jsx("button",{onClick:De,disabled:!h.trim()||d,className:f("px-3 py-1.5 rounded-md text-xs font-medium text-white transition-all","bg-emerald-500 hover:bg-emerald-600","disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-emerald-500"),type:"button",children:d?jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}):te.save})]})]}),k&&a.length>0&&jsx("div",{className:f("px-3 pb-3 pt-0","border-t",V?"border-[#3a3a4e]":"border-gray-200"),children:jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map($=>jsxs("button",{onClick:()=>O($.id),className:f("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",T.includes($.id)?"bg-emerald-500 text-white":V?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[$.avatar?jsx("img",{src:$.avatar,alt:$.name,className:"w-4 h-4 rounded-full"}):jsx("div",{className:f("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",T.includes($.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:$.name.charAt(0).toUpperCase()}),jsx("span",{children:$.name.split(" ")[0]})]},$.id))})}),B&&jsx("div",{className:f("px-3 pb-3 pt-0","border-t",V?"border-[#3a3a4e]":"border-gray-200"),children:jsxs("div",{className:"grid grid-cols-2 gap-2 pt-3",children:[jsxs("div",{children:[jsx("label",{className:f("block text-[10px] uppercase tracking-wide mb-1",V?"text-gray-500":"text-gray-400"),children:te.startDate}),jsx("input",{type:"date",value:b,onChange:$=>y($.target.value),className:f("w-full px-2 py-1.5 rounded text-xs border",V?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxs("div",{children:[jsx("label",{className:f("block text-[10px] uppercase tracking-wide mb-1",V?"text-gray-500":"text-gray-400"),children:te.endDate}),jsx("input",{type:"date",value:l,onChange:$=>x($.target.value),className:f("w-full px-2 py-1.5 rounded text-xs border",V?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),D&&jsx("div",{className:f("px-3 pb-3 pt-0","border-t",V?"border-[#3a3a4e]":"border-gray-200"),children:jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map($=>jsx("button",{onClick:()=>S(v===$?"":$),className:f("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",v===$?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[$]} text-white`:V?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:te[$]},$))})})]}):jsxs("button",{onClick:()=>u(true),disabled:n,className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",V?"hover:bg-[#2a2a3e]":"hover:bg-gray-100",n&&"opacity-50 cursor-not-allowed",r),type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),jsx("span",{className:"text-sm font-medium",children:te.buttonLabel})]})}var Mo=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(Er,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let o=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,o?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(o=>`"${o}"`).join(",")).join(`
5
- `)}async exportToPDF(){throw new Error("PDF export not yet implemented in ViewAdapter")}async exportToPNG(){if(!this.container)throw new Error("View not mounted");let r=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((o,s)=>{r.toBlob(n=>{n?o(n):s(new Error("Failed to create PNG blob"));},"image/png");})}};function yd(e={}){return new Mo(e)}var co=class extends Component{constructor(a){super(a);this.resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(a){return {hasError:true,error:a}}componentDidCatch(a,r){let{onError:o,componentName:s}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${s||"Component"}:`,a),console.error("Error Info:",r)),this.setState({errorInfo:r}),o)try{o(a,r);}catch(n){console.error("Error in error handler:",n);}}render(){let{hasError:a,error:r}=this.state,{children:o,fallback:s,componentName:n}=this.props;return a&&r?s?s(r,this.resetError):jsx("div",{className:"p-6 rounded-lg border",style:{background:"linear-gradient(135deg, #2d1b1b 0%, #1a1a1a 100%)",borderColor:"rgba(239, 68, 68, 0.3)"},children:jsxs("div",{className:"flex items-start gap-3",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"flex-shrink-0",children:[jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#EF4444",strokeWidth:"2"}),jsx("path",{d:"M12 8V12",stroke:"#EF4444",strokeWidth:"2",strokeLinecap:"round"}),jsx("circle",{cx:"12",cy:"16",r:"1",fill:"#EF4444"})]}),jsxs("div",{className:"flex-1",children:[jsx("h3",{className:"text-lg font-semibold text-red-400 mb-1",children:n?`Error in ${n}`:"Something went wrong"}),jsx("p",{className:"text-sm text-white/70 mb-3",children:r.message||"An unexpected error occurred"}),process.env.NODE_ENV==="development"&&jsxs("details",{className:"mb-3",children:[jsx("summary",{className:"text-xs text-white/50 cursor-pointer hover:text-white/70 mb-2",children:"Error Details (Development Only)"}),jsx("pre",{className:"text-xs text-white/60 bg-black/30 p-3 rounded overflow-auto max-h-48",children:r.stack})]}),jsx("button",{onClick:this.resetError,className:"px-4 py-2 rounded-lg text-sm font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#EF4444"},children:"Try Again"})]})]})}):o}};function Ss(e,t){let a=r=>jsx(co,{...t,children:jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function Ps({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:p,onOpenAIUsage:m,shortcut:i="k",className:u=""}){let[d,g]=useState(false),[h,C]=useState(""),[T,c]=useState("home"),[b,y]=useState(""),[l,x]=useState("");useEffect(()=>{let w=B=>{(B.metaKey||B.ctrlKey)&&B.key===i&&(B.preventDefault(),g(M=>!M)),B.key==="Escape"&&(g(false),c("home"),C(""));};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[i]),useEffect(()=>{d||(c("home"),C(""),y(""),x(""));},[d]);let v=useCallback(()=>{g(false);},[]),S=useCallback(w=>{let[B,M]=w.split(":");switch(B){case "create-card":c("create-card");break;case "create-card-in":y(M||"");break;case "navigate":M?(a?.(M),v()):c("navigate");break;case "search":r?.(h),v();break;case "priority":c("priority");break;case "set-priority":l&&M&&(o?.(l,M),v());break;case "assign":c("assign");break;case "assign-user":l&&M&&(s?.(l,M),v());break;case "ai":c("ai");break;case "ai-generate-plan":n?.(),v();break;case "ai-predict-risks":p?.(),v();break;case "ai-usage":m?.(),v();break;case "back":c("home");break;}},[h,l,t,a,r,o,s,n,p,m,v]),k=useCallback(()=>{b&&h.trim()&&(t?.(b,h.trim()),v());},[b,h,t,v]);return d?jsx(lt,{children:jsx("div",{className:"command-palette-overlay",onClick:v,children:jsx("div",{className:`command-palette ${u}`,onClick:w=>w.stopPropagation(),children:jsxs(Command,{value:h,onValueChange:C,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:T==="create-card"&&b?"Type card title and press Enter...":T==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:w=>{w.key==="Enter"&&T==="create-card"&&b&&k();}}),jsxs("div",{className:"command-palette-shortcut",children:[jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsx("kbd",{children:"K"})]})]}),jsxs(Command.List,{className:"command-palette-list",children:[jsx(Command.Empty,{className:"command-palette-empty",children:"No results found."}),T==="home"&&jsxs(Fragment,{children:[jsxs(Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxs(Command.Item,{value:"create-card",onSelect:S,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:S,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:S,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:S,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(w=>jsxs(Command.Item,{value:`navigate:${w.id}`,onSelect:S,className:"command-palette-item",children:[jsx("div",{className:"command-palette-item-dot",style:{background:w.priority==="URGENT"?"#EF4444":w.priority==="HIGH"?"#F59E0B":w.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsx("span",{children:w.title}),w.labels&&w.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:w.labels.slice(0,2).map(B=>jsx("span",{className:"command-palette-item-label",children:B},B))})]},w.id))})]}),T==="create-card"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:S,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(w=>jsxs(Command.Item,{value:`create-card-in:${w.id}`,onSelect:S,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:w.title}),jsxs("div",{className:"command-palette-item-count",children:[w.cardIds.length," cards"]})]},w.id))})]}),T==="navigate"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:S,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(w=>{let B=e.columns.find(M=>M.id===w.columnId);return jsxs(Command.Item,{value:`navigate:${w.id}`,onSelect:S,className:"command-palette-item",keywords:[w.title,w.description||"",...w.labels||[]],children:[jsx("div",{className:"command-palette-item-dot",style:{background:w.priority==="URGENT"?"#EF4444":w.priority==="HIGH"?"#F59E0B":w.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxs("div",{className:"command-palette-item-content",children:[jsx("div",{children:w.title}),jsx("div",{className:"command-palette-item-meta",children:B?.title})]}),w.labels&&w.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:w.labels.slice(0,2).map(M=>jsx("span",{className:"command-palette-item-label",children:M},M))})]},w.id)})})]}),T==="ai"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:S,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:S,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:S,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:S,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 kd(e,t,a,r,o){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let n=document.createElement("div");n.id="attachment-lightbox-native",n.className="attachment-lightbox",n.style.cssText=`
4
+ `);if(t.length<1||!t[0])return {success:!1,errors:["CSV file is empty or invalid"]};let a=Pl(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let p=Pl(t[n]||"");if(p.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-p.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${p.length})`);continue}for(;p.length<a.length;)p.push("");let i={};a.forEach((h,C)=>{i[h]=p[C]||"";});let u=i.Column||"Unnamed";o.has(u)||o.set(u,{id:`col-${o.size+1}`,title:u,position:o.size+1,cardIds:[]});let d=o.get(u),g={id:i["Card ID"]||`card-${n}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:d.id,position:d.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};r.push(g),d.cardIds.push(g.id);}catch(p){s.push(`Line ${n+1}: ${p instanceof Error?p.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function Pl(e){let t=[],a="",r=false;for(let o=0;o<e.length;o++){let s=e[o],n=e[o+1];s==='"'&&r&&n==='"'?(a+='"',o++):s==='"'?r=!r:s===","&&!r?(t.push(a),a=""):a+=s;}return t.push(a),t}function Ml(e,t){switch(t){case "json":return up(e);case "csv":return gp(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function Al(e){return new Promise((t,a)=>{let r=new FileReader;r.onload=o=>{o.target?.result?t(o.target.result):a(new Error("Failed to read file"));},r.onerror=()=>a(new Error("Failed to read file")),r.readAsText(e);})}var ds=createContext(null);function Fl(){return useContext(ds)}var Ll=createContext(null);function Il({children:e,themeName:t}){return jsx(Ll.Provider,{value:{themeName:t},children:e})}function oo(){return useContext(Ll)}function lt({children:e,container:t}){let[a,r]=useState(false),o=Fl(),s=oo();if(useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let n=t||(typeof document<"u"?document.body:null);if(!n)return null;if(o){let{theme:p,themeName:m}=o,i={"--asakaa-color-background-primary":p.bgPrimary,"--asakaa-color-background-secondary":p.bgSecondary,"--asakaa-color-background-card":p.bgGrid,"--asakaa-color-background-hover":p.hoverBg,"--asakaa-color-text-primary":p.textPrimary,"--asakaa-color-text-secondary":p.textSecondary,"--asakaa-color-text-tertiary":p.textTertiary,"--asakaa-color-text-inverse":p.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":p.border,"--asakaa-color-border-hover":p.borderLight,"--asakaa-color-border-subtle":p.borderLight,"--asakaa-color-interactive-primary":p.accent,"--asakaa-color-interactive-primaryHover":p.accentHover,"--asakaa-color-interactive-primaryBorder":`${p.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${p.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${p.accent}33`,"--asakaa-color-status-success":p.statusCompleted,"--asakaa-color-status-warning":p.milestone,"--asakaa-color-status-error":p.criticalPath,"--asakaa-color-danger":p.criticalPath,"--asakaa-color-danger-border":`${p.criticalPath}4D`,"--asakaa-color-danger-background":`${p.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${p.criticalPath}26`};return createPortal(jsx("div",{"data-theme":m,"data-gantt-portal":"true",style:i,children:e}),n)}return s?createPortal(jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),n):createPortal(e,n)}var zl={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},wp="#BDC3C7",Cp=({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 zr({priority:e,onChange:t,className:a}){let[r,o]=useState(false),[s,n]=useState({top:0,left:0}),p=useRef(null),m=useRef(null),i=()=>{if(!m.current)return;let h=m.current.getBoundingClientRect(),C=window.innerHeight,T=window.innerWidth,c=160,b=220,y=4,l=h.right-c;l<10&&(l=h.left),l+c>T-10&&(l=T-c-10);let x=C-h.bottom,v=h.top,S;x>=b+y?S=h.bottom+y:v>=b+y?S=h.top-b-y:S=x>=v?h.bottom+y:Math.max(10,h.top-b-y),n({top:S,left:l}),o(true);};useEffect(()=>{let h=C=>{p.current&&!p.current.contains(C.target)&&!m.current?.contains(C.target)&&o(false);};if(r)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[r]),useEffect(()=>{let h=C=>{C.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[r]);let u=h=>{t(h),o(false);},d=e?zl[e]:null,g=d?.color||wp;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:m,onClick:()=>r?o(false):i(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${g}10`:"transparent",boxShadow:e?`0 0 0 2px ${g}30 inset`:"none"},title:d?.label||"Set priority",children:jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:g,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:g,fillOpacity:e?"0.6":"0.4"})})}),r&&jsx(lt,{children:jsxs("div",{ref:p,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(zl).map(([h,C])=>jsxs("button",{onClick:()=>u(h),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:C.color,background:"transparent"},onMouseEnter:T=>{T.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:T=>{T.currentTarget.style.background="transparent";},children:[jsx(Cp,{color:C.color}),jsx("span",{className:"font-semibold text-sm",children:C.label}),e===h&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},h)),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:h=>{h.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:h=>{h.currentTarget.style.background="transparent";},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"#9CA3AF",strokeWidth:"1.5",strokeDasharray:"2 2",opacity:"0.6"})}),jsx("span",{className:"font-semibold text-sm",children:"Clear"}),!e&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var Tp=[{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 To({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=useState(false),[n,p]=useState({top:0,left:0}),m=useRef(null),i=useRef(null),g=(oo()?.themeName||"dark")==="dark",h=()=>{if(!i.current)return;let l=i.current.getBoundingClientRect(),x=window.innerHeight,v=window.innerWidth,S=320,k=380,w=4,R=l.left;R+S>v-10&&(R=v-S-10),R<10&&(R=10);let M=x-l.bottom,D=l.top,I;M>=k+w?I=l.bottom+w:D>=k+w?I=l.top-k-w:I=M>=D?l.bottom+w:Math.max(10,l.top-k-w),p({top:I,left:R}),s(true);};useEffect(()=>{let l=x=>{m.current&&!m.current.contains(x.target)&&!i.current?.contains(x.target)&&s(false);};if(o)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[o]),useEffect(()=>{let l=x=>{x.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[o]);let C=l=>{let x=new Date,v=R=>{let M=R.getFullYear(),D=String(R.getMonth()+1).padStart(2,"0"),I=String(R.getDate()).padStart(2,"0");return `${M}-${D}-${I}`},S=v(x),k=new Date(x);k.setDate(k.getDate()+l);let w=v(k);a(S,w),s(false);},T=()=>{if(!e||!t)return "Set date";let l=k=>{if(k instanceof Date)return k;if(typeof k!="string"||!k.match(/^\d{4}-\d{2}-\d{2}$/))return null;let w=k.split("-").map(Number);if(w.length!==3||w.some(I=>isNaN(I)))return null;let R=w[0],M=w[1],D=w[2];return R===void 0||M===void 0||D===void 0?null:new Date(R,M-1,D)},x=l(e),v=l(t);if(!x||!v||isNaN(x.getTime())||isNaN(v.getTime()))return "Set date";let S=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${S[x.getMonth()]} ${x.getDate()} \u2013 ${S[v.getMonth()]} ${v.getDate()}`},c=e&&t,y=(()=>{if(!t)return false;let l=typeof t=="string"?new Date(t):t,x=new Date;return x.setHours(0,0,0,0),l<x})();return jsxs("div",{className:`relative ${r||""}`,children:[jsxs("button",{ref:i,onClick:()=>o?s(false):h(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${y?"asakaa-date-overdue":"asakaa-date"}`,title:c?`${T()}`:"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:T()})]}),o&&jsx(lt,{children:jsxs("div",{ref:m,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,background:g?"#1A1D25":"#FFFFFF",border:`1px solid ${g?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:g?"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:g?"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:g?"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:Tp.map(l=>jsx("button",{onClick:()=>C(l.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:g?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${g?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:g?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:x=>{x.currentTarget.style.backgroundColor=g?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",x.currentTarget.style.border=`1px solid ${g?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:x=>{x.currentTarget.style.backgroundColor=g?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",x.currentTarget.style.border=`1px solid ${g?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:l.label},l.label))})]}),jsxs("div",{className:"p-4",children:[jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:g?"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:l=>a(l.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:g?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:g?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:g?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:g?"dark":"light"}}),jsx("input",{type:"date",value:t||"",onChange:l=>a(e,l.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:g?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:g?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:g?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:g?"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:l=>{l.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:l=>{l.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function Hr({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=useState(false),[p,m]=useState(""),[i,u]=useState({top:0,left:0}),d=useRef(null),g=useRef(null),h=()=>{if(!g.current)return;let y=g.current.getBoundingClientRect(),l=window.innerHeight,x=window.innerWidth,v=300,S=380,k=4,w=y.right-v;w<10&&(w=y.left),w+v>x-10&&(w=x-v-10);let R=l-y.bottom,M=y.top,D;R>=S+k?D=y.bottom+k:M>=S+k?D=y.top-S-k:D=R>=M?y.bottom+k:Math.max(10,y.top-S-k),u({top:D,left:w}),n(true);};useEffect(()=>{let y=l=>{d.current&&!d.current.contains(l.target)&&!g.current?.contains(l.target)&&(n(false),m(""));};if(s)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[s]),useEffect(()=>{let y=l=>{l.key==="Escape"&&(n(false),m(""));};if(s)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[s]);let C=y=>{let l=e.some(x=>x.id===y.id);a(l?e.filter(x=>x.id!==y.id):[...e,y]);},T=t.filter(y=>y.name.toLowerCase().includes(p.toLowerCase())),c=e.slice(0,o),b=e.length-o;return jsxs("div",{className:`relative ${r||""}`,children:[jsx("button",{ref:g,onClick:()=>s?n(false):h(),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:[c.map(y=>jsx("div",{className:"asakaa-avatar",title:y.name,children:y.avatar?jsx("img",{src:y.avatar,alt:y.name,className:"asakaa-avatar-img"}):y.initials},y.id)),b>0&&jsxs("div",{className:"asakaa-avatar",children:["+",b]})]}):jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center transition-all",style:{background:"rgba(96, 165, 250, 0.15)",border:"1.5px solid rgba(96, 165, 250, 0.4)",color:"#60a5fa"},children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M8 8a3 3 0 100-6 3 3 0 000 6zM4 14c0-2.21 1.79-4 4-4s4 1.79 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),s&&jsx(lt,{children:jsxs("div",{ref:d,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("input",{type:"text",value:p,onChange:y=>m(y.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:T.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"}):T.map(y=>{let l=e.some(x=>x.id===y.id);return jsxs("button",{onClick:()=>C(y),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:x=>{x.currentTarget.style.background="transparent";},children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor:y.color,color:"#fff"},children:y.avatar?jsx("img",{src:y.avatar,alt:y.name,className:"w-full h-full rounded-full object-cover"}):y.initials}),jsx("span",{className:"font-semibold flex-1 text-left truncate",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:y.name}),jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:l?"#3b82f6":"transparent"},children:l?"\u2713":""})]},y.id)})}),e.length>0&&jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsx("button",{onClick:()=>{a([]),n(false);},className:"w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all hover:bg-red-600/30 active:scale-95 border",style:{color:"#f87171",borderColor:"rgba(248, 113, 113, 0.3)",background:"rgba(248, 113, 113, 0.08)"},children:"Clear All"})})]})})]})}function on(e,t,a){let r=new Map;e.forEach(m=>{if(m.dependencies&&Array.isArray(m.dependencies)){let i=m.dependencies.map(u=>{if(typeof u=="string")return u;let d=u;return d.taskId||d.targetId||""}).filter(Boolean);r.set(m.id,i);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,p=m=>{if(!s.has(m)){s.add(m),n.add(m);let i=r.get(m)||[];for(let u of i){if(!s.has(u)&&p(u))return true;if(n.has(u))return true}}return n.delete(m),false};return p(a)}function Do({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[p,m]=useState(false),[i,u]=useState(""),[d,g]=useState(t.length>0),[h,C]=useState({top:0,left:0}),[T,c]=useState(null),b=useRef(null),y=useRef(null),l=()=>{if(!y.current)return;let w=y.current.getBoundingClientRect(),R=window.innerHeight,M=window.innerWidth,D=300,I=d?380:120,B=4,K=w.right-D;K<10&&(K=w.left),K+D>M-10&&(K=M-D-10);let te=R-w.bottom,ie=w.top,de;te>=I+B?de=w.bottom+B:ie>=I+B?de=w.top-I-B:de=te>=ie?w.bottom+B:Math.max(10,w.top-I-B),C({top:de,left:K}),m(true);};useEffect(()=>{if(!p||!y.current)return;let w=y.current.getBoundingClientRect(),R=window.innerHeight,M=window.innerWidth,D=300,I=d?380:120,B=4,K=w.right-D;K<10&&(K=w.left),K+D>M-10&&(K=M-D-10);let te=R-w.bottom,ie=w.top,de;te>=I+B?de=w.bottom+B:ie>=I+B?de=w.top-I-B:de=te>=ie?w.bottom+B:Math.max(10,w.top-I-B),C({top:de,left:K});},[d,p]),useEffect(()=>{let w=R=>{b.current&&!b.current.contains(R.target)&&!y.current?.contains(R.target)&&(m(false),u(""));};if(p)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[p]),useEffect(()=>{let w=R=>{R.key==="Escape"&&(m(false),u(""));};if(p)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[p]);let x=w=>{let R=t.includes(w),M=a.find(D=>D.id===w);if(c(null),R){let D=t.filter(I=>I!==w);r(D),D.length===0&&g(false);}else {if(s&&on(a,w,e)){let I=`Cannot add "${M?.title||w}" as dependency - would create circular reference`;c(I),n?.(w,M?.title||w),setTimeout(()=>c(null),3e3);return}r([...t,w]),g(true);}},v=()=>{let w=!d;g(w),w||r([]);},S=a.filter(w=>w.id!==e).filter(w=>w.title.toLowerCase().includes(i.toLowerCase())||w.id.toLowerCase().includes(i.toLowerCase())),k=t.length>0?"#3B82F6":"#BDC3C7";return jsxs("div",{className:`relative ${o||""}`,children:[jsxs("button",{ref:y,onClick:()=>p?m(false):l(),className:"flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5",title:t.length>0?`${t.length} dependencies`:"Add dependencies",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M7 9L9 7M11.5 3.5L10 2C8.89543 0.89543 7.10457 0.89543 6 2C4.89543 3.10457 4.89543 4.89543 6 6L7.5 7.5M4.5 12.5L6 14C7.10457 15.1046 8.89543 15.1046 10 14C11.1046 12.8954 11.1046 11.1046 10 10L8.5 8.5",stroke:k,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsx("span",{className:"text-xs font-medium",style:{color:k},children:t.length})]}),p&&jsx(lt,{children:jsxs("div",{ref:b,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${h.top}px`,left:`${h.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:[T&&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:T})]}),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:v,children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:d?"#3b82f6":"transparent",borderColor:d?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:d&&jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),d&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsx("input",{type:"text",value:i,onChange:w=>u(w.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:S.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"}):S.map(w=>{let R=t.includes(w.id);return jsxs("button",{onClick:()=>x(w.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:M=>{M.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:M=>{M.currentTarget.style.background="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0 mt-0.5 transition-all",style:{background:R?"#3b82f6":"transparent",borderColor:R?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:R&&jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxs("div",{className:"flex-1 text-left",children:[jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:w.title}),jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:w.id})]})]},w.id)})})]}),t.length>0&&jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsx("button",{onClick:()=>{r([]),g(false),m(false);},className:"w-full px-3 py-2 rounded-md text-xs font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#E74C3C"},children:"Clear All Dependencies"})})]})})]})}var ur=memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:p=[],allCards:m=[]})=>{let{attributes:i,listeners:u,setNodeRef:d,transform:g,transition:h,isDragging:C}=useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),T={transform:en.Transform.toString(g),transition:h};if(t)return jsx("div",{ref:d,style:T,...i,...u,onClick:()=>a?.(e),children:t(e)});let c=p.filter(x=>e.assignedUserIds?.includes(x.id)),b=e.progress===100,y=(e.attachments||[]).filter(x=>x.type.startsWith("image/")),l={...T,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxs("div",{ref:d,style:l,className:f("asakaa-card",C&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...u,onClick:x=>{x.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||a?.(e);},children:[e.coverImage&&jsx("div",{className:"asakaa-card-cover mb-3",children:jsx("img",{src:e.coverImage,alt:`Cover for ${e.title}`,className:"w-full h-32 object-cover rounded-md",loading:"lazy",onError:x=>{x.currentTarget.style.display="none";}})}),y.length>0&&!e.coverImage&&jsx("div",{className:"asakaa-card-attachments mb-3",children:y.length===1&&y[0]?jsx("img",{src:y[0].url,alt:y[0].name,className:"w-full h-32 object-cover rounded-md",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:x=>{x.currentTarget.style.display="none";}}):jsx("div",{className:"grid grid-cols-2 gap-1",children:y.slice(0,4).map((x,v)=>jsxs("div",{className:"relative",children:[jsx("img",{src:x.url,alt:x.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:S=>{S.currentTarget.style.display="none";}}),v===3&&y.length>4&&jsx("div",{className:"absolute inset-0 bg-black/60 rounded flex items-center justify-center",children:jsxs("span",{className:"text-white text-sm font-medium",children:["+",y.length-4]})})]},x.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:x=>x.stopPropagation(),className:"priority-selector",children:jsx(zr,{priority:e.priority,onChange:x=>n?.(e.id,{priority:x})})}),jsx("div",{onClick:x=>x.stopPropagation(),className:"date-picker",children:jsx(To,{startDate:e.startDate?typeof e.startDate=="string"?e.startDate:e.startDate.toISOString().split("T")[0]:void 0,endDate:e.endDate?typeof e.endDate=="string"?e.endDate:e.endDate.toISOString().split("T")[0]:void 0,onChange:(x,v)=>n?.(e.id,{startDate:x,endDate:v})})}),p.length>0&&jsx("div",{onClick:x=>x.stopPropagation(),className:"user-selector",children:jsx(Hr,{assignedUsers:c,availableUsers:p,onChange:x=>n?.(e.id,{assignedUserIds:x.map(v=>v.id)})})}),jsx("div",{onClick:x=>x.stopPropagation(),className:"dependencies-selector",children:jsx(Do,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(x=>typeof x=="string"?x:x.taskId):[],availableTasks:m,onChange:x=>n?.(e.id,{dependencies:x})})})]}),e.labels&&e.labels.length>0&&jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(x=>jsx("span",{className:"asakaa-label",children:x},x))}),typeof e.progress=="number"&&jsxs("div",{className:"mt-3 pt-2 border-t border-white/5",children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:"text-[10px] text-[#6B7280]",children:"Progreso"}),jsxs("span",{className:"text-[10px] font-medium",style:{color:"#3B82F6"},children:[Math.round(e.progress),"%"]})]}),jsx("div",{className:"h-1.5 rounded-full bg-white/5 overflow-hidden",children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(100,Math.max(0,e.progress))}%`,backgroundColor:"#3B82F6"}})})]})]})},(e,t)=>e.card.id===t.card.id&&e.card.title===t.card.title&&e.card.description===t.card.description&&e.card.position===t.card.position&&e.card.columnId===t.card.columnId&&e.card.priority===t.card.priority&&e.card.color===t.card.color&&e.card.progress===t.card.progress&&e.card.startDate===t.card.startDate&&e.card.endDate===t.card.endDate&&e.isSelected===t.isSelected&&JSON.stringify(e.card.labels)===JSON.stringify(t.card.labels)&&JSON.stringify(e.card.assignedUserIds)===JSON.stringify(t.card.assignedUserIds)&&JSON.stringify(e.card.dependencies)===JSON.stringify(t.card.dependencies)&&JSON.stringify(e.card.attachments?.map(a=>a.id))===JSON.stringify(t.card.attachments?.map(a=>a.id)));ur.displayName="Card";var nn={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"}},ql=({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 Xl({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=useState(false),[n,p]=useState({top:0,left:0}),m=useRef(null),i=useRef(null),u=[...Object.entries(nn).map(([c,b])=>({id:c,label:b.label,color:b.color,icon:b.icon})),...r.filter(c=>!Object.keys(nn).includes(c.id)).map(c=>({id:c.id,label:c.title,color:c.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let c=nn[e];if(c)return {...c,id:e};let b=r.find(y=>y.id===e);return b?{id:b.id,label:b.title,color:b.color||"#8B5CF6",icon:"circle-dot"}:{...nn.todo,id:"todo"}},g=()=>{if(!i.current)return;let c=i.current.getBoundingClientRect(),b=window.innerHeight,y=window.innerWidth,l=180,x=280,v=4,S=c.right-l;S<10&&(S=c.left),S+l>y-10&&(S=y-l-10);let k=b-c.bottom,w=c.top,R;k>=x+v?R=c.bottom+v:w>=x+v?R=c.top-x-v:R=k>=w?c.bottom+v:Math.max(10,c.top-x-v),p({top:R,left:S}),s(true);};useEffect(()=>{let c=b=>{m.current&&!m.current.contains(b.target)&&!i.current?.contains(b.target)&&s(false);};if(o)return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[o]),useEffect(()=>{let c=b=>{b.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[o]);let h=c=>{t(c),s(false);},C=d(),T=C.color;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:i,onClick:()=>o?s(false):g(),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:`${T}10`,boxShadow:`0 0 0 2px ${T}30 inset`},title:C.label,children:jsx(ql,{icon:C.icon,color:T})}),o&&jsx(lt,{children:jsxs("div",{ref:m,className:"status-selector-menu",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsx("div",{className:"py-1",children:u.map(c=>jsxs("button",{onClick:()=>h(c.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:c.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(ql,{icon:c.icon,color:c.color}),jsx("span",{className:"font-semibold",children:c.label}),e===c.id&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},c.id))})]})})]})}function Jl({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[s,n]=useState(false),[p,m]=useState(false),[i,u]=useState(e),[d,g]=useState({top:0,left:0}),h=useRef(null),C=useRef(null),T=useRef(null);useEffect(()=>{if(s&&C.current){let l=C.current.getBoundingClientRect();g({top:l.bottom+window.scrollY+8,left:l.left+window.scrollX});}},[s]),useEffect(()=>{let l=x=>{h.current&&!h.current.contains(x.target)&&!C.current?.contains(x.target)&&(n(false),m(false));};if(s)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[s]),useEffect(()=>{let l=x=>{x.key==="Escape"&&(n(false),m(false),u(e));};if(s)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[s,e]),useEffect(()=>{p&&T.current&&(T.current.focus(),T.current.select());},[p]);let c=()=>{m(true),u(e);},b=()=>{let l=i.trim();l&&l!==e&&t(l),m(false),n(false),u(e);},y=l=>{l.key==="Enter"?b():l.key==="Escape"&&(m(false),u(e));};return jsxs("div",{className:`relative ${o||""}`,children:[jsx("button",{ref:C,onClick:()=>n(!s),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:"Column options","aria-label":"Column menu",children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),s&&jsx(lt,{children:jsx("div",{ref:h,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${d.top}px`,left:`${d.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:p?jsxs("div",{className:"p-3",children:[jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:"Rename Column"}),jsx("input",{ref:T,type:"text",value:i,onChange:l=>u(l.target.value),onKeyDown:y,onBlur:b,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:"Column name",maxLength:50})]}):jsxs("div",{className:"py-1",children:[jsxs("button",{onClick:c,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-white/90 hover:bg-white/10 transition-all",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-medium",children:"Rename"})]}),r&&a&&jsxs(Fragment,{children:[jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxs("button",{onClick:()=>{a(),n(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-red-400 hover:bg-red-500/10 transition-all",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M2 4H14M5 4V2.5C5 2.22386 5.22386 2 5.5 2H10.5C10.7761 2 11 2.22386 11 2.5V4M12.5 4V13.5C12.5 13.7761 12.2761 14 12 14H4C3.72386 14 3.5 13.7761 3.5 13.5V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M6.5 7V11M9.5 7V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),jsx("span",{className:"font-medium",children:"Delete"})]})]})]})})})]})}var io=memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:p,availableUsers:m,allCards:i,enableVirtualization:u,cardHeight:d=120,isCollapsed:g,onToggleCollapse:h,onColumnRename:C,onColumnDelete:T,isDeletable:c=false,className:b})=>{let{setNodeRef:y,isOver:l}=useDroppable({id:e.id,data:{type:"column",column:e}}),x=useRef(null),v=u??Cl(t.length),S=useVirtualizer({count:t.length,getScrollElement:()=>x.current,estimateSize:()=>d,enabled:v});if(a)return jsx("div",{ref:y,className:b,children:a(e,t)});let w=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let D=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:D}:D>=80?{state:"warning",percentage:D}:D>=60?{state:"approaching",percentage:D}:{state:"ok",percentage:D}})(),R=w.state==="exceeded",M=()=>"asakaa-column-count";return jsxs("div",{ref:y,className:f("asakaa-column",l&&"ring-2 ring-asakaa-accent-blue",R&&"ring-2 ring-asakaa-accent-red",b),children:[o?o(e,t.length):jsxs("div",{className:"asakaa-column-header group",children:[jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:f(M()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&w.state!=="none"&&jsxs("span",{className:"text-xs font-medium flex items-center",title:`${w.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[w.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"})]}),w.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"})]}),w.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"})}),w.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"})]})]}),(C||T)&&jsx(Jl,{columnTitle:e.title,onRename:D=>C?.(e.id,D),onDelete:T?()=>T(e.id):void 0,isDeletable:c}),h&&jsx("button",{onClick:h,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":g?"Expand column":"Collapse column",children:g?"\u25B6":"\u25BC"})]})]}),!g&&jsx("div",{ref:x,className:"asakaa-column-cards",style:{maxHeight:v?"600px":void 0},children:jsx(SortableContext,{items:t.map(D=>D.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"})}):v?jsx("div",{style:{height:`${S.getTotalSize()}px`,position:"relative"},children:S.getVirtualItems().map(D=>{let I=t[D.index];return I?jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${D.start}px)`},children:jsx(ur,{card:I,render:r,onClick:n,onUpdate:p,availableUsers:m,allCards:i})},I.id):null})}):t.map(D=>jsx(ur,{card:D,render:r,onClick:n,onUpdate:p,availableUsers:m,allCards:i},D.id))})})]})});io.displayName="Column";function gs({title:e,onSave:t,className:a}){let[r,o]=useState(false),[s,n]=useState(e),p=useRef(null);useEffect(()=>{r&&p.current&&(p.current.focus(),p.current.select());},[r]);let m=()=>{let u=s.trim();u&&u!==e?t(u):n(e),o(false);},i=u=>{u.key==="Enter"?m():u.key==="Escape"&&(n(e),o(false));};return r?jsx("input",{ref:p,type:"text",value:s,onChange:u=>n(u.target.value),onBlur:m,onKeyDown:i,className:f("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsx("h2",{className:f("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}var cn=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function nr({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[p,m]=useState(false),[i,u]=useState(""),[d,g]=useState(false),[h,C]=useState(cn[10]||"#3B82F6"),[T,c]=useState({top:0,left:0}),b=useRef(null),y=useRef(null),l=useRef(null),x=useRef(null),v=t.filter(D=>D.name.toLowerCase().includes(i.toLowerCase())),S=t.some(D=>D.name.toLowerCase()===i.toLowerCase());useEffect(()=>{if(p&&y.current){let D=y.current.getBoundingClientRect();c({top:D.bottom+6,left:D.left});}},[p]),useEffect(()=>{let D=I=>{let B=I.target,K=b.current?.contains(B),te=l.current?.contains(B);!K&&!te&&(m(false),u(""),g(false));};if(p)return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[p]),useEffect(()=>{p&&x.current&&x.current.focus();},[p]);let k=D=>{let I=e.some(B=>B.id===D.id);a(I?e.filter(B=>B.id!==D.id):[...e,D]);},w=async()=>{if(!(!r||!i.trim())){g(true);try{let D=await r(i.trim(),h);D&&(a([...e,D]),u(""),C(cn[Math.floor(Math.random()*cn.length)]||"#3B82F6"));}finally{g(false);}}},R=(D,I)=>{I.stopPropagation(),a(e.filter(B=>B.id!==D));},M={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxs("div",{ref:b,className:"relative",children:[jsxs("button",{ref:y,type:"button",onClick:()=>!s&&m(!p),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:M,disabled:s,children:[jsx(Tag,{className:"w-3.5 h-3.5"}),e.length>0?jsxs("div",{className:"flex items-center gap-1",children:[e.slice(0,2).map(D=>jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${D.color}20`,color:D.color},children:D.name},D.id)),e.length>2&&jsxs("span",{className:"text-xs",style:{color:o.textTertiary},children:["+",e.length-2]})]}):jsx("span",{children:"Agregar"}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:o.textTertiary}})]}),typeof document<"u"&&createPortal(jsx(AnimatePresence,{children:p&&jsxs(motion.div,{ref:l,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:T.top,left:T.left,zIndex:99999,backgroundColor:o.bgPrimary,border:`1px solid ${o.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsx("div",{className:"p-2 border-b",style:{borderColor:o.border},children:jsx("input",{ref:x,type:"text",value:i,onChange:D=>u(D.target.value),placeholder:"Buscar o crear etiqueta...",className:"w-full px-3 py-1.5 text-sm rounded-md outline-none",style:{backgroundColor:o.bgSecondary,color:o.textPrimary,border:`1px solid ${o.borderLight}`},onKeyDown:D=>{D.key==="Enter"&&i.trim()&&!S&&r&&w();}})}),e.length>0&&jsxs("div",{className:"p-2 border-b",style:{borderColor:o.border},children:[jsx("p",{className:"text-xs mb-1.5",style:{color:o.textTertiary},children:"Seleccionadas"}),jsx("div",{className:"flex flex-wrap gap-1",children:e.map(D=>jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium cursor-pointer hover:opacity-80",style:{backgroundColor:`${D.color}20`,color:D.color},onClick:I=>R(D.id,I),children:[D.name,jsx(X,{className:"w-3 h-3"})]},D.id))})]}),jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:v.length>0?v.map(D=>{let I=e.some(B=>B.id===D.id);return jsxs("button",{type:"button",onClick:()=>k(D),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:I?`${D.color}15`:"transparent",color:o.textPrimary},onMouseEnter:B=>{I||(B.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:B=>{I||(B.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:D.color}}),jsx("span",{className:"flex-1 text-left",children:D.name}),I&&jsx(Check,{className:"w-4 h-4",style:{color:D.color}})]},D.id)}):i.trim()?jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No se encontraron etiquetas"}):jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No hay etiquetas disponibles"})}),i.trim()&&!S&&r&&jsxs("div",{className:"p-2 border-t",style:{borderColor:o.border},children:[jsx("div",{className:"flex items-center gap-2 mb-2",children:jsx("p",{className:"text-xs",style:{color:o.textTertiary},children:"Crear nueva etiqueta"})}),jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:cn.map(D=>jsx("button",{type:"button",onClick:()=>C(D),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:D,outline:h===D?`2px solid ${D}`:"none",outlineOffset:"2px"}},D))}),jsxs("button",{type:"button",onClick:w,disabled:d,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:h,color:"#FFFFFF",opacity:d?.7:1},children:[d?jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsx(Plus,{className:"w-4 h-4"}),'Crear "',i.trim(),'"']})]})]})}),document.body)]})}function hs({tag:e,onRemove:t,size:a="sm"}){return jsxs("span",{className:`inline-flex items-center gap-1 rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:`${e.color}20`,color:e.color},children:[e.name,t&&jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),t();},className:"hover:opacity-70",children:jsx(X,{className:"w-3 h-3"})})]})}function td({tags:e,maxVisible:t=3,size:a="sm"}){if(!e||e.length===0)return null;let r=e.slice(0,t),o=e.length-t;return jsxs("div",{className:"flex flex-wrap gap-1",children:[r.map(s=>jsx(hs,{tag:s,size:a},s.id)),o>0&&jsxs("span",{className:`inline-flex items-center rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:"rgba(100,100,100,0.2)",color:"#9CA3AF"},children:["+",o]})]})}var sr=[{name:"Azul",value:"#6366F1",light:"#818CF8"},{name:"P\xFArpura",value:"#A855F7",light:"#C084FC"},{name:"Rosa",value:"#EC4899",light:"#F472B6"},{name:"Rojo",value:"#EF4444",light:"#F87171"},{name:"Naranja",value:"#F59E0B",light:"#FBBF24"},{name:"Amarillo",value:"#EAB308",light:"#FACC15"},{name:"Lima",value:"#84CC16",light:"#A3E635"},{name:"Verde",value:"#10B981",light:"#34D399"},{name:"Esmeralda",value:"#059669",light:"#10B981"},{name:"Cyan",value:"#06B6D4",light:"#22D3EE"},{name:"Azul Cielo",value:"#0EA5E9",light:"#38BDF8"},{name:"\xCDndigo",value:"#4F46E5",light:"#6366F1"},{name:"Violeta",value:"#8B5CF6",light:"#A78BFA"},{name:"Fucsia",value:"#D946EF",light:"#E879F9"},{name:"Coral",value:"#F97316",light:"#FB923C"},{name:"Magenta",value:"#E11D48",light:"#FB7185"}];function sd(e,t=[]){if("title"in e&&!("name"in e)){let a=e,r=(a.assignedUserIds||[]).map(o=>{let s=t.find(n=>n.id===o);return s||null}).filter(o=>o!==null);return {id:a.id,name:a.title,startDate:a.startDate?new Date(a.startDate):void 0,endDate:a.endDate?new Date(a.endDate):void 0,progress:a.progress||0,status:a.columnId,priority:a.priority?.toLowerCase(),assignees:r,dependencies:Array.isArray(a.dependencies)?a.dependencies.map(o=>typeof o=="string"?o:o.taskId):[],tags:a.tags,subtasks:a.subtasks?.map(o=>({id:o.id,name:o.title,progress:o.completed?100:0,startDate:new Date,endDate:new Date})),color:a.color,description:a.description}}return e}function cu(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}}function _r({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:p=[],availableTags:m=[],onCreateTag:i,attachments:u=[],onUploadAttachments:d,onDeleteAttachment:g,availableTasks:h=[],comments:C=[],onAddComment:T,currentUser:c}){let b=s==="dark",y={textTertiary:b?"#6B7280":"#9CA3AF",textSecondary:b?"#9CA3AF":"#6B7280",textPrimary:b?"#FFFFFF":"#111827",borderLight:b?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:b?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:b?"#1A1D25":"#FFFFFF",bgSecondary:b?"#0F1117":"#F9FAFB",hoverBg:b?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},l=e&&"title"in e&&!("name"in e),x=e,[v,S]=useState(e?sd(e,p):null),[k,w]=useState(false),[R,M]=useState(false),[D,I]=useState(false),[B,K]=useState(null),[te,ie]=useState(new Date),[de,be]=useState(false),[$,J]=useState(false),[U,G]=useState(""),[A,Q]=useState(false),[X$1,H]=useState(false),[Ce,Me]=useState(false),[Oe,ye]=useState(""),Ye=useRef(null),[We,et]=useState(""),vt=useRef(null),[Mt,mt]=useState(""),[O,le]=useState(false);useEffect(()=>{if(e){let N=sd(e,p);S(N),ye(N.description||""),et(N.name||"");}},[e?.id,p]),useEffect(()=>()=>{Ye.current&&clearTimeout(Ye.current),vt.current&&clearTimeout(vt.current);},[]);let xe=useCallback(N=>{S(N),l&&o&&x?o(cu(N,x)):r&&r(N);},[l,x,o,r]),Pe=useCallback(()=>{w(false),M(false),I(false),K(null),J(false),G(""),Q(false);},[]),ze=useCallback((N,ee)=>{if(!v)return;let se={...v,[N]:ee};xe(se);},[v,xe]),at=useCallback(N=>{ye(N),Ye.current&&clearTimeout(Ye.current),Ye.current=setTimeout(()=>{if(v){let ee={...v,description:N};xe(ee);}},800);},[v,xe]),Et=useCallback(N=>{et(N),vt.current&&clearTimeout(vt.current),vt.current=setTimeout(()=>{if(v&&N.trim()){let ee={...v,name:N.trim()};xe(ee);}},800);},[v,xe]),Fe=useCallback(async()=>{if(!(!v||!Mt.trim()||!T)){le(true);try{await T(v.id,Mt.trim()),mt("");}finally{le(false);}}},[v,Mt,T]),Xt=useCallback(N=>{let ee=typeof N=="string"?new Date(N):N,De=new Date().getTime()-ee.getTime(),$e=Math.floor(De/6e4),tt=Math.floor(De/36e5),Ge=Math.floor(De/864e5);return $e<1?n==="es"?"Ahora":"Just now":$e<60?n==="es"?`Hace ${$e} min`:`${$e}m ago`:tt<24?n==="es"?`Hace ${tt}h`:`${tt}h ago`:Ge<7?n==="es"?`Hace ${Ge}d`:`${Ge}d ago`:ee.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),Ot=useCallback(N=>{if(!v)return;let ee=v.progress||0;N==="completed"?ee=100:N==="in-progress"&&ee===0?ee=10:N==="todo"&&(ee=0);let se={...v,status:N,progress:ee};xe(se),w(false);},[v,xe]),Nt=useCallback((N,ee)=>{if(!v)return;let se={...v,startDate:N,endDate:ee};xe(se);},[v,xe]),ct=useCallback(()=>{let N=te.getFullYear(),ee=te.getMonth(),se=new Date(N,ee,1),$e=new Date(N,ee+1,0).getDate(),tt=se.getDay(),Ge=[],Be=new Date(N,ee,0).getDate();for(let _=tt-1;_>=0;_--)Ge.push({date:new Date(N,ee-1,Be-_),isCurrentMonth:false});for(let _=1;_<=$e;_++)Ge.push({date:new Date(N,ee,_),isCurrentMonth:true});let rt=42-Ge.length;for(let _=1;_<=rt;_++)Ge.push({date:new Date(N,ee+1,_),isCurrentMonth:false});return Ge},[te]),Jt=useCallback(async N=>{if(N.preventDefault(),N.stopPropagation(),H(false),!v||!d)return;let ee=Array.from(N.dataTransfer.files);if(ee.length!==0){Me(true);try{await d(v.id,ee);}finally{Me(false);}}},[v,d]),Ea=useCallback(async N=>{if(!v||!d||!N.target.files)return;let ee=Array.from(N.target.files);if(ee.length!==0){Me(true);try{await d(v.id,ee);}finally{Me(false);}N.target.value="";}},[v,d]),oe=useCallback(N=>{N.preventDefault(),N.stopPropagation(),H(true);},[]),ue=useCallback(N=>{N.preventDefault(),N.stopPropagation(),H(false);},[]),pa=useCallback(N=>N<1024?`${N} B`:N<1024*1024?`${(N/1024).toFixed(1)} KB`:`${(N/(1024*1024)).toFixed(1)} MB`,[]),ya=useCallback(N=>N.startsWith("image/")?Image:N.includes("pdf")||N.includes("document")?FileText:File,[]);return !t||!v?null:jsx(AnimatePresence,{children:t&&v&&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:f("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",b?"bg-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxs("div",{className:f("px-6 py-3 border-b flex items-center gap-3",b?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Circle,{className:f("w-4 h-4",b?"text-[#9CA3AF]":"text-gray-500")}),jsxs("span",{className:f("text-xs px-2 py-0.5 rounded",b?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsx("span",{className:f("text-xs font-mono",b?"text-[#6B7280]":"text-gray-400"),children:v.id.slice(0,8)}),jsxs("button",{className:f("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",b?"bg-purple-500/20 text-purple-400 hover:bg-purple-500/30":"bg-purple-100 text-purple-700 hover:bg-purple-200"),children:[jsx(Sparkles,{className:"w-3 h-3"}),"Ask AI"]})]}),jsx("div",{className:"flex-1"}),jsx("button",{className:f("p-1.5 rounded transition-colors",b?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(Maximize2,{className:"w-4 h-4"})}),jsx("button",{className:f("p-1.5 rounded transition-colors",b?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(MoreHorizontal,{className:"w-5 h-5"})}),jsx("button",{onClick:a,className:f("p-1.5 rounded transition-colors",b?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-5 h-5"})})]}),jsx("div",{className:"px-6 py-4",children:jsxs("div",{className:"flex items-start gap-3",children:[jsx("button",{onClick:()=>{let N=v.progress===100?0:100,se={...v,progress:N,status:N===100?"completed":"todo"};xe(se);},className:f("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",v.progress===100?"bg-green-500 border-green-500":b?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:v.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("input",{type:"text",value:We,onChange:N=>Et(N.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:f("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",v.progress===100?"line-through text-[#6B7280]":b?"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:f("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsx("button",{onClick:()=>{Pe(),w(!k);},className:f("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",v.progress===100||v.status==="completed"?"bg-green-500/20 text-green-400":v.progress&&v.progress>0||v.status==="in-progress"?"bg-blue-500/20 text-blue-400":b?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:v.progress===100||v.status==="completed"?n==="es"?"COMPLETADO":"DONE":v.progress&&v.progress>0||v.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsx(AnimatePresence,{children:k&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>w(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500"}].map(N=>jsxs("button",{onClick:()=>Ot(N.id),className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",b?"hover:bg-white/5":"hover:bg-gray-50",v.status===N.id&&(b?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:f("w-2 h-2 rounded-full",N.color)}),jsx("span",{className:b?"text-white":"text-gray-900",children:N.label})]},N.id))})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(User,{className:f("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxs("button",{onClick:()=>{Pe(),I(!D);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",b?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[v.assignees&&v.assignees.length>0?jsxs("div",{className:"flex items-center gap-1",children:[v.assignees.slice(0,3).map((N,ee)=>jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:N.color||"#8B5CF6"},title:N.name,children:N.initials||N.name.slice(0,2).toUpperCase()},ee)),v.assignees.length>3&&jsxs("span",{className:f("text-xs",b?"text-[#6B7280]":"text-gray-400"),children:["+",v.assignees.length-3]})]}):jsx("span",{className:f("text-sm",b?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsx(ChevronDown,{className:f("w-3 h-3",b?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:D&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>I(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:p.length>0?p.map(N=>{let ee=v.assignees?.some(se=>se.name===N.name);return jsxs("button",{onClick:()=>{let se=v.assignees||[],De;ee?De=se.filter($e=>$e.name!==N.name):De=[...se,N],ze("assignees",De);},className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",b?"hover:bg-white/5":"hover:bg-gray-50",ee&&(b?"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:N.color||"#8B5CF6"},children:N.initials||N.name.slice(0,2).toUpperCase()}),jsx("span",{className:f("flex-1",b?"text-white":"text-gray-900"),children:N.name}),ee&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},N.name)}):jsx("div",{className:f("px-3 py-4 text-sm text-center",b?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CalendarDays,{className:f("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxs("button",{onClick:()=>{K(B?null:"start"),ie(v.startDate||new Date);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",b?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[v.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsx("span",{className:f("mx-1",b?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),v.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsx(AnimatePresence,{children:B&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>K(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:f("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:N=>N.stopPropagation(),children:[jsxs("div",{className:f("w-44 py-2 border-r",b?"border-white/10":"border-gray-200"),children:[(()=>{let N=new Date,ee=new Date(N);ee.setDate(N.getDate()+1);let se=new Date(N);se.setDate(N.getDate()+((6-N.getDay()+7)%7||7));let De=new Date(N);De.setDate(N.getDate()+((1-N.getDay()+7)%7||7));let $e=new Date(N);$e.setDate(N.getDate()+(6-N.getDay()+7)%7+7);let tt=new Date(N);tt.setDate(N.getDate()+14);let Ge=new Date(N);return Ge.setDate(N.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:N,display:N.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:ee,display:ee.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:se,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:De,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:$e,display:$e.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:tt,display:tt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Ge,display:Ge.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((rt,_)=>jsxs("button",{className:f("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",b?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(B==="start"){let ae=v.endDate&&rt.date>v.endDate?rt.date:v.endDate;Nt(rt.date,ae),K("end");}else {let ae=v.startDate&&rt.date<v.startDate?rt.date:v.startDate;Nt(ae,rt.date),K(null);}},children:[jsx("span",{children:rt.label}),jsx("span",{className:f("text-xs",b?"text-[#6B7280]":"text-gray-400"),children:rt.display})]},_))})(),jsx("div",{className:f("border-t mt-2 pt-2",b?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{Nt(void 0,void 0),K(null);},className:f("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",b?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:n==="es"?"Quitar fechas":"Clear dates"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[jsx("div",{className:f("text-xs mb-3 px-2 py-1 rounded",b?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:B==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("span",{className:f("font-medium",b?"text-white":"text-gray-900"),children:te.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>ie(new Date),className:f("p-1 rounded text-sm transition-colors",b?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>ie(new Date(te.getFullYear(),te.getMonth()-1)),className:f("p-1 rounded",b?"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:()=>ie(new Date(te.getFullYear(),te.getMonth()+1)),className:f("p-1 rounded",b?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(N=>jsx("div",{className:f("w-8 h-8 flex items-center justify-center text-xs",b?"text-[#6B7280]":"text-gray-400"),children:N},N))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:ct().map((N,ee)=>{let se=N.date.toDateString()===new Date().toDateString(),De=v.startDate?.toDateString()===N.date.toDateString(),$e=v.endDate?.toDateString()===N.date.toDateString(),tt=De||$e,Ge=v.startDate&&v.endDate&&N.date>=v.startDate&&N.date<=v.endDate;return jsx("button",{onClick:()=>{let Be=new Date(N.date);if(B==="start"){let rt=v.endDate&&Be>v.endDate?Be:v.endDate;Nt(Be,rt),K("end");}else {let rt=v.startDate&&Be<v.startDate?Be:v.startDate;Nt(rt,Be),K(null);}},className:f("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!N.isCurrentMonth&&(b?"text-[#4B5563]":"text-gray-300"),N.isCurrentMonth&&(b?"text-white":"text-gray-900"),se&&"ring-2 ring-[#3B82F6]",De&&"bg-[#3B82F6] text-white",$e&&!De&&"bg-[#7C3AED] text-white",Ge&&!tt&&(b?"bg-[#7C3AED]/20":"bg-purple-100"),!tt&&(b?"hover:bg-white/10":"hover:bg-gray-100")),children:N.date.getDate()},ee)})})]})]})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Flag,{className:f("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsx("button",{onClick:()=>{Pe(),M(!R);},className:f("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",v.priority==="high"||v.priority==="urgent"?"bg-red-500/20 text-red-400":v.priority==="medium"?"bg-yellow-500/20 text-yellow-400":v.priority==="low"?"bg-green-500/20 text-green-400":b?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:v.priority?v.priority==="high"||v.priority==="urgent"?n==="es"?"Alta":"High":v.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsx(AnimatePresence,{children:R&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>M(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(N=>jsxs("button",{onClick:()=>{ze("priority",N.id),M(false);},className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",b?"hover:bg-white/5":"hover:bg-gray-50",v.priority===N.id&&(b?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:f("w-2 h-2 rounded-full",N.color)}),jsx("span",{className:b?"text-white":"text-gray-900",children:N.label})]},N.id||"none"))})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:f("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsx("span",{className:f("text-sm",b?"text-white":"text-gray-900"),children:v.startDate&&v.endDate?`${Math.ceil((v.endDate.getTime()-v.startDate.getTime())/(1e3*60*60*24))} ${n==="es"?"d\xEDas":"days"}`:n==="es"?"Sin definir":"Not set"})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:f("w-4 h-4 rounded-full border-2",b?"border-[#6B7280]":"border-gray-400")}),jsx("span",{className:f("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[de?jsx("input",{type:"range",min:"0",max:"100",step:"5",value:v.progress||0,onChange:N=>{let ee=parseInt(N.target.value),se=v.status;ee===100?se="completed":ee>0?se="in-progress":se="todo";let De={...v,progress:ee,status:se};xe(De);},onBlur:()=>be(false),className:f("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",b?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsx("button",{onClick:()=>be(true),className:f("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",b?"bg-white/10":"bg-gray-200"),children:jsx("div",{className:f("h-full rounded-full transition-all",v.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${v.progress||0}%`}})}),jsxs("span",{className:f("text-sm font-medium min-w-[40px]",b?"text-white":"text-gray-900"),children:[v.progress||0,"%"]})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Tag,{className:f("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsx(nr,{selectedTags:v.tags||[],availableTags:m,onChange:N=>{ze("tags",N);},onCreateTag:i,theme:y})]}),jsxs("div",{className:"flex items-start gap-3 relative",children:[jsx(Link2,{className:f("w-4 h-4 mt-1.5",b?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-24 mt-1",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxs("div",{className:"flex-1",children:[v.dependencies&&v.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:v.dependencies.map(N=>{let ee=h.find(se=>se.id===N);return jsxs("span",{className:f("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",b?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[ee?.name||N.slice(0,8),jsx("button",{onClick:()=>{let se=(v.dependencies||[]).filter(De=>De!==N);ze("dependencies",se);},className:f("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsx(X,{className:"w-3 h-3"})})]},N)})}),jsxs("button",{onClick:()=>{Pe(),J(!$);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",b?"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:f("text-sm",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsx(AnimatePresence,{children:$&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{J(false),G("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsx("div",{className:f("p-2 border-b",b?"border-white/10":"border-gray-200"),children:jsx("input",{type:"text",value:U,onChange:N=>G(N.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:f("w-full px-3 py-2 rounded-md text-sm outline-none",b?"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:h.length>0?h.filter(N=>N.id!==v.id).filter(N=>U===""||N.name.toLowerCase().includes(U.toLowerCase())).map(N=>{let ee=v.dependencies?.includes(N.id);return jsxs("button",{onClick:()=>{let se=v.dependencies||[],De;ee?De=se.filter($e=>$e!==N.id):De=[...se,N.id],ze("dependencies",De);},className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",b?"hover:bg-white/5":"hover:bg-gray-50",ee&&(b?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:f("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",ee?"bg-blue-500 border-blue-500":b?"border-white/30":"border-gray-300"),children:ee&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:f("block truncate",b?"text-white":"text-gray-900"),children:N.name}),jsx("span",{className:f("text-xs",b?"text-[#6B7280]":"text-gray-400"),children:N.id.slice(0,8)})]})]},N.id)}):jsx("div",{className:f("px-3 py-4 text-sm text-center",b?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Palette,{className:f("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxs("button",{onClick:()=>{Pe(),Q(!A);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",b?"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:v.color||"#6366F1"}}),jsx("span",{className:f("text-sm",b?"text-white":"text-gray-900"),children:sr.find(N=>N.value===v.color)?.name||(n==="es"?"Azul":"Blue")}),jsx(ChevronDown,{className:f("w-3 h-3",b?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:A&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Q(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-6 gap-1.5",children:sr.map(N=>{let ee=v.color===N.value;return jsx("button",{onClick:()=>{ze("color",N.value),Q(false);},className:f("w-7 h-7 rounded-full flex items-center justify-center transition-all",ee&&"ring-2 ring-offset-2",b?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:N.value,outlineColor:ee?N.value:void 0},title:N.name,children:ee&&jsx(Check,{className:"w-3.5 h-3.5 text-white"})},N.value)})})})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Diamond,{className:f("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Hito":"Milestone"}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",checked:v.isMilestone||false,onChange:N=>ze("isMilestone",N.target.checked),className:f("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",v.isMilestone?"bg-purple-500 border-purple-500":b?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsx("span",{className:f("text-sm",b?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxs("div",{className:f("mt-6 pt-4 border-t",b?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsx(FileText,{className:f("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsx("h3",{className:f("text-sm font-semibold",b?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsx("textarea",{value:Oe,onChange:N=>at(N.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:f("w-full min-h-[100px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors",b?"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("button",{className:f("flex items-center gap-2 text-sm mt-2 transition-colors",b?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsx(Sparkles,{className:"w-4 h-4"}),n==="es"?"Escribe con IA":"Write with AI"]})]}),jsxs("div",{className:f("mt-6 pt-4 border-t",b?"border-white/10":"border-gray-200"),children:[jsx("h3",{className:f("text-sm font-semibold mb-3",b?"text-white":"text-gray-900"),children:n==="es"?"Campos personalizados":"Custom fields"}),jsxs("button",{className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",b?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsx(Plus,{className:"w-4 h-4"}),n==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxs("div",{className:f("mt-6 pt-4 border-t",b?"border-white/10":"border-gray-200"),children:[jsx("h3",{className:f("text-sm font-semibold mb-3",b?"text-white":"text-gray-900"),children:n==="es"?"Subtareas":"Subtasks"}),v.subtasks&&v.subtasks.length>0&&jsx("div",{className:"space-y-2 mb-3",children:v.subtasks.map(N=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:f("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",N.progress===100?"bg-green-500 border-green-500":b?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:N.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("span",{className:f("text-sm",N.progress===100?"line-through text-[#6B7280]":b?"text-white":"text-gray-900"),children:N.name})]},N.id))}),jsxs("button",{className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",b?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsx(Plus,{className:"w-4 h-4"}),n==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxs("div",{className:f("mt-6 pt-4 border-t",b?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("h3",{className:f("text-sm font-semibold",b?"text-white":"text-gray-900"),children:n==="es"?"Listas de control":"Checklists"}),jsx("button",{className:f("p-1 rounded transition-colors",b?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(Plus,{className:"w-4 h-4"})})]}),jsxs("button",{className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",b?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsx(ListChecks,{className:"w-4 h-4"}),n==="es"?"Crear lista de control":"Create checklist"]})]}),jsxs("div",{className:f("mt-6 pt-4 border-t",b?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:f("text-sm font-semibold mb-3",b?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",u.length>0&&jsxs("span",{className:f("ml-2 text-xs font-normal",b?"text-[#6B7280]":"text-gray-400"),children:["(",u.length,")"]})]}),u.length>0&&jsx("div",{className:"space-y-2 mb-4",children:u.map(N=>{let ee=ya(N.type),se=N.type.startsWith("image/");return jsxs("div",{className:f("flex items-center gap-3 p-2 rounded-lg group transition-colors",b?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[se&&N.thumbnailUrl?jsx("img",{src:N.thumbnailUrl,alt:N.name,className:"w-10 h-10 rounded object-cover"}):jsx("div",{className:f("w-10 h-10 rounded flex items-center justify-center",b?"bg-white/10":"bg-gray-200"),children:jsx(ee,{className:f("w-5 h-5",b?"text-[#9CA3AF]":"text-gray-500")})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("a",{href:N.url,target:"_blank",rel:"noopener noreferrer",className:f("text-sm font-medium truncate block hover:underline",b?"text-white":"text-gray-900"),children:N.name}),jsx("p",{className:f("text-xs",b?"text-[#6B7280]":"text-gray-400"),children:pa(N.size)})]}),g&&jsx("button",{onClick:()=>g(N.id),className:f("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",b?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:n==="es"?"Eliminar":"Delete",children:jsx(Trash2,{className:"w-4 h-4"})})]},N.id)})}),jsxs("div",{onDragOver:oe,onDragLeave:ue,onDrop:Jt,className:f("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",X$1?b?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":b?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",Ce&&"pointer-events-none opacity-50"),children:[jsx("input",{type:"file",multiple:true,onChange:Ea,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!d||Ce}),Ce?jsxs(Fragment,{children:[jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),jsx("p",{className:f("text-sm",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxs(Fragment,{children:[jsx(Upload,{className:f("w-6 h-6 mx-auto mb-2",X$1?"text-blue-500":b?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:f("text-sm",b?"text-[#9CA3AF]":"text-gray-500"),children:X$1?n==="es"?"Suelta los archivos aqu\xED":"Drop files here":n==="es"?jsxs(Fragment,{children:["Suelta tus archivos aqu\xED o ",jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxs(Fragment,{children:["Drop your files here or ",jsx("span",{className:"underline",children:"click to upload"})]})}),!d&&jsx("p",{className:f("text-xs mt-1",b?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxs("div",{className:f("w-80 border-l flex flex-col",b?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsx("div",{className:f("px-4 py-3 border-b",b?"border-white/10":"border-gray-200"),children:jsxs("h3",{className:f("text-sm font-semibold",b?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",C.length>0&&jsxs("span",{className:f("ml-2 text-xs font-normal",b?"text-[#6B7280]":"text-gray-400"),children:["(",C.length,")"]})]})}),jsx("div",{className:"flex-1 overflow-y-auto p-4",children:C.length>0?jsx("div",{className:"space-y-4",children:C.map(N=>jsxs("div",{className:"flex gap-3",children:[jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:N.user?.color||"#8B5CF6"},children:N.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:f("text-sm font-medium",b?"text-white":"text-gray-900"),children:N.user?.name||(n==="es"?"Usuario":"User")}),jsx("span",{className:f("text-xs",b?"text-[#6B7280]":"text-gray-400"),children:Xt(N.createdAt)})]}),jsx("p",{className:f("text-sm break-words",b?"text-[#9CA3AF]":"text-gray-600"),children:N.content})]})]},N.id))}):jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsx(MessageSquare,{className:f("w-10 h-10 mb-3",b?"text-[#3B4252]":"text-gray-300")}),jsx("p",{className:f("text-sm",b?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsx("div",{className:f("p-4 border-t",b?"border-white/10":"border-gray-200"),children:jsxs("div",{className:"flex items-start gap-2",children:[c&&jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:c.color||"#8B5CF6"},children:c.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:f("flex-1 flex items-center gap-2 px-3 py-2 rounded-lg",b?"bg-white/5":"bg-white border border-gray-200"),children:[jsx("input",{type:"text",value:Mt,onChange:N=>mt(N.target.value),onKeyDown:N=>{N.key==="Enter"&&!N.shiftKey&&(N.preventDefault(),Fe());},placeholder:n==="es"?"Escribe un comentario...":"Write a comment...",disabled:O||!T,className:f("flex-1 bg-transparent text-sm outline-none",b?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400",(O||!T)&&"opacity-50")}),jsx("button",{onClick:Fe,disabled:O||!Mt.trim()||!T,className:f("p-1.5 rounded transition-colors",Mt.trim()&&T?"bg-blue-500 text-white hover:bg-blue-600":b?"text-[#6B7280]":"text-gray-400",O&&"opacity-50 cursor-not-allowed"),children:O?jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsx(Send,{className:"w-4 h-4"})})]})]})})]})]})]})})}function ks(){let[e,t]=useState(()=>dragStore.getState());useEffect(()=>dragStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{dragStore.setState(r);},[]);return [e,a]}function Er({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:p,isLoading:m,error:i,children:u,availableTags:d=[],onCreateTag:g,attachmentsByCard:h,onUploadAttachments:C,onDeleteAttachment:T,comments:c,onAddComment:b,currentUser:y,onTaskOpen:l}){let[x,v]=ks(),[S,k]=useState(null),w=o?.theme||"dark",R=w==="dark"||w==="neutral",M=R?"dark":"",D=useCallback((A,Q)=>{t.onCardUpdate?.(A,Q);},[t]),I=useCallback((A,Q)=>{t.onColumnUpdate?.(A,{title:Q});},[t]),B=useCallback(A=>{t.onColumnDelete?.(A);},[t]),K=["todo","in-progress","completed"],te=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),ie=useMemo(()=>{let A=new Map;return e.columns.forEach(Q=>{let X=Q.cardIds.map(H=>e.cards.find(Ce=>Ce.id===H)).filter(H=>H!==void 0).sort((H,Ce)=>H.position-Ce.position);A.set(Q.id,X);}),A},[e.cards,e.columns]),de=useMemo(()=>e.cards.map(A=>({id:A.id,name:A.title,startDate:A.startDate?new Date(A.startDate):void 0,endDate:A.endDate?new Date(A.endDate):void 0,progress:A.progress||0,status:A.columnId,priority:A.priority?.toLowerCase(),dependencies:Array.isArray(A.dependencies)?A.dependencies.map(Q=>typeof Q=="string"?Q:Q.taskId):[]})),[e.cards]),be=useCallback(A=>{let{active:Q}=A,X=e.cards.find(H=>H.id===Q.id);X&&v({isDragging:true,draggedCardId:X.id,sourceColumnId:X.columnId,targetColumnId:X.columnId});},[e.cards,v]),$=useCallback(A=>{let{active:Q,over:X}=A;if(!X||!e.cards.find(Me=>Me.id===Q.id))return;let Ce=null;X.data.current?.type==="column"?Ce=X.id:X.data.current?.type==="card"&&(Ce=e.cards.find(Oe=>Oe.id===X.id)?.columnId||null),Ce&&Ce!==x.targetColumnId&&v({...x,targetColumnId:Ce});},[e.cards,x,v]),J=useCallback(async A=>{let{active:Q,over:X}=A;if(v({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!X)return;let H=e.cards.find(ye=>ye.id===Q.id);if(!H)return;let Ce,Me;if(X.data.current?.type==="column"){Ce=X.id;let ye=ie.get(Ce)||[];Me=ns(ye,0);}else {let ye=e.cards.find(et=>et.id===X.id);if(!ye)return;Ce=ye.columnId;let Ye=ie.get(Ce)||[],We=Ye.findIndex(et=>et.id===X.id);Me=ns(Ye,We);}let Oe=e.columns.find(ye=>ye.id===Ce);if(Oe&&Oe.wipLimit&&Oe.wipLimitType==="hard"){let ye=ie.get(Ce)||[];if(H.columnId!==Ce&&ye.length>=Oe.wipLimit){t.onWipLimitExceeded?.(Oe,H);return}}(H.columnId!==Ce||H.position!==Me)&&await t.onCardMove?.(H.id,Ce,Me);},[e.cards,e.columns,ie,t,v]),U=useCallback(A=>{k(A),a?.(A),l?.(A.id);},[a,l]),G=useCallback(A=>{t.onCardUpdate?.(A.id,A),k(A);},[t]);return m?jsx("div",{className:f("asakaa-board",M,n),style:p,children:jsx(wu,{columnCount:3})}):i?jsx("div",{className:f("asakaa-board",M,n),style:p,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(Il,{themeName:w,children:[jsxs(DndContext,{sensors:te,collisionDetection:closestCorners,onDragStart:be,onDragOver:$,onDragEnd:J,children:[jsxs("div",{className:f("asakaa-board",M,n),style:p,"data-theme":w,children:[e.columns.sort((A,Q)=>A.position-Q.position).map(A=>{let Q=ie.get(A.id)||[],X=!K.includes(A.id);return jsx(io,{column:A,cards:Q,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:U,onCardUpdate:D,onColumnRename:I,onColumnDelete:B,isDeletable:X,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},A.id)}),u]}),jsx(DragOverlay,{children:x.draggedCardId?jsx(ur,{card:e.cards.find(A=>A.id===x.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),jsx(_r,{task:S,isOpen:!!S,onClose:()=>k(null),onCardUpdate:G,theme:R?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:d,onCreateTag:g,attachments:S?h?.get(S.id)||[]:[],onUploadAttachments:C,onDeleteAttachment:T,availableTasks:de,comments:c,onAddComment:b,currentUser:y})]})}function wu({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 Su={bgGrid:"#0F1117",bgSecondary:"#1A1D25",border:"rgba(255, 255, 255, 0.1)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"#E5E7EB",textSecondary:"#9CA3AF",textTertiary:"#6B7280",accent:"#3B82F6",accentLight:"rgba(59, 130, 246, 0.15)",hoverBg:"rgba(255, 255, 255, 0.05)"},Eu={bgGrid:"#FFFFFF",bgSecondary:"#F9FAFB",border:"rgba(0, 0, 0, 0.1)",borderLight:"rgba(0, 0, 0, 0.05)",textPrimary:"#111827",textSecondary:"#6B7280",textTertiary:"#9CA3AF",accent:"#3B82F6",accentLight:"rgba(59, 130, 246, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},Pu={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},Mu={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function Au({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=useState(false),p=useRef(null);useEffect(()=>{let i=u=>{p.current&&!p.current.contains(u.target)&&n(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let m=i=>{t(i),n(false);};return jsxs("div",{ref:p,className:"relative",children:[jsxs(motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:o||r.newTask}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((i,u)=>i.position-u.position).map((i,u)=>jsxs(motion.button,{onClick:()=>m(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom: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 Fu({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=useState(false),[p,m]=useState(null),i=useRef(null);if(useEffect(()=>{let h=C=>{i.current&&!i.current.contains(C.target)&&n(false);};return s&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]),!(a||r||o))return null;let d=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(h=>h.handler),g=async(h,C)=>{if(C){m(h);try{await C();}catch(T){console.error(`Export ${h} failed:`,T);}finally{m(null),n(false);}}};return jsxs("div",{ref:i,className:"relative",children:[jsxs(motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:t.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsx("div",{className:"py-1",children:d.map((h,C)=>jsxs(motion.button,{onClick:()=>g(h.id,h.handler),disabled:p!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:C<d.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:C*.03},children:[jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:p===h.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-4 h-4"})}):h.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:h.label}),jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:h.description})]})]},h.id))})})})]})}function Lu({onClick:e,label:t}){return jsxs(motion.button,{onClick:e,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:t})]})}function Cs({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:p,onExportExcel:m,translations:i}){let u=r==="dark"?Su:Eu,d={...o==="es"?Pu:Mu,...i},g=n||p||m;return jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:u.bgGrid,borderColor:u.border},children:jsxs("div",{className:"flex items-center gap-3",children:[g&&jsxs(Fragment,{children:[jsx(Fu,{theme:u,t:d,onExportCSV:n,onExportJSON:p,onExportExcel:m}),t&&jsx("div",{className:"w-px h-6",style:{backgroundColor:u.borderLight}})]}),t&&(s?jsx(Au,{columns:e,onSelect:t,theme:u,t:d,createTaskLabel:a}):jsx(Lu,{onClick:()=>t(),label:a||d.newTask}))]})})}function Ns({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=useState(false),[p,m]=useState(""),i=useCallback(()=>{let g=p.trim();g&&(e(g),m(""),n(false));},[p,e]),u=useCallback(g=>{g.key==="Enter"?(g.preventDefault(),i()):g.key==="Escape"&&(m(""),n(false));},[i]),d=useCallback(()=>{setTimeout(()=>{p.trim()||n(false);},150);},[p]);return s?jsx("div",{className:f("asakaa-add-column asakaa-add-column--editing",t),children:jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsx("input",{type:"text",value:p,onChange:g=>m(g.target.value),onKeyDown:u,onBlur:d,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxs("div",{className:"asakaa-add-column__actions",children:[jsx("button",{onClick:i,disabled:!p.trim(),className:"asakaa-add-column__submit",type:"button",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsx("button",{onClick:()=>{m(""),n(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsx("div",{className:f("asakaa-add-column",t),children:jsxs("button",{onClick:()=>n(true),disabled:o,className:"asakaa-add-column__button",type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),r]})})}function Ds({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:s,disabled:n=false,theme:p="dark",locale:m="es"}){let[i,u]=useState(false),[d,g]=useState(false),[h,C]=useState(""),[T,c]=useState([]),[b,y]=useState(""),[l,x]=useState(""),[v,S]=useState(""),[k,w]=useState(false),[R,M]=useState(false),[D,I]=useState(false),B=useRef(null),K=useRef(null),te={placeholder:o||(m==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:s||(m==="es"?"Agregar Tarea":"Add Task"),save:m==="es"?"Guardar":"Save",addAssignee:m==="es"?"Agregar asignado":"Add assignee",addDates:m==="es"?"Agregar fechas":"Add dates",addPriority:m==="es"?"Agregar prioridad":"Add priority",startDate:m==="es"?"Inicio":"Start",endDate:m==="es"?"Fin":"End",low:m==="es"?"Baja":"Low",medium:m==="es"?"Media":"Medium",high:m==="es"?"Alta":"High",urgent:m==="es"?"Urgente":"Urgent"},ie=useCallback(()=>{C(""),c([]),y(""),x(""),S(""),w(false),M(false),I(false),u(false);},[]);useEffect(()=>{i&&B.current&&B.current.focus();},[i]),useEffect(()=>{if(!i)return;let U=G=>{K.current&&!K.current.contains(G.target)&&(h.trim()||ie());};return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[i,h,ie]);let de=useCallback(async()=>{let U=h.trim();if(!(!U||d)){g(true);try{await t({name:U,columnId:e,assigneeIds:T.length>0?T:void 0,startDate:b?new Date(b):void 0,endDate:l?new Date(l):void 0,priority:v||void 0}),C(""),c([]),y(""),x(""),S(""),w(!1),M(!1),I(!1),B.current?.focus();}catch(G){console.error("Error creating card:",G);}finally{g(false);}}},[h,e,T,b,l,v,t,d]),be=useCallback(U=>{U.key==="Enter"&&!U.shiftKey?(U.preventDefault(),de()):U.key==="Escape"&&ie();},[de,ie]),$=useCallback(U=>{c(G=>G.includes(U)?G.filter(A=>A!==U):[...G,U]);},[]),J=p==="dark";return i?jsxs("div",{ref:K,className:f("rounded-lg overflow-hidden shadow-lg",J?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxs("div",{className:"p-3",children:[jsx("input",{ref:B,type:"text",value:h,onChange:U=>C(U.target.value),onKeyDown:be,placeholder:te.placeholder,disabled:d,className:f("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",J?"text-gray-100 placeholder-gray-500":"text-gray-800 placeholder-gray-400")}),jsxs("div",{className:"flex items-center gap-1 mt-3",children:[a.length>0&&jsxs("button",{onClick:()=>w(!k),className:f("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",k||T.length>0?"bg-emerald-500/20 text-emerald-400":J?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:te.addAssignee,children:[jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),T.length>0&&jsx("span",{className:"ml-0.5",children:T.length})]}),jsx("button",{onClick:()=>M(!R),className:f("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",R||b||l?"bg-blue-500/20 text-blue-400":J?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:te.addDates,children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]})}),jsx("button",{onClick:()=>I(!D),className:f("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",D||v?v==="urgent"?"bg-red-500/20 text-red-400":v==="high"?"bg-orange-500/20 text-orange-400":v==="medium"?"bg-yellow-500/20 text-yellow-400":v==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":J?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:te.addPriority,children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"}),jsx("line",{x1:"4",y1:"22",x2:"4",y2:"15"})]})}),jsx("div",{className:"flex-1"}),jsx("button",{onClick:de,disabled:!h.trim()||d,className:f("px-3 py-1.5 rounded-md text-xs font-medium text-white transition-all","bg-emerald-500 hover:bg-emerald-600","disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-emerald-500"),type:"button",children:d?jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}):te.save})]})]}),k&&a.length>0&&jsx("div",{className:f("px-3 pb-3 pt-0","border-t",J?"border-[#3a3a4e]":"border-gray-200"),children:jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(U=>jsxs("button",{onClick:()=>$(U.id),className:f("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",T.includes(U.id)?"bg-emerald-500 text-white":J?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[U.avatar?jsx("img",{src:U.avatar,alt:U.name,className:"w-4 h-4 rounded-full"}):jsx("div",{className:f("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",T.includes(U.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:U.name.charAt(0).toUpperCase()}),jsx("span",{children:U.name.split(" ")[0]})]},U.id))})}),R&&jsx("div",{className:f("px-3 pb-3 pt-0","border-t",J?"border-[#3a3a4e]":"border-gray-200"),children:jsxs("div",{className:"grid grid-cols-2 gap-2 pt-3",children:[jsxs("div",{children:[jsx("label",{className:f("block text-[10px] uppercase tracking-wide mb-1",J?"text-gray-500":"text-gray-400"),children:te.startDate}),jsx("input",{type:"date",value:b,onChange:U=>y(U.target.value),className:f("w-full px-2 py-1.5 rounded text-xs border",J?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxs("div",{children:[jsx("label",{className:f("block text-[10px] uppercase tracking-wide mb-1",J?"text-gray-500":"text-gray-400"),children:te.endDate}),jsx("input",{type:"date",value:l,onChange:U=>x(U.target.value),className:f("w-full px-2 py-1.5 rounded text-xs border",J?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),D&&jsx("div",{className:f("px-3 pb-3 pt-0","border-t",J?"border-[#3a3a4e]":"border-gray-200"),children:jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(U=>jsx("button",{onClick:()=>S(v===U?"":U),className:f("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",v===U?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[U]} text-white`:J?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:te[U]},U))})})]}):jsxs("button",{onClick:()=>u(true),disabled:n,className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",J?"hover:bg-[#2a2a3e]":"hover:bg-gray-100",n&&"opacity-50 cursor-not-allowed",r),type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),jsx("span",{className:"text-sm font-medium",children:te.buttonLabel})]})}var Mo=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(Er,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let o=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,o?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(o=>`"${o}"`).join(",")).join(`
5
+ `)}async exportToPDF(){throw new Error("PDF export not yet implemented in ViewAdapter")}async exportToPNG(){if(!this.container)throw new Error("View not mounted");let r=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((o,s)=>{r.toBlob(n=>{n?o(n):s(new Error("Failed to create PNG blob"));},"image/png");})}};function yd(e={}){return new Mo(e)}var co=class extends Component{constructor(a){super(a);this.resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(a){return {hasError:true,error:a}}componentDidCatch(a,r){let{onError:o,componentName:s}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${s||"Component"}:`,a),console.error("Error Info:",r)),this.setState({errorInfo:r}),o)try{o(a,r);}catch(n){console.error("Error in error handler:",n);}}render(){let{hasError:a,error:r}=this.state,{children:o,fallback:s,componentName:n}=this.props;return a&&r?s?s(r,this.resetError):jsx("div",{className:"p-6 rounded-lg border",style:{background:"linear-gradient(135deg, #2d1b1b 0%, #1a1a1a 100%)",borderColor:"rgba(239, 68, 68, 0.3)"},children:jsxs("div",{className:"flex items-start gap-3",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"flex-shrink-0",children:[jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#EF4444",strokeWidth:"2"}),jsx("path",{d:"M12 8V12",stroke:"#EF4444",strokeWidth:"2",strokeLinecap:"round"}),jsx("circle",{cx:"12",cy:"16",r:"1",fill:"#EF4444"})]}),jsxs("div",{className:"flex-1",children:[jsx("h3",{className:"text-lg font-semibold text-red-400 mb-1",children:n?`Error in ${n}`:"Something went wrong"}),jsx("p",{className:"text-sm text-white/70 mb-3",children:r.message||"An unexpected error occurred"}),process.env.NODE_ENV==="development"&&jsxs("details",{className:"mb-3",children:[jsx("summary",{className:"text-xs text-white/50 cursor-pointer hover:text-white/70 mb-2",children:"Error Details (Development Only)"}),jsx("pre",{className:"text-xs text-white/60 bg-black/30 p-3 rounded overflow-auto max-h-48",children:r.stack})]}),jsx("button",{onClick:this.resetError,className:"px-4 py-2 rounded-lg text-sm font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#EF4444"},children:"Try Again"})]})]})}):o}};function Ss(e,t){let a=r=>jsx(co,{...t,children:jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function Ps({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:p,onOpenAIUsage:m,shortcut:i="k",className:u=""}){let[d,g]=useState(false),[h,C]=useState(""),[T,c]=useState("home"),[b,y]=useState(""),[l,x]=useState("");useEffect(()=>{let w=R=>{(R.metaKey||R.ctrlKey)&&R.key===i&&(R.preventDefault(),g(M=>!M)),R.key==="Escape"&&(g(false),c("home"),C(""));};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[i]),useEffect(()=>{d||(c("home"),C(""),y(""),x(""));},[d]);let v=useCallback(()=>{g(false);},[]),S=useCallback(w=>{let[R,M]=w.split(":");switch(R){case "create-card":c("create-card");break;case "create-card-in":y(M||"");break;case "navigate":M?(a?.(M),v()):c("navigate");break;case "search":r?.(h),v();break;case "priority":c("priority");break;case "set-priority":l&&M&&(o?.(l,M),v());break;case "assign":c("assign");break;case "assign-user":l&&M&&(s?.(l,M),v());break;case "ai":c("ai");break;case "ai-generate-plan":n?.(),v();break;case "ai-predict-risks":p?.(),v();break;case "ai-usage":m?.(),v();break;case "back":c("home");break;}},[h,l,t,a,r,o,s,n,p,m,v]),k=useCallback(()=>{b&&h.trim()&&(t?.(b,h.trim()),v());},[b,h,t,v]);return d?jsx(lt,{children:jsx("div",{className:"command-palette-overlay",onClick:v,children:jsx("div",{className:`command-palette ${u}`,onClick:w=>w.stopPropagation(),children:jsxs(Command,{value:h,onValueChange:C,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:T==="create-card"&&b?"Type card title and press Enter...":T==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:w=>{w.key==="Enter"&&T==="create-card"&&b&&k();}}),jsxs("div",{className:"command-palette-shortcut",children:[jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsx("kbd",{children:"K"})]})]}),jsxs(Command.List,{className:"command-palette-list",children:[jsx(Command.Empty,{className:"command-palette-empty",children:"No results found."}),T==="home"&&jsxs(Fragment,{children:[jsxs(Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxs(Command.Item,{value:"create-card",onSelect:S,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:S,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:S,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:S,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(w=>jsxs(Command.Item,{value:`navigate:${w.id}`,onSelect:S,className:"command-palette-item",children:[jsx("div",{className:"command-palette-item-dot",style:{background:w.priority==="URGENT"?"#EF4444":w.priority==="HIGH"?"#F59E0B":w.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsx("span",{children:w.title}),w.labels&&w.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:w.labels.slice(0,2).map(R=>jsx("span",{className:"command-palette-item-label",children:R},R))})]},w.id))})]}),T==="create-card"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:S,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(w=>jsxs(Command.Item,{value:`create-card-in:${w.id}`,onSelect:S,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:w.title}),jsxs("div",{className:"command-palette-item-count",children:[w.cardIds.length," cards"]})]},w.id))})]}),T==="navigate"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:S,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(w=>{let R=e.columns.find(M=>M.id===w.columnId);return jsxs(Command.Item,{value:`navigate:${w.id}`,onSelect:S,className:"command-palette-item",keywords:[w.title,w.description||"",...w.labels||[]],children:[jsx("div",{className:"command-palette-item-dot",style:{background:w.priority==="URGENT"?"#EF4444":w.priority==="HIGH"?"#F59E0B":w.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxs("div",{className:"command-palette-item-content",children:[jsx("div",{children:w.title}),jsx("div",{className:"command-palette-item-meta",children:R?.title})]}),w.labels&&w.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:w.labels.slice(0,2).map(M=>jsx("span",{className:"command-palette-item-label",children:M},M))})]},w.id)})})]}),T==="ai"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:S,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:S,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:S,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:S,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 kd(e,t,a,r,o){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let n=document.createElement("div");n.id="attachment-lightbox-native",n.className="attachment-lightbox",n.style.cssText=`
6
6
  position: fixed !important;
7
7
  inset: 0 !important;
8
8
  z-index: 2147483647 !important;
@@ -68,7 +68,7 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
68
68
  border: none !important;
69
69
  cursor: pointer !important;
70
70
  opacity: 0.5 !important;
71
- `,h.onmouseenter=()=>{h.style.opacity="1";},h.onmouseleave=()=>{h.style.opacity="0.5";},h.onclick=C=>{C.stopPropagation();let T=r<a.length-1?r+1:0;i(),o(T);},n.appendChild(d),n.appendChild(g),n.appendChild(h);}n.appendChild(p),n.appendChild(m),document.body.appendChild(n),setTimeout(()=>{m.style.transition="opacity 0.5s ease",m.style.opacity="0";},2e3);}function zu(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 Uu(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 As(e){return e.startsWith("image/")}function dr({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,p]=useState(false),[m,i]=useState(false),[u,d]=useState(null),g=useRef(null),h=useRef(e);h.current=e;let C=useCallback((w,B)=>{B.preventDefault(),B.stopPropagation();let M=h.current.filter(R=>As(R.type)),D=M.findIndex(R=>R.id===w.id),I=R=>{let Y=h.current.filter(ye=>As(ye.type)),te=Y[R];te&&kd(te.url,te.name,Y,R,I);};kd(w.url,w.name,M,D,I);},[]),T=useCallback(w=>{let B=[],M=[];return e.length+w.length>s?(M.push(`Maximum ${s} files allowed`),{valid:B,errors:M}):(w.forEach(D=>{if(D.size/1048576>r){M.push(`${D.name} is too large (max ${r}MB)`);return}if(o&&!o.some(R=>D.type.match(R))){M.push(`${D.name} has invalid file type`);return}B.push(D);}),{valid:B,errors:M})},[e.length,s,r,o]),c=useCallback(async w=>{let{valid:B,errors:M}=T(w);if(M.length>0){d(M.join(", ")),setTimeout(()=>d(null),5e3);return}if(B.length!==0){i(true),d(null);try{await t?.(B);}catch(D){d(D instanceof Error?D.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{i(false);}}},[T,t]),b=useCallback(w=>{w.preventDefault(),w.stopPropagation(),p(true);},[]),y=useCallback(w=>{w.preventDefault(),w.stopPropagation(),p(false);},[]),l=useCallback(w=>{w.preventDefault(),w.stopPropagation();},[]),x=useCallback(w=>{w.preventDefault(),w.stopPropagation(),p(false);let B=Array.from(w.dataTransfer.files);c(B);},[c]),v=useCallback(w=>{let B=w.target.files?Array.from(w.target.files):[];c(B),g.current&&(g.current.value="");},[c]),S=useCallback(()=>{g.current?.click();},[]),k=useCallback(w=>{confirm("Are you sure you want to delete this attachment?")&&a?.(w);},[a]);return jsxs("div",{className:"attachment-uploader",children:[jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${m?"uploading":""}`,onDragEnter:b,onDragLeave:y,onDragOver:l,onDrop:x,onClick:S,children:[jsx("input",{ref:g,type:"file",multiple:true,onChange:v,style:{display:"none"},accept:o?.join(",")}),jsx("div",{className:"attachment-dropzone-content",children:m?jsxs(Fragment,{children:[jsx("div",{className:"attachment-spinner"}),jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxs(Fragment,{children:[jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsx("p",{className:"attachment-dropzone-text",children:n?"Drop files here":"Drag & drop files here"}),jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),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(w=>jsxs("div",{className:"attachment-item",children:[jsx("div",{className:"attachment-preview",children:As(w.type)&&w.url?jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:B=>C(w,B),title:"Click to view full size",children:[jsx("img",{src:w.thumbnailUrl||w.url,alt:w.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:Uu(w.type)})}),jsxs("div",{className:"attachment-info",children:[jsx("a",{href:w.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:w.name,children:w.name}),jsxs("div",{className:"attachment-meta",children:[jsx("span",{className:"attachment-size",children:zu(w.size)}),jsx("span",{className:"attachment-separator",children:"\u2022"}),jsx("span",{className:"attachment-date",children:new Date(w.uploadedAt).toLocaleDateString()})]})]}),jsx("button",{onClick:()=>k(w.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"})})})]},w.id))})]})}function Fs({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:p=[],aiInsights:m=[],attachments:i=[],onAddComment:u,onDeleteComment:d,onUploadAttachments:g,onDeleteAttachment:h,onSuggestAssignee:C,onGenerateSubtasks:T,onEstimateEffort:c,currentUserId:b="user-1"}){let[y,l]=useState("details"),[x,v]=useState(false),[S,k]=useState({}),[w,B]=useState(""),[M,D]=useState(false),[I,R]=useState({});if(!t||!e)return null;let Y=useCallback(()=>{v(false),k({}),l("details"),B(""),R({}),a();},[a]),te=useCallback(()=>{r&&Object.keys(S).length>0&&(r(e.id,S),k({}),v(false));},[e.id,S,r]),ye=useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),Y());},[e.id,o,Y]),De=useCallback(()=>{u&&w.trim()&&(u(e.id,w.trim()),B(""));},[e.id,w,u]),Se=useCallback(async()=>{if(C){D(true);try{let A=await C(e);R(X=>({...X,assignees:A}));}catch(A){console.error("Failed to suggest assignee:",A);}finally{D(false);}}},[e,C]),O=useCallback(async()=>{if(T){D(true);try{let A=await T(e);R(X=>({...X,subtasks:A}));}catch(A){console.error("Failed to generate subtasks:",A);}finally{D(false);}}},[e,T]),V=useCallback(async()=>{if(c){D(true);try{let A=await c(e);R(X=>({...X,effort:A}));}catch(A){console.error("Failed to estimate effort:",A);}finally{D(false);}}},[e,c]),$={...e,...S},G=s.filter(A=>$.assignedUserIds?.includes(A.id));return jsx(lt,{children:jsx("div",{className:"card-detail-overlay",onClick:Y,children:jsxs("div",{className:"card-detail-modal",onClick:A=>A.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:$.priority==="URGENT"?"#EF4444":$.priority==="HIGH"?"#F59E0B":$.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),x?jsx("input",{type:"text",value:S.title??$.title,onChange:A=>k({...S,title:A.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsx("h2",{className:"card-detail-title",children:$.title})]}),jsxs("div",{className:"card-detail-header-actions",children:[x?jsxs(Fragment,{children:[jsx("button",{onClick:te,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsx("button",{onClick:()=>{v(false),k({});},className:"card-detail-btn",children:"Cancel"})]}):jsxs("button",{onClick:()=>v(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:ye,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:Y,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:()=>l("details"),className:`card-detail-tab ${y==="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:()=>l("comments"),className:`card-detail-tab ${y==="comments"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",n.length>0&&jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxs("button",{onClick:()=>l("activity"),className:`card-detail-tab ${y==="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",p.length>0&&jsx("span",{className:"card-detail-tab-badge",children:p.length})]}),jsxs("button",{onClick:()=>l("attachments"),className:`card-detail-tab ${y==="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:()=>l("ai"),className:`card-detail-tab ${y==="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:[y==="details"&&jsxs("div",{className:"card-detail-details",children:[jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Description"}),x?jsx("textarea",{value:S.description??$.description??"",onChange:A=>k({...S,description:A.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsx("p",{className:"card-detail-text",children:$.description||"No description"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Assigned To"}),x?jsx("select",{multiple:true,value:S.assignedUserIds??$.assignedUserIds??[],onChange:A=>{let X=Array.from(A.target.selectedOptions,q=>q.value);k({...S,assignedUserIds:X});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(A=>jsx("option",{value:A.id,children:A.name},A.id))}):jsx("div",{className:"card-detail-users",children:G.length>0?G.map(A=>jsxs("div",{className:"card-detail-user",children:[jsx("div",{className:"card-detail-user-avatar",style:{background:A.color},children:A.initials}),jsx("span",{children:A.name})]},A.id)):jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Priority"}),x?jsxs("select",{value:S.priority??$.priority??"",onChange:A=>k({...S,priority:A.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:$.priority==="URGENT"?"#EF4444":$.priority==="HIGH"?"#F59E0B":$.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsx("span",{children:$.priority||"None"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Labels"}),jsx("div",{className:"card-detail-labels",children:$.labels&&$.labels.length>0?$.labels.map(A=>jsx("span",{className:"card-detail-label-tag",children:A},A)):jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxs("div",{className:"card-detail-section-row",children:[jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Start Date"}),x?jsx("input",{type:"date",value:S.startDate?new Date(S.startDate).toISOString().split("T")[0]:$.startDate?new Date($.startDate).toISOString().split("T")[0]:"",onChange:A=>k({...S,startDate:A.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:$.startDate?new Date($.startDate).toLocaleDateString():"Not set"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"End Date"}),x?jsx("input",{type:"date",value:S.endDate?new Date(S.endDate).toISOString().split("T")[0]:$.endDate?new Date($.endDate).toISOString().split("T")[0]:"",onChange:A=>k({...S,endDate:A.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:$.endDate?new Date($.endDate).toLocaleDateString():"Not set"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),x?jsx("input",{type:"number",min:"0",step:"0.5",value:S.estimatedTime??$.estimatedTime??"",onChange:A=>k({...S,estimatedTime:A.target.value?parseFloat(A.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsx("span",{className:"card-detail-text",children:$.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:$.dependencies&&$.dependencies.length>0?$.dependencies.map(A=>{let X=typeof A=="string"?A:A.taskId;return jsxs("span",{className:"card-detail-dependency",children:["Card #",X.slice(-4)]},X)}):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:$.createdAt?new Date($.createdAt).toLocaleString():"Unknown"})]})]}),y==="comments"&&jsxs("div",{className:"card-detail-comments",children:[jsxs("div",{className:"card-detail-comment-form",children:[jsx("textarea",{value:w,onChange:A=>B(A.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsx("button",{onClick:De,disabled:!w.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsx("div",{className:"card-detail-comments-list",children:n.length>0?n.map(A=>{let X=s.find(q=>q.id===A.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:[X&&jsx("div",{className:"card-detail-user-avatar",style:{background:X.color},children:X.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-comment-author-name",children:X?.name||"Unknown"}),jsx("div",{className:"card-detail-comment-time",children:new Date(A.createdAt).toLocaleString()})]})]}),d&&jsx("button",{onClick:()=>d(A.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:A.content})]},A.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"})]})})]}),y==="activity"&&jsx("div",{className:"card-detail-activity",children:p.length>0?jsx("div",{className:"card-detail-activity-list",children:p.map(A=>{let X=s.find(q=>q.id===A.userId);return jsxs("div",{className:"card-detail-activity-item",children:[jsxs("div",{className:"card-detail-activity-icon",children:[A.type.includes("CREATED")&&"\u2795",A.type.includes("UPDATED")&&"\u270F\uFE0F",A.type.includes("MOVED")&&"\u27A1\uFE0F",A.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",A.type.includes("COMMENT")&&"\u{1F4AC}",A.type.includes("ASSIGNED")&&"\u{1F464}",A.type.includes("PRIORITY")&&"\u{1F3AF}",A.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",A.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxs("div",{className:"card-detail-activity-content",children:[jsxs("div",{className:"card-detail-activity-text",children:[jsx("strong",{children:X?.name||"Unknown"})," ",A.type.replace(/_/g," ").toLowerCase(),A.newValue&&jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsx("strong",{children:A.newValue})]})]}),jsx("div",{className:"card-detail-activity-time",children:new Date(A.timestamp).toLocaleString()})]})]},A.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"})]})}),y==="attachments"&&jsx("div",{className:"card-detail-attachments",children:jsx(dr,{cardId:e.id,attachments:i,onUpload:g?A=>g(e.id,A):void 0,onDelete:h,currentUserId:b,maxSizeMB:10,maxFiles:20})}),y==="ai"&&jsxs("div",{className:"card-detail-ai",children:[jsxs("div",{className:"card-detail-ai-actions",children:[jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxs("button",{onClick:Se,disabled:M||!C,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:O,disabled:M||!T,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:V,disabled:M||!c,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"]})]}),I.assignees&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Assignee Suggestions"}),I.assignees.map((A,X)=>{let q=s.find(U=>U.id===A.userId);return jsxs("div",{className:"card-detail-ai-suggestion",children:[q&&jsx("div",{className:"card-detail-user-avatar",style:{background:q.color},children:q.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-ai-suggestion-name",children:q?.name}),jsx("div",{className:"card-detail-ai-suggestion-reason",children:A.reasoning}),jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(A.confidence*100).toFixed(0),"%"]})]})]},X)})]}),I.subtasks&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Suggested Subtasks"}),I.subtasks.map((A,X)=>jsxs("div",{className:"card-detail-ai-subtask",children:[jsx("div",{className:"card-detail-ai-subtask-title",children:A.title}),A.description&&jsx("div",{className:"card-detail-ai-subtask-desc",children:A.description}),A.estimatedTime&&jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",A.estimatedTime,"h"]})]},X))]}),I.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:[I.effort.hours," hours"]}),jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(I.effort.confidence*100).toFixed(0),"%"]})]})]}),m.length>0&&jsxs("div",{className:"card-detail-ai-insights",children:[jsx("h4",{children:"AI Insights"}),m.map(A=>jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${A.severity.toLowerCase()}`,children:[jsxs("div",{className:"card-detail-ai-insight-header",children:[jsx("span",{className:"card-detail-ai-insight-title",children:A.title}),jsx("span",{className:"card-detail-ai-insight-severity",children:A.severity})]}),jsx("p",{className:"card-detail-ai-insight-desc",children:A.description}),A.suggestedAction&&jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",A.suggestedAction]})]},A.id))]}),!I.assignees&&!I.subtasks&&!I.effort&&m.length===0&&jsxs("div",{className:"card-detail-empty-state",children:[jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),jsx("p",{children:"AI Suggestions"}),jsx("span",{children:"Click a button above to get AI-powered insights"})]})]})]})]})})})}function Fo({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[p,m]=useState({top:0,left:0}),i=useRef(null),u=useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),g=window.innerHeight,h=window.innerWidth,C=4,T=d.left;T+o>h-10&&(T=h-o-10),T<10&&(T=10);let c=g-d.bottom,b=d.top,y;return c>=s+C?y=d.bottom+C:b>=s+C?y=d.top-s-C:c>=b?y=d.bottom+C:y=Math.max(10,d.top-s-C),{top:y,left:T}},[e,o,s]);return useEffect(()=>{t&&m(u());},[t,u]),useEffect(()=>{if(!t)return;let d=h=>{let C=h.target;i.current&&!i.current.contains(C)&&e.current&&!e.current.contains(C)&&a();},g=setTimeout(()=>{document.addEventListener("mousedown",d);},0);return ()=>{clearTimeout(g),document.removeEventListener("mousedown",d);}},[t,a,e]),useEffect(()=>{if(!t)return;let d=g=>{g.key==="Escape"&&(g.preventDefault(),g.stopPropagation(),a());};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),t?jsx(lt,{children:jsx("div",{ref:i,className:`smart-popover ${n}`,style:{position:"fixed",top:`${p.top}px`,left:`${p.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var qe={dark:{bgPrimary:"#1A1D21",bgSecondary:"#22262D",bgGrid:"#1E2126",bgWeekend:"rgba(59, 130, 246, 0.03)",border:"#334155",borderLight:"#2D3139",textPrimary:"#FFFFFF",textSecondary:"#CBD5E1",textTertiary:"#64748B",accent:"#3B82F6",accentHover:"#60A5FA",accentLight:"rgba(59, 130, 246, 0.12)",taskBarPrimary:"#3B82F6",taskBarProgress:"#2563EB",taskBarHandle:"#FFFFFF",dependency:"#9CA3AF",dependencyHover:"#6B7280",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.12)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.12)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.1)",statusTodo:"#64748B",statusInProgress:"#3B82F6",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.06)",focusRing:"#3B82F6"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(37, 99, 235, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#2563EB",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2563EB",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"#6B7280",dependencyHover:"#4B5563",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.1)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#64748B",statusInProgress:"#2563EB",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2563EB"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"#78716C",dependencyHover:"#57534E",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.06)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.08)",statusTodo:"#78716C",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.035)",focusRing:"#292524"}};var Yu=["LOW","MEDIUM","HIGH","URGENT"],qu=["todo","in-progress","review","done"];function Bs({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:p=[],onAddComment:m,onDeleteComment:i,currentUser:u,onAIGenerateDescription:d,onAICreateSubtasks:g,onAIFindSimilar:h,availableColumns:C=[],availableLabels:T=[],availableTags:c=[],onCreateTag:b,onUploadCoverImage:y,unsplashAccessKey:l,theme:x,onSubtasksChange:v,attachments:S=[],onUploadAttachments:k,onDeleteAttachment:w}){let B=oo(),M=x||B?.themeName||"dark",[D,I]=useState(e),[R,Y]=useState(false),[te,ye]=useState(e?.subtasks||[]),[De,Se]=useState(false),[O,V]=useState(""),[$,G]=useState(""),[A,X]=useState("all"),[q,U]=useState(false),[fe,Me]=useState(false),[Oe,he]=useState(false),[Ye,We]=useState(false),[et,vt]=useState(false),[Mt,mt]=useState(false),z=useRef(null),ie=useRef(null),ve=useRef(null),Pe=useRef(null),ze=useRef(null),at=useRef(null),Et=useRef(null),Fe=useRef(null),Xt=useRef(null),Ot=useRef(null),Nt=useRef(null),ct=useRef(null);useEffect(()=>{e&&!D?(I({...e}),ye(e.subtasks||[])):e&&D&&e.id!==D.id&&(I({...e}),ye(e.subtasks||[]));},[e,D]),useEffect(()=>{let W=le=>{let Ie=le.target;Pe.current&&!Pe.current.contains(Ie)&&U(false),ze.current&&!ze.current.contains(Ie)&&Me(false),at.current&&!at.current.contains(Ie)&&he(false),Et.current&&!Et.current.contains(Ie)&&We(false);};if(q||fe||Oe||Ye)return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[q,fe,Oe,Ye]),useEffect(()=>{if(!t)return;let W=le=>{let Ie=le.target,Dt=Ie.tagName==="INPUT"||Ie.tagName==="TEXTAREA"||Ie.isContentEditable;if(le.key==="Escape"){le.preventDefault(),q||fe||Oe||Ye||et||Mt?(U(false),Me(false),he(false),We(false),vt(false),mt(false)):Dt||a();return}if(Dt&&le.key!=="Escape")return;let Je=le.metaKey||le.ctrlKey;switch(le.key.toLowerCase()){case "s":le.preventDefault(),U(true);break;case "a":le.preventDefault(),he(true);break;case "p":le.preventDefault(),Me(true);break;case "l":le.preventDefault(),We(true);break;case "d":Je||(le.preventDefault(),vt(true),setTimeout(()=>Fe.current?.focus(),0));break;case "e":Je||(le.preventDefault(),mt(true));break;case "i":le.preventDefault(),Y(true),setTimeout(()=>ie.current?.focus(),0);break;case "t":le.preventDefault(),Se(true);break;case "c":le.preventDefault(),ve.current?.focus();break}};return window.addEventListener("keydown",W),()=>window.removeEventListener("keydown",W)},[t,a,q,fe,Oe,Ye,et,Mt]);let Jt=useCallback(W=>{let le=W.currentTarget.textContent?.trim()||"";if(D&&le!==D.title){let Ie={...D,title:le};I(Ie),r?.(D.id,{title:le});}},[D,r]),Ea=useCallback(W=>{W.key==="Enter"&&(W.preventDefault(),W.currentTarget.blur()),W.key==="Escape"&&(W.preventDefault(),W.currentTarget.textContent=D?.title||"",W.currentTarget.blur());},[D]),oe=useCallback(()=>{D&&e&&D.description!==e.description&&r?.(D.id,{description:D.description}),Y(false);},[D,e,r]),me=useCallback(W=>{if(D){let le={...D,columnId:W};I(le),r?.(D.id,{columnId:W}),U(false);}},[D,r]),pa=useCallback(W=>{if(D){let le={...D,priority:W};I(le),r?.(D.id,{priority:W}),Me(false);}},[D,r]),ya=useCallback(W=>{if(D){let le=D.assignedUserIds||[],Ie=le.includes(W)?le.filter(Je=>Je!==W):[...le,W],Dt={...D,assignedUserIds:Ie};I(Dt),r?.(D.id,{assignedUserIds:Ie});}},[D,r]),N=useCallback(W=>{if(D){let le=D.labels||[],Ie=le.includes(W)?le.filter(Je=>Je!==W):[...le,W],Dt={...D,labels:Ie};I(Dt),r?.(D.id,{labels:Ie});}},[D,r]),ee=useCallback(W=>{if(D){let le={...D,tags:W};I(le),r?.(D.id,{tags:W});}},[D,r]),se=useCallback(W=>{if(D){let le=W.target.value,Ie={...D,endDate:le};I(Ie),r?.(D.id,{endDate:le}),vt(false);}},[D,r]),Te=useCallback(W=>{if(D){let le={...D,estimatedTime:parseFloat(W)||0};I(le),r?.(D.id,{estimatedTime:parseFloat(W)||0});}},[D,r]),$e=useCallback(()=>{if(O.trim()&&D){let W={id:`subtask-${Date.now()}`,title:O.trim(),completed:false,createdAt:new Date},le=[...te,W];ye(le),V(""),Se(false),v?.(D.id,le);}},[O,te,D,v]),tt=useCallback(W=>{let le=te.map(Ie=>Ie.id===W?{...Ie,completed:!Ie.completed,updatedAt:new Date}:Ie);ye(le),D&&v?.(D.id,le);},[te,D,v]),Ge=useCallback(W=>{let le=te.filter(Ie=>Ie.id!==W);ye(le),D&&v?.(D.id,le);},[te,D,v]),Be=useCallback(()=>{$.trim()&&D&&m&&(m(D.id,$.trim()),G(""));},[$,D,m]),rt=useCallback(W=>{(W.metaKey||W.ctrlKey)&&W.key==="Enter"&&(W.preventDefault(),Be());},[Be]),_=W=>jsx(Vu,{remarkPlugins:[ju],rehypePlugins:[Ku],components:{a:({node:le,...Ie})=>jsx("a",{...Ie,target:"_blank",rel:"noopener noreferrer"})},children:W}),ae=p.filter(W=>A==="comments"?W.type.includes("COMMENT"):A==="history"?!W.type.includes("COMMENT"):true);if(!t||!e)return null;let Ee=D||e,Ue=s.filter(W=>Ee.assignedUserIds?.includes(W.id)),He=te.filter(W=>W.completed).length;return jsx(lt,{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":M,children:[jsxs("header",{className:"modal-v2-header",children:[jsx("h1",{id:"modal-title",ref:z,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:Jt,onKeyDown:Ea,children:Ee.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:Pe,children:[jsxs("button",{ref:Xt,className:"modal-v2-field",onClick:()=>U(!q),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:Ee.columnId||"No status"})]}),jsx(Fo,{triggerRef:Xt,isOpen:q,onClose:()=>U(false),width:250,estimatedHeight:200,children:(C.length>0?C:qu.map(W=>({id:W,title:W}))).map(W=>jsx("button",{className:`modal-v2-popover-item ${Ee.columnId===W.id?"active":""}`,onClick:()=>me(W.id),children:W.title},W.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:at,children:[jsxs("button",{ref:Ot,className:"modal-v2-field",onClick:()=>he(!Oe),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsx("span",{children:"Assignees"}),jsx("kbd",{className:"modal-v2-shortcut",children:"A"})]}),jsx("div",{className:"modal-v2-field-value",children:Ue.length>0?jsx("div",{className:"modal-v2-avatars",children:Ue.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(Fo,{triggerRef:Ot,isOpen:Oe,onClose:()=>he(false),width:280,estimatedHeight:300,children:s.map(W=>jsxs("button",{className:`modal-v2-popover-item ${Ee.assignedUserIds?.includes(W.id)?"active":""}`,onClick:()=>ya(W.id),children:[jsx("div",{className:"modal-v2-avatar-small",style:{background:W.color},children:W.initials}),W.name,Ee.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:ze,children:[jsxs("button",{ref:Nt,className:"modal-v2-field",onClick:()=>Me(!fe),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:Ee.priority||"None"})]}),jsxs(Fo,{triggerRef:Nt,isOpen:fe,onClose:()=>Me(false),width:180,estimatedHeight:220,children:[Yu.map(W=>jsx("button",{className:`modal-v2-popover-item priority-${W.toLowerCase()} ${Ee.priority===W?"active":""}`,onClick:()=>pa(W),children:W},W)),jsx("button",{className:"modal-v2-popover-item",onClick:()=>pa(""),children:"None"})]})]}),c.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(nr,{selectedTags:Ee.tags||[],availableTags:c,onChange:ee,onCreateTag:b,theme:qe[M]||qe.dark})})]})}):jsxs("div",{className:"modal-v2-field-wrapper",ref:Et,children:[jsxs("button",{ref:ct,className:"modal-v2-field",onClick:()=>We(!Ye),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:Ee.labels&&Ee.labels.length>0?jsx("span",{children:Ee.labels.join(", ")}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(Fo,{triggerRef:ct,isOpen:Ye,onClose:()=>We(false),width:220,estimatedHeight:200,children:(T.length>0?T:["Bug","Feature","Enhancement","Documentation"]).map(W=>jsxs("button",{className:`modal-v2-popover-item ${Ee.labels?.includes(W)?"active":""}`,onClick:()=>N(W),children:[W,Ee.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:()=>{vt(!et),setTimeout(()=>Fe.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:Ee.endDate?new Date(Ee.endDate).toLocaleDateString():"Not set"}),jsx("input",{ref:Fe,type:"date",value:typeof Ee.endDate=="string"?Ee.endDate.split("T")[0]:Ee.endDate?(()=>{let W=new Date(Ee.endDate),le=W.getUTCFullYear(),Ie=String(W.getUTCMonth()+1).padStart(2,"0"),Dt=String(W.getUTCDate()).padStart(2,"0");return `${le}-${Ie}-${Dt}`})():"",onChange:se,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxs("button",{className:"modal-v2-field",onClick:()=>mt(!Mt),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:Ee.estimatedTime?`${Ee.estimatedTime}h`:"Not set"})]}),Mt&&jsx("div",{className:"modal-v2-popover",children:jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:Ee.estimatedTime||"",onChange:W=>Te(W.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>mt(false)})})]})]}),jsxs("section",{className:"modal-v2-section",children:[jsxs("div",{className:"modal-v2-section-header",children:[jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsx("polyline",{points:"10 9 9 9 8 9"})]}),jsx("h2",{children:"Description"})]}),R?jsx("textarea",{className:"modal-v2-textarea",value:Ee.description||"",onChange:W=>{if(D){let le={...D,description:W.target.value};I(le);}},onBlur:oe,placeholder:"Add a detailed description...",autoFocus:true}):jsx("div",{className:"modal-v2-content",onClick:()=>Y(true),children:Ee.description?jsx("div",{className:"modal-v2-markdown",children:_(Ee.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"}),te.length>0&&jsxs("span",{className:"modal-v2-count",children:[He,"/",te.length]}),jsxs("button",{className:"modal-v2-add-button",onClick:()=>Se(true),children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add"]})]}),jsxs("div",{className:"modal-v2-subtasks",children:[te.map(W=>jsxs("div",{className:`modal-v2-subtask ${W.completed?"completed":""}`,children:[jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>tt(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:()=>Ge(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)),De&&jsx("div",{className:"modal-v2-subtask-input-row",children:jsx("input",{type:"text",placeholder:"Subtask title...",value:O,onChange:W=>V(W.target.value),onKeyDown:W=>{W.key==="Enter"&&$e(),W.key==="Escape"&&(Se(false),V(""));},onBlur:$e,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(k||S.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"}),S.length>0&&jsx("span",{className:"modal-v2-count",children:S.length})]}),jsx(dr,{cardId:Ee.id,attachments:S,onUpload:k?W=>k(Ee.id,W):void 0,onDelete:w,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 ${A==="all"?"active":""}`,onClick:()=>X("all"),children:"All"}),jsx("button",{className:`modal-v2-filter ${A==="comments"?"active":""}`,onClick:()=>X("comments"),children:"Comments"}),jsx("button",{className:`modal-v2-filter ${A==="history"?"active":""}`,onClick:()=>X("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:ve,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:$,onChange:W=>G(W.target.value),onKeyDown:rt,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:Be,disabled:!$.trim(),children:"Send"})]})]})]}),jsxs("div",{className:"modal-v2-timeline",children:[ae.map(W=>{let le=s.find(Dt=>Dt.id===W.userId);if(W.type.includes("COMMENT")){let Dt=n.find(Je=>Je.id===W.metadata?.commentId);return Dt?jsxs("div",{className:"modal-v2-activity-item comment-item",children:[le&&jsx("div",{className:"modal-v2-avatar",style:{background:le.color},children:le.initials}),jsxs("div",{className:"modal-v2-activity-content",children:[jsxs("div",{className:"modal-v2-activity-header",children:[jsx("span",{className:"modal-v2-activity-user",children:le?.name||"Unknown"}),jsx("span",{className:"modal-v2-activity-time",children:new Date(W.timestamp).toLocaleString()})]}),jsx("div",{className:"modal-v2-comment-body",children:Dt.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:le?.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)}),ae.length===0&&jsxs("div",{className:"modal-v2-empty",children:[jsx("p",{children:"No activity yet"}),jsx("span",{children:"Activity will appear here"})]})]})]})]})})})}function og({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 $s({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(n=>({...n,average:n.average??e.reduce((p,m)=>p+m.completed,0)/e.length}));return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:a,children:jsxs(LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(og,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),o&&jsx(Line,{type:"monotone",dataKey:"planned",stroke:"#3B82F6",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#3B82F6",r:4}}),r&&jsx(Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((n,p)=>n+p.completed,0)})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((n,p)=>n+p.completed,0)/e.length).toFixed(1)})]}),o&&e.some(n=>n.planned)&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:e.reduce((n,p)=>n+(p.planned||0),0)})]})]})]})}function ug({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 Os({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),n=e[e.length-1]?.remaining||0,p=e[e.length-1]?.ideal||0,m=s>0?(s-n)/s*100:0,i=n<=p;return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:a,children:jsxs(o?AreaChart:LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(ug,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?jsxs(Fragment,{children:[jsx(Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsx(Area,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",fill:i?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxs(Fragment,{children:[jsx(Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsx(Line,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:i?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxs("span",{className:"chart-stat-value",style:{color:m>=50?"#10B981":"#F59E0B"},children:[m.toFixed(0),"%"]})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsx("span",{className:"chart-stat-value",style:{color:i?"#10B981":"#EF4444"},children:n})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Status"}),jsx("span",{className:"chart-stat-badge",style:{background:i?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:i?"#10B981":"#EF4444"},children:i?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var wg={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},Md=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Cg({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,p=e+n*Math.cos(-a*(Math.PI/180)),m=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsx("text",{x:p,y:m,fill:"white",textAnchor:p>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function Ad({active:e,payload:t}){if(!e||!t||!t.length)return null;let a=t[0].payload,r=t[0].payload.totalValue||0,o=r>0?(a.value/r*100).toFixed(1):"0";return jsxs("div",{className:"chart-tooltip",children:[jsx("p",{className:"chart-tooltip-label",children:a.name}),jsxs("p",{className:"chart-tooltip-value",style:{color:a.color||t[0].color},children:["Count: ",jsx("strong",{children:a.value})]}),jsxs("p",{className:"chart-tooltip-value",style:{color:"rgba(255, 255, 255, 0.7)"},children:["Percentage: ",jsxs("strong",{children:[o,"%"]})]})]})}function zs({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((m,i)=>m+i.value,0),n=e.map(m=>({...m,totalValue:s,color:m.color||wg[m.name]||Md[e.indexOf(m)%Md.length]})),p=n.map(m=>m.color);return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxs(PieChart,{children:[jsx(Pie,{data:n,cx:"50%",cy:"50%",labelLine:false,label:o?Cg:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((m,i)=>jsx(Cell,{fill:p[i]},`cell-${i}`))}),jsx(Tooltip,{content:jsx(Ad,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(m,i)=>{let u=i.payload,d=s>0?(u.value/s*100).toFixed(0):"0";return `${m} (${u.value} - ${d}%)`}})]}):jsxs(BarChart,{data:n,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(Ad,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:n.map((m,i)=>jsx(Cell,{fill:p[i]},`cell-${i}`))})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:s})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Categories"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((m,i)=>i.value>m.value?i:m).name})]})]})]})}var hn=memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,p]=useState(false),[m,i]=useState(false),[u,d]=useState(false),[g,h]=useState(false);if(e.length===0)return null;let C=e.map(x=>x.id),T=x=>{r.onBulkUpdate?.(C,{priority:x}),p(false);},c=x=>{r.onBulkMove?.(C,x),i(false),a();},b=x=>{r.onBulkUpdate?.(C,{assignedUserIds:x}),d(false);},y=x=>{let v=new Set;e.forEach(k=>{k.labels?.forEach(w=>v.add(w));});let S=Array.from(new Set([...v,...x]));r.onBulkUpdate?.(C,{labels:S}),h(false);},l=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(C),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:()=>p(!n),title:"Update priority",children:jsx("span",{className:"text-sm",children:"Priority"})}),n&&jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(x=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>T(x),children:[jsx("span",{className:f("asakaa-priority-dot",x==="LOW"&&"bg-asakaa-priority-low",x==="MEDIUM"&&"bg-asakaa-priority-medium",x==="HIGH"&&"bg-asakaa-priority-high",x==="URGENT"&&"bg-asakaa-priority-urgent")}),x]},x))})]}),o.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!m),title:"Move to column",children:jsx("span",{className:"text-sm",children:"Move"})}),m&&jsx("div",{className:"asakaa-bulk-menu",children:o.map(x=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>c(x.id),children:x.title},x.id))})]}),t.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!u),title:"Assign users",children:jsx("span",{className:"text-sm",children:"Assign"})}),u&&jsx("div",{className:"asakaa-bulk-menu",children:t.map(x=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([x.id]),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:x.color},children:x.initials}),x.name]},x.id))})]}),s.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>h(!g),title:"Add labels",children:jsx("span",{className:"text-sm",children:"Labels"})}),g&&jsx("div",{className:"asakaa-bulk-menu",children:s.map(x=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>y([x]),children:x},x))})]}),jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:l,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"})})]})]})})});hn.displayName="BulkOperationsToolbar";function Eg(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,p,m,i;switch(t){case "assignee":let u=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);u.length>0?u.forEach(h=>{let C=a?.find(T=>T.id===h);n=`assignee-${h}`,p=C?.name||`User ${h}`,m=C?.color,i=C?.avatar,r.has(n)||r.set(n,{id:n,title:p,groupValue:h,cardIds:[],color:m,icon:i}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",p="Unassigned",m="#6b7280",i="\u{1F464}",r.has(n)||r.set(n,{id:n,title:p,groupValue:null,cardIds:[],color:m,icon:i}),r.get(n).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",n=`priority-${s}`;let g={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];p=g.title,m=g.color,r.has(n)||r.set(n,{id:n,title:p,groupValue:s,cardIds:[],color:m}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(h=>{n=`label-${h}`,p=h,m="#6b7280",r.has(n)||r.set(n,{id:n,title:p,groupValue:h,cardIds:[],color:m}),r.get(n).cardIds.push(o.id);}):(n="label-none",p="No Labels",m="#6b7280",r.has(n)||r.set(n,{id:n,title:p,groupValue:null,cardIds:[],color:m}),r.get(n).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function Us({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=useState(new Set),p=useMemo(()=>Eg(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),m=useCallback(i=>{n(u=>{let d=new Set(u);return d.has(i)?d.delete(i):d.add(i),d});},[]);return t.groupBy==="none"||p.length===0?jsx(Er,{board:e,callbacks:r,availableUsers:a,className:o}):jsxs("div",{className:f("asakaa-swimlane-view",o),children:[p.map(i=>{let u=s.has(i.id),d=e.cards.filter(h=>i.cardIds.includes(h.id)),g={...e,cards:d};return jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&m(i.id),style:{borderLeft:i.color?`4px solid ${i.color}`:void 0},children:[jsxs("div",{className:"flex items-center gap-3",children:[i.icon&&jsx("span",{className:"text-2xl leading-none",children:i.icon}),jsx("h3",{className:"text-lg font-semibold",style:{color:i.color},children:i.title}),jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",i.cardIds.length," ",i.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":u?"Expand lane":"Collapse lane",children:u?"\u25B6":"\u25BC"})]}),!u&&jsx("div",{className:"asakaa-swimlane-content p-4",children:jsx(Er,{board:g,callbacks:r,availableUsers:a})})]},i.id)}),p.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 Hs=[{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 Ws({value:e,onChange:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null),p=Hs.find(i=>i.value===e)||Hs[0];useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&n.current&&!n.current.contains(u.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let m=i=>{t(i),o(false);};return jsxs("div",{className:f("relative inline-block",a),children:[jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsx("span",{className:"text-base leading-none",children:p.icon}),jsx("span",{children:p.label}),jsx("svg",{className:f("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:Hs.map(i=>jsxs("button",{onClick:()=>m(i.value),className:f("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===i.value&&"bg-white/5"),children:[jsx("span",{className:"text-xl leading-none mt-0.5",children:i.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"font-semibold text-sm text-white",children:i.label}),e===i.value&&jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsx("p",{className:"text-xs text-white/60 mt-0.5",children:i.description})]})]},i.value))})]})]})}var Lo=[{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 Ag(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(i=>e.key===i||e.code===i))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,n=o.shift?e.shiftKey:!e.shiftKey,p=o.alt?e.altKey:!e.altKey,m=o.meta?e.metaKey:true;return s&&n&&p&&m}function Rd(e={}){let{shortcuts:t=Lo,enabled:a=true,preventDefault:r=true}=e,o=useRef(t),s=useRef(a);useEffect(()=>{o.current=t,s.current=a;},[t,a]);let n=useCallback(m=>{o.current=[...o.current,m];},[]),p=useCallback(m=>{o.current=o.current.filter(i=>i.action!==m);},[]);return useEffect(()=>{function m(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 d of o.current)if(Ag(i,d)){r&&i.preventDefault();let g=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(g);break}}}return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[r]),{registerShortcut:n,unregisterShortcut:p,isEnabled:a}}function Lg(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Ig(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 Bg(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Ig(e),r=t?Lg(t):"";return a?`${a} + ${r}`:r}function Rg(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 Gs({shortcuts:e=Lo,isOpen:t,onClose:a,className:r}){let[o,s]=useState(false);if(useEffect(()=>{s(true);},[]),useEffect(()=>{function p(m){m.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[t,a]),!o||!t)return null;let n=Rg(e);return jsxs("div",{className:f("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: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-3xl w-full mx-4 max-h-[80vh] overflow-hidden",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:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Speed up your workflow with these shortcuts"})]}),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"})]}),jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(n).map(([p,m])=>m.length===0?null:jsxs("div",{children:[jsxs("h3",{className:"text-lg font-semibold text-white/90 mb-4 flex items-center gap-2",children:[jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),p]}),jsx("div",{className:"space-y-3",children:m.map(i=>jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg bg-white/5 hover:bg-white/10 transition-colors",children:[jsx("span",{className:"text-sm text-white/80",children:i.description}),jsx("kbd",{className:"px-3 py-1.5 bg-gradient-to-br from-gray-700 to-gray-800 border border-white/20 rounded-md text-xs font-mono text-white/90 shadow-lg whitespace-nowrap",children:Bg(i)})]},i.action))})]},p))})}),jsx("div",{className:"px-6 py-4 border-t border-white/10 bg-white/5",children:jsxs("p",{className:"text-xs text-white/50 text-center",children:["Press ",jsx("kbd",{className:"px-2 py-0.5 bg-white/10 rounded text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var _s=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
71
+ `,h.onmouseenter=()=>{h.style.opacity="1";},h.onmouseleave=()=>{h.style.opacity="0.5";},h.onclick=C=>{C.stopPropagation();let T=r<a.length-1?r+1:0;i(),o(T);},n.appendChild(d),n.appendChild(g),n.appendChild(h);}n.appendChild(p),n.appendChild(m),document.body.appendChild(n),setTimeout(()=>{m.style.transition="opacity 0.5s ease",m.style.opacity="0";},2e3);}function zu(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 Uu(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 As(e){return e.startsWith("image/")}function dr({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,p]=useState(false),[m,i]=useState(false),[u,d]=useState(null),g=useRef(null),h=useRef(e);h.current=e;let C=useCallback((w,R)=>{R.preventDefault(),R.stopPropagation();let M=h.current.filter(B=>As(B.type)),D=M.findIndex(B=>B.id===w.id),I=B=>{let K=h.current.filter(ie=>As(ie.type)),te=K[B];te&&kd(te.url,te.name,K,B,I);};kd(w.url,w.name,M,D,I);},[]),T=useCallback(w=>{let R=[],M=[];return e.length+w.length>s?(M.push(`Maximum ${s} files allowed`),{valid:R,errors:M}):(w.forEach(D=>{if(D.size/1048576>r){M.push(`${D.name} is too large (max ${r}MB)`);return}if(o&&!o.some(B=>D.type.match(B))){M.push(`${D.name} has invalid file type`);return}R.push(D);}),{valid:R,errors:M})},[e.length,s,r,o]),c=useCallback(async w=>{let{valid:R,errors:M}=T(w);if(M.length>0){d(M.join(", ")),setTimeout(()=>d(null),5e3);return}if(R.length!==0){i(true),d(null);try{await t?.(R);}catch(D){d(D instanceof Error?D.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{i(false);}}},[T,t]),b=useCallback(w=>{w.preventDefault(),w.stopPropagation(),p(true);},[]),y=useCallback(w=>{w.preventDefault(),w.stopPropagation(),p(false);},[]),l=useCallback(w=>{w.preventDefault(),w.stopPropagation();},[]),x=useCallback(w=>{w.preventDefault(),w.stopPropagation(),p(false);let R=Array.from(w.dataTransfer.files);c(R);},[c]),v=useCallback(w=>{let R=w.target.files?Array.from(w.target.files):[];c(R),g.current&&(g.current.value="");},[c]),S=useCallback(()=>{g.current?.click();},[]),k=useCallback(w=>{confirm("Are you sure you want to delete this attachment?")&&a?.(w);},[a]);return jsxs("div",{className:"attachment-uploader",children:[jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${m?"uploading":""}`,onDragEnter:b,onDragLeave:y,onDragOver:l,onDrop:x,onClick:S,children:[jsx("input",{ref:g,type:"file",multiple:true,onChange:v,style:{display:"none"},accept:o?.join(",")}),jsx("div",{className:"attachment-dropzone-content",children:m?jsxs(Fragment,{children:[jsx("div",{className:"attachment-spinner"}),jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxs(Fragment,{children:[jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsx("p",{className:"attachment-dropzone-text",children:n?"Drop files here":"Drag & drop files here"}),jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),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(w=>jsxs("div",{className:"attachment-item",children:[jsx("div",{className:"attachment-preview",children:As(w.type)&&w.url?jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:R=>C(w,R),title:"Click to view full size",children:[jsx("img",{src:w.thumbnailUrl||w.url,alt:w.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:Uu(w.type)})}),jsxs("div",{className:"attachment-info",children:[jsx("a",{href:w.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:w.name,children:w.name}),jsxs("div",{className:"attachment-meta",children:[jsx("span",{className:"attachment-size",children:zu(w.size)}),jsx("span",{className:"attachment-separator",children:"\u2022"}),jsx("span",{className:"attachment-date",children:new Date(w.uploadedAt).toLocaleDateString()})]})]}),jsx("button",{onClick:()=>k(w.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"})})})]},w.id))})]})}function Fs({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:p=[],aiInsights:m=[],attachments:i=[],onAddComment:u,onDeleteComment:d,onUploadAttachments:g,onDeleteAttachment:h,onSuggestAssignee:C,onGenerateSubtasks:T,onEstimateEffort:c,currentUserId:b="user-1"}){let[y,l]=useState("details"),[x,v]=useState(false),[S,k]=useState({}),[w,R]=useState(""),[M,D]=useState(false),[I,B]=useState({});if(!t||!e)return null;let K=useCallback(()=>{v(false),k({}),l("details"),R(""),B({}),a();},[a]),te=useCallback(()=>{r&&Object.keys(S).length>0&&(r(e.id,S),k({}),v(false));},[e.id,S,r]),ie=useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),K());},[e.id,o,K]),de=useCallback(()=>{u&&w.trim()&&(u(e.id,w.trim()),R(""));},[e.id,w,u]),be=useCallback(async()=>{if(C){D(true);try{let A=await C(e);B(Q=>({...Q,assignees:A}));}catch(A){console.error("Failed to suggest assignee:",A);}finally{D(false);}}},[e,C]),$=useCallback(async()=>{if(T){D(true);try{let A=await T(e);B(Q=>({...Q,subtasks:A}));}catch(A){console.error("Failed to generate subtasks:",A);}finally{D(false);}}},[e,T]),J=useCallback(async()=>{if(c){D(true);try{let A=await c(e);B(Q=>({...Q,effort:A}));}catch(A){console.error("Failed to estimate effort:",A);}finally{D(false);}}},[e,c]),U={...e,...S},G=s.filter(A=>U.assignedUserIds?.includes(A.id));return jsx(lt,{children:jsx("div",{className:"card-detail-overlay",onClick:K,children:jsxs("div",{className:"card-detail-modal",onClick:A=>A.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:U.priority==="URGENT"?"#EF4444":U.priority==="HIGH"?"#F59E0B":U.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),x?jsx("input",{type:"text",value:S.title??U.title,onChange:A=>k({...S,title:A.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsx("h2",{className:"card-detail-title",children:U.title})]}),jsxs("div",{className:"card-detail-header-actions",children:[x?jsxs(Fragment,{children:[jsx("button",{onClick:te,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsx("button",{onClick:()=>{v(false),k({});},className:"card-detail-btn",children:"Cancel"})]}):jsxs("button",{onClick:()=>v(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:ie,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:K,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:()=>l("details"),className:`card-detail-tab ${y==="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:()=>l("comments"),className:`card-detail-tab ${y==="comments"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",n.length>0&&jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxs("button",{onClick:()=>l("activity"),className:`card-detail-tab ${y==="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",p.length>0&&jsx("span",{className:"card-detail-tab-badge",children:p.length})]}),jsxs("button",{onClick:()=>l("attachments"),className:`card-detail-tab ${y==="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:()=>l("ai"),className:`card-detail-tab ${y==="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:[y==="details"&&jsxs("div",{className:"card-detail-details",children:[jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Description"}),x?jsx("textarea",{value:S.description??U.description??"",onChange:A=>k({...S,description:A.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsx("p",{className:"card-detail-text",children:U.description||"No description"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Assigned To"}),x?jsx("select",{multiple:true,value:S.assignedUserIds??U.assignedUserIds??[],onChange:A=>{let Q=Array.from(A.target.selectedOptions,X=>X.value);k({...S,assignedUserIds:Q});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(A=>jsx("option",{value:A.id,children:A.name},A.id))}):jsx("div",{className:"card-detail-users",children:G.length>0?G.map(A=>jsxs("div",{className:"card-detail-user",children:[jsx("div",{className:"card-detail-user-avatar",style:{background:A.color},children:A.initials}),jsx("span",{children:A.name})]},A.id)):jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Priority"}),x?jsxs("select",{value:S.priority??U.priority??"",onChange:A=>k({...S,priority:A.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:U.priority==="URGENT"?"#EF4444":U.priority==="HIGH"?"#F59E0B":U.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsx("span",{children:U.priority||"None"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Labels"}),jsx("div",{className:"card-detail-labels",children:U.labels&&U.labels.length>0?U.labels.map(A=>jsx("span",{className:"card-detail-label-tag",children:A},A)):jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxs("div",{className:"card-detail-section-row",children:[jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Start Date"}),x?jsx("input",{type:"date",value:S.startDate?new Date(S.startDate).toISOString().split("T")[0]:U.startDate?new Date(U.startDate).toISOString().split("T")[0]:"",onChange:A=>k({...S,startDate:A.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:U.startDate?new Date(U.startDate).toLocaleDateString():"Not set"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"End Date"}),x?jsx("input",{type:"date",value:S.endDate?new Date(S.endDate).toISOString().split("T")[0]:U.endDate?new Date(U.endDate).toISOString().split("T")[0]:"",onChange:A=>k({...S,endDate:A.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:U.endDate?new Date(U.endDate).toLocaleDateString():"Not set"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),x?jsx("input",{type:"number",min:"0",step:"0.5",value:S.estimatedTime??U.estimatedTime??"",onChange:A=>k({...S,estimatedTime:A.target.value?parseFloat(A.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsx("span",{className:"card-detail-text",children:U.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:U.dependencies&&U.dependencies.length>0?U.dependencies.map(A=>{let Q=typeof A=="string"?A:A.taskId;return jsxs("span",{className:"card-detail-dependency",children:["Card #",Q.slice(-4)]},Q)}):jsx("span",{className:"card-detail-empty",children:"No dependencies"})})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Created"}),jsx("span",{className:"card-detail-text",children:U.createdAt?new Date(U.createdAt).toLocaleString():"Unknown"})]})]}),y==="comments"&&jsxs("div",{className:"card-detail-comments",children:[jsxs("div",{className:"card-detail-comment-form",children:[jsx("textarea",{value:w,onChange:A=>R(A.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsx("button",{onClick:de,disabled:!w.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsx("div",{className:"card-detail-comments-list",children:n.length>0?n.map(A=>{let Q=s.find(X=>X.id===A.authorId);return jsxs("div",{className:"card-detail-comment",children:[jsxs("div",{className:"card-detail-comment-header",children:[jsxs("div",{className:"card-detail-comment-author",children:[Q&&jsx("div",{className:"card-detail-user-avatar",style:{background:Q.color},children:Q.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-comment-author-name",children:Q?.name||"Unknown"}),jsx("div",{className:"card-detail-comment-time",children:new Date(A.createdAt).toLocaleString()})]})]}),d&&jsx("button",{onClick:()=>d(A.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:A.content})]},A.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"})]})})]}),y==="activity"&&jsx("div",{className:"card-detail-activity",children:p.length>0?jsx("div",{className:"card-detail-activity-list",children:p.map(A=>{let Q=s.find(X=>X.id===A.userId);return jsxs("div",{className:"card-detail-activity-item",children:[jsxs("div",{className:"card-detail-activity-icon",children:[A.type.includes("CREATED")&&"\u2795",A.type.includes("UPDATED")&&"\u270F\uFE0F",A.type.includes("MOVED")&&"\u27A1\uFE0F",A.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",A.type.includes("COMMENT")&&"\u{1F4AC}",A.type.includes("ASSIGNED")&&"\u{1F464}",A.type.includes("PRIORITY")&&"\u{1F3AF}",A.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",A.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxs("div",{className:"card-detail-activity-content",children:[jsxs("div",{className:"card-detail-activity-text",children:[jsx("strong",{children:Q?.name||"Unknown"})," ",A.type.replace(/_/g," ").toLowerCase(),A.newValue&&jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsx("strong",{children:A.newValue})]})]}),jsx("div",{className:"card-detail-activity-time",children:new Date(A.timestamp).toLocaleString()})]})]},A.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"})]})}),y==="attachments"&&jsx("div",{className:"card-detail-attachments",children:jsx(dr,{cardId:e.id,attachments:i,onUpload:g?A=>g(e.id,A):void 0,onDelete:h,currentUserId:b,maxSizeMB:10,maxFiles:20})}),y==="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:be,disabled:M||!C,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:$,disabled:M||!T,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:J,disabled:M||!c,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"]})]}),I.assignees&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Assignee Suggestions"}),I.assignees.map((A,Q)=>{let X=s.find(H=>H.id===A.userId);return jsxs("div",{className:"card-detail-ai-suggestion",children:[X&&jsx("div",{className:"card-detail-user-avatar",style:{background:X.color},children:X.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-ai-suggestion-name",children:X?.name}),jsx("div",{className:"card-detail-ai-suggestion-reason",children:A.reasoning}),jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(A.confidence*100).toFixed(0),"%"]})]})]},Q)})]}),I.subtasks&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Suggested Subtasks"}),I.subtasks.map((A,Q)=>jsxs("div",{className:"card-detail-ai-subtask",children:[jsx("div",{className:"card-detail-ai-subtask-title",children:A.title}),A.description&&jsx("div",{className:"card-detail-ai-subtask-desc",children:A.description}),A.estimatedTime&&jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",A.estimatedTime,"h"]})]},Q))]}),I.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:[I.effort.hours," hours"]}),jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(I.effort.confidence*100).toFixed(0),"%"]})]})]}),m.length>0&&jsxs("div",{className:"card-detail-ai-insights",children:[jsx("h4",{children:"AI Insights"}),m.map(A=>jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${A.severity.toLowerCase()}`,children:[jsxs("div",{className:"card-detail-ai-insight-header",children:[jsx("span",{className:"card-detail-ai-insight-title",children:A.title}),jsx("span",{className:"card-detail-ai-insight-severity",children:A.severity})]}),jsx("p",{className:"card-detail-ai-insight-desc",children:A.description}),A.suggestedAction&&jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",A.suggestedAction]})]},A.id))]}),!I.assignees&&!I.subtasks&&!I.effort&&m.length===0&&jsxs("div",{className:"card-detail-empty-state",children:[jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),jsx("p",{children:"AI Suggestions"}),jsx("span",{children:"Click a button above to get AI-powered insights"})]})]})]})]})})})}function Fo({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[p,m]=useState({top:0,left:0}),i=useRef(null),u=useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),g=window.innerHeight,h=window.innerWidth,C=4,T=d.left;T+o>h-10&&(T=h-o-10),T<10&&(T=10);let c=g-d.bottom,b=d.top,y;return c>=s+C?y=d.bottom+C:b>=s+C?y=d.top-s-C:c>=b?y=d.bottom+C:y=Math.max(10,d.top-s-C),{top:y,left:T}},[e,o,s]);return useEffect(()=>{t&&m(u());},[t,u]),useEffect(()=>{if(!t)return;let d=h=>{let C=h.target;i.current&&!i.current.contains(C)&&e.current&&!e.current.contains(C)&&a();},g=setTimeout(()=>{document.addEventListener("mousedown",d);},0);return ()=>{clearTimeout(g),document.removeEventListener("mousedown",d);}},[t,a,e]),useEffect(()=>{if(!t)return;let d=g=>{g.key==="Escape"&&(g.preventDefault(),g.stopPropagation(),a());};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),t?jsx(lt,{children:jsx("div",{ref:i,className:`smart-popover ${n}`,style:{position:"fixed",top:`${p.top}px`,left:`${p.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var qe={dark:{bgPrimary:"#1A1D21",bgSecondary:"#22262D",bgGrid:"#1E2126",bgWeekend:"rgba(59, 130, 246, 0.03)",border:"#334155",borderLight:"#2D3139",textPrimary:"#FFFFFF",textSecondary:"#CBD5E1",textTertiary:"#64748B",accent:"#3B82F6",accentHover:"#60A5FA",accentLight:"rgba(59, 130, 246, 0.12)",taskBarPrimary:"#3B82F6",taskBarProgress:"#2563EB",taskBarHandle:"#FFFFFF",dependency:"#9CA3AF",dependencyHover:"#6B7280",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.12)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.12)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.1)",statusTodo:"#64748B",statusInProgress:"#3B82F6",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.06)",focusRing:"#3B82F6"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(37, 99, 235, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#2563EB",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2563EB",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"#6B7280",dependencyHover:"#4B5563",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.1)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#64748B",statusInProgress:"#2563EB",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2563EB"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"#78716C",dependencyHover:"#57534E",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.06)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.08)",statusTodo:"#78716C",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.035)",focusRing:"#292524"}};var Yu=["LOW","MEDIUM","HIGH","URGENT"],qu=["todo","in-progress","review","done"];function Bs({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:p=[],onAddComment:m,onDeleteComment:i,currentUser:u,onAIGenerateDescription:d,onAICreateSubtasks:g,onAIFindSimilar:h,availableColumns:C=[],availableLabels:T=[],availableTags:c=[],onCreateTag:b,onUploadCoverImage:y,unsplashAccessKey:l,theme:x,onSubtasksChange:v,attachments:S=[],onUploadAttachments:k,onDeleteAttachment:w}){let R=oo(),M=x||R?.themeName||"dark",[D,I]=useState(e),[B,K]=useState(false),[te,ie]=useState(e?.subtasks||[]),[de,be]=useState(false),[$,J]=useState(""),[U,G]=useState(""),[A,Q]=useState("all"),[X,H]=useState(false),[Ce,Me]=useState(false),[Oe,ye]=useState(false),[Ye,We]=useState(false),[et,vt]=useState(false),[Mt,mt]=useState(false),O=useRef(null),le=useRef(null),xe=useRef(null),Pe=useRef(null),ze=useRef(null),at=useRef(null),Et=useRef(null),Fe=useRef(null),Xt=useRef(null),Ot=useRef(null),Nt=useRef(null),ct=useRef(null);useEffect(()=>{e&&!D?(I({...e}),ie(e.subtasks||[])):e&&D&&e.id!==D.id&&(I({...e}),ie(e.subtasks||[]));},[e,D]),useEffect(()=>{let W=ce=>{let Ie=ce.target;Pe.current&&!Pe.current.contains(Ie)&&H(false),ze.current&&!ze.current.contains(Ie)&&Me(false),at.current&&!at.current.contains(Ie)&&ye(false),Et.current&&!Et.current.contains(Ie)&&We(false);};if(X||Ce||Oe||Ye)return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[X,Ce,Oe,Ye]),useEffect(()=>{if(!t)return;let W=ce=>{let Ie=ce.target,Dt=Ie.tagName==="INPUT"||Ie.tagName==="TEXTAREA"||Ie.isContentEditable;if(ce.key==="Escape"){ce.preventDefault(),X||Ce||Oe||Ye||et||Mt?(H(false),Me(false),ye(false),We(false),vt(false),mt(false)):Dt||a();return}if(Dt&&ce.key!=="Escape")return;let Je=ce.metaKey||ce.ctrlKey;switch(ce.key.toLowerCase()){case "s":ce.preventDefault(),H(true);break;case "a":ce.preventDefault(),ye(true);break;case "p":ce.preventDefault(),Me(true);break;case "l":ce.preventDefault(),We(true);break;case "d":Je||(ce.preventDefault(),vt(true),setTimeout(()=>Fe.current?.focus(),0));break;case "e":Je||(ce.preventDefault(),mt(true));break;case "i":ce.preventDefault(),K(true),setTimeout(()=>le.current?.focus(),0);break;case "t":ce.preventDefault(),be(true);break;case "c":ce.preventDefault(),xe.current?.focus();break}};return window.addEventListener("keydown",W),()=>window.removeEventListener("keydown",W)},[t,a,X,Ce,Oe,Ye,et,Mt]);let Jt=useCallback(W=>{let ce=W.currentTarget.textContent?.trim()||"";if(D&&ce!==D.title){let Ie={...D,title:ce};I(Ie),r?.(D.id,{title:ce});}},[D,r]),Ea=useCallback(W=>{W.key==="Enter"&&(W.preventDefault(),W.currentTarget.blur()),W.key==="Escape"&&(W.preventDefault(),W.currentTarget.textContent=D?.title||"",W.currentTarget.blur());},[D]),oe=useCallback(()=>{D&&e&&D.description!==e.description&&r?.(D.id,{description:D.description}),K(false);},[D,e,r]),ue=useCallback(W=>{if(D){let ce={...D,columnId:W};I(ce),r?.(D.id,{columnId:W}),H(false);}},[D,r]),pa=useCallback(W=>{if(D){let ce={...D,priority:W};I(ce),r?.(D.id,{priority:W}),Me(false);}},[D,r]),ya=useCallback(W=>{if(D){let ce=D.assignedUserIds||[],Ie=ce.includes(W)?ce.filter(Je=>Je!==W):[...ce,W],Dt={...D,assignedUserIds:Ie};I(Dt),r?.(D.id,{assignedUserIds:Ie});}},[D,r]),N=useCallback(W=>{if(D){let ce=D.labels||[],Ie=ce.includes(W)?ce.filter(Je=>Je!==W):[...ce,W],Dt={...D,labels:Ie};I(Dt),r?.(D.id,{labels:Ie});}},[D,r]),ee=useCallback(W=>{if(D){let ce={...D,tags:W};I(ce),r?.(D.id,{tags:W});}},[D,r]),se=useCallback(W=>{if(D){let ce=W.target.value,Ie={...D,endDate:ce};I(Ie),r?.(D.id,{endDate:ce}),vt(false);}},[D,r]),De=useCallback(W=>{if(D){let ce={...D,estimatedTime:parseFloat(W)||0};I(ce),r?.(D.id,{estimatedTime:parseFloat(W)||0});}},[D,r]),$e=useCallback(()=>{if($.trim()&&D){let W={id:`subtask-${Date.now()}`,title:$.trim(),completed:false,createdAt:new Date},ce=[...te,W];ie(ce),J(""),be(false),v?.(D.id,ce);}},[$,te,D,v]),tt=useCallback(W=>{let ce=te.map(Ie=>Ie.id===W?{...Ie,completed:!Ie.completed,updatedAt:new Date}:Ie);ie(ce),D&&v?.(D.id,ce);},[te,D,v]),Ge=useCallback(W=>{let ce=te.filter(Ie=>Ie.id!==W);ie(ce),D&&v?.(D.id,ce);},[te,D,v]),Be=useCallback(()=>{U.trim()&&D&&m&&(m(D.id,U.trim()),G(""));},[U,D,m]),rt=useCallback(W=>{(W.metaKey||W.ctrlKey)&&W.key==="Enter"&&(W.preventDefault(),Be());},[Be]),_=W=>jsx(Vu,{remarkPlugins:[ju],rehypePlugins:[Ku],components:{a:({node:ce,...Ie})=>jsx("a",{...Ie,target:"_blank",rel:"noopener noreferrer"})},children:W}),ae=p.filter(W=>A==="comments"?W.type.includes("COMMENT"):A==="history"?!W.type.includes("COMMENT"):true);if(!t||!e)return null;let Ee=D||e,Ue=s.filter(W=>Ee.assignedUserIds?.includes(W.id)),He=te.filter(W=>W.completed).length;return jsx(lt,{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":M,children:[jsxs("header",{className:"modal-v2-header",children:[jsx("h1",{id:"modal-title",ref:O,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:Jt,onKeyDown:Ea,children:Ee.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:Pe,children:[jsxs("button",{ref:Xt,className:"modal-v2-field",onClick:()=>H(!X),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:Ee.columnId||"No status"})]}),jsx(Fo,{triggerRef:Xt,isOpen:X,onClose:()=>H(false),width:250,estimatedHeight:200,children:(C.length>0?C:qu.map(W=>({id:W,title:W}))).map(W=>jsx("button",{className:`modal-v2-popover-item ${Ee.columnId===W.id?"active":""}`,onClick:()=>ue(W.id),children:W.title},W.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:at,children:[jsxs("button",{ref:Ot,className:"modal-v2-field",onClick:()=>ye(!Oe),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsx("span",{children:"Assignees"}),jsx("kbd",{className:"modal-v2-shortcut",children:"A"})]}),jsx("div",{className:"modal-v2-field-value",children:Ue.length>0?jsx("div",{className:"modal-v2-avatars",children:Ue.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(Fo,{triggerRef:Ot,isOpen:Oe,onClose:()=>ye(false),width:280,estimatedHeight:300,children:s.map(W=>jsxs("button",{className:`modal-v2-popover-item ${Ee.assignedUserIds?.includes(W.id)?"active":""}`,onClick:()=>ya(W.id),children:[jsx("div",{className:"modal-v2-avatar-small",style:{background:W.color},children:W.initials}),W.name,Ee.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:ze,children:[jsxs("button",{ref:Nt,className:"modal-v2-field",onClick:()=>Me(!Ce),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:Ee.priority||"None"})]}),jsxs(Fo,{triggerRef:Nt,isOpen:Ce,onClose:()=>Me(false),width:180,estimatedHeight:220,children:[Yu.map(W=>jsx("button",{className:`modal-v2-popover-item priority-${W.toLowerCase()} ${Ee.priority===W?"active":""}`,onClick:()=>pa(W),children:W},W)),jsx("button",{className:"modal-v2-popover-item",onClick:()=>pa(""),children:"None"})]})]}),c.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(nr,{selectedTags:Ee.tags||[],availableTags:c,onChange:ee,onCreateTag:b,theme:qe[M]||qe.dark})})]})}):jsxs("div",{className:"modal-v2-field-wrapper",ref:Et,children:[jsxs("button",{ref:ct,className:"modal-v2-field",onClick:()=>We(!Ye),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:Ee.labels&&Ee.labels.length>0?jsx("span",{children:Ee.labels.join(", ")}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(Fo,{triggerRef:ct,isOpen:Ye,onClose:()=>We(false),width:220,estimatedHeight:200,children:(T.length>0?T:["Bug","Feature","Enhancement","Documentation"]).map(W=>jsxs("button",{className:`modal-v2-popover-item ${Ee.labels?.includes(W)?"active":""}`,onClick:()=>N(W),children:[W,Ee.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:()=>{vt(!et),setTimeout(()=>Fe.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:Ee.endDate?new Date(Ee.endDate).toLocaleDateString():"Not set"}),jsx("input",{ref:Fe,type:"date",value:typeof Ee.endDate=="string"?Ee.endDate.split("T")[0]:Ee.endDate?(()=>{let W=new Date(Ee.endDate),ce=W.getUTCFullYear(),Ie=String(W.getUTCMonth()+1).padStart(2,"0"),Dt=String(W.getUTCDate()).padStart(2,"0");return `${ce}-${Ie}-${Dt}`})():"",onChange:se,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxs("button",{className:"modal-v2-field",onClick:()=>mt(!Mt),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:Ee.estimatedTime?`${Ee.estimatedTime}h`:"Not set"})]}),Mt&&jsx("div",{className:"modal-v2-popover",children:jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:Ee.estimatedTime||"",onChange:W=>De(W.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>mt(false)})})]})]}),jsxs("section",{className:"modal-v2-section",children:[jsxs("div",{className:"modal-v2-section-header",children:[jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsx("polyline",{points:"10 9 9 9 8 9"})]}),jsx("h2",{children:"Description"})]}),B?jsx("textarea",{className:"modal-v2-textarea",value:Ee.description||"",onChange:W=>{if(D){let ce={...D,description:W.target.value};I(ce);}},onBlur:oe,placeholder:"Add a detailed description...",autoFocus:true}):jsx("div",{className:"modal-v2-content",onClick:()=>K(true),children:Ee.description?jsx("div",{className:"modal-v2-markdown",children:_(Ee.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"}),te.length>0&&jsxs("span",{className:"modal-v2-count",children:[He,"/",te.length]}),jsxs("button",{className:"modal-v2-add-button",onClick:()=>be(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:[te.map(W=>jsxs("div",{className:`modal-v2-subtask ${W.completed?"completed":""}`,children:[jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>tt(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:()=>Ge(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)),de&&jsx("div",{className:"modal-v2-subtask-input-row",children:jsx("input",{type:"text",placeholder:"Subtask title...",value:$,onChange:W=>J(W.target.value),onKeyDown:W=>{W.key==="Enter"&&$e(),W.key==="Escape"&&(be(false),J(""));},onBlur:$e,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(k||S.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"}),S.length>0&&jsx("span",{className:"modal-v2-count",children:S.length})]}),jsx(dr,{cardId:Ee.id,attachments:S,onUpload:k?W=>k(Ee.id,W):void 0,onDelete:w,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 ${A==="all"?"active":""}`,onClick:()=>Q("all"),children:"All"}),jsx("button",{className:`modal-v2-filter ${A==="comments"?"active":""}`,onClick:()=>Q("comments"),children:"Comments"}),jsx("button",{className:`modal-v2-filter ${A==="history"?"active":""}`,onClick:()=>Q("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:xe,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:U,onChange:W=>G(W.target.value),onKeyDown:rt,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:Be,disabled:!U.trim(),children:"Send"})]})]})]}),jsxs("div",{className:"modal-v2-timeline",children:[ae.map(W=>{let ce=s.find(Dt=>Dt.id===W.userId);if(W.type.includes("COMMENT")){let Dt=n.find(Je=>Je.id===W.metadata?.commentId);return Dt?jsxs("div",{className:"modal-v2-activity-item comment-item",children:[ce&&jsx("div",{className:"modal-v2-avatar",style:{background:ce.color},children:ce.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:ce?.name||"Unknown"}),jsx("span",{className:"modal-v2-activity-time",children:new Date(W.timestamp).toLocaleString()})]}),jsx("div",{className:"modal-v2-comment-body",children:Dt.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:ce?.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)}),ae.length===0&&jsxs("div",{className:"modal-v2-empty",children:[jsx("p",{children:"No activity yet"}),jsx("span",{children:"Activity will appear here"})]})]})]})]})})})}function og({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 $s({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(n=>({...n,average:n.average??e.reduce((p,m)=>p+m.completed,0)/e.length}));return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:a,children:jsxs(LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(og,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),o&&jsx(Line,{type:"monotone",dataKey:"planned",stroke:"#3B82F6",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#3B82F6",r:4}}),r&&jsx(Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((n,p)=>n+p.completed,0)})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((n,p)=>n+p.completed,0)/e.length).toFixed(1)})]}),o&&e.some(n=>n.planned)&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:e.reduce((n,p)=>n+(p.planned||0),0)})]})]})]})}function ug({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 Os({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),n=e[e.length-1]?.remaining||0,p=e[e.length-1]?.ideal||0,m=s>0?(s-n)/s*100:0,i=n<=p;return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:a,children:jsxs(o?AreaChart:LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(ug,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?jsxs(Fragment,{children:[jsx(Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsx(Area,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",fill:i?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxs(Fragment,{children:[jsx(Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsx(Line,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:i?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxs("span",{className:"chart-stat-value",style:{color:m>=50?"#10B981":"#F59E0B"},children:[m.toFixed(0),"%"]})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsx("span",{className:"chart-stat-value",style:{color:i?"#10B981":"#EF4444"},children:n})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Status"}),jsx("span",{className:"chart-stat-badge",style:{background:i?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:i?"#10B981":"#EF4444"},children:i?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var wg={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},Md=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Cg({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,p=e+n*Math.cos(-a*(Math.PI/180)),m=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsx("text",{x:p,y:m,fill:"white",textAnchor:p>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function Ad({active:e,payload:t}){if(!e||!t||!t.length)return null;let a=t[0].payload,r=t[0].payload.totalValue||0,o=r>0?(a.value/r*100).toFixed(1):"0";return jsxs("div",{className:"chart-tooltip",children:[jsx("p",{className:"chart-tooltip-label",children:a.name}),jsxs("p",{className:"chart-tooltip-value",style:{color:a.color||t[0].color},children:["Count: ",jsx("strong",{children:a.value})]}),jsxs("p",{className:"chart-tooltip-value",style:{color:"rgba(255, 255, 255, 0.7)"},children:["Percentage: ",jsxs("strong",{children:[o,"%"]})]})]})}function zs({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((m,i)=>m+i.value,0),n=e.map(m=>({...m,totalValue:s,color:m.color||wg[m.name]||Md[e.indexOf(m)%Md.length]})),p=n.map(m=>m.color);return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxs(PieChart,{children:[jsx(Pie,{data:n,cx:"50%",cy:"50%",labelLine:false,label:o?Cg:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((m,i)=>jsx(Cell,{fill:p[i]},`cell-${i}`))}),jsx(Tooltip,{content:jsx(Ad,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(m,i)=>{let u=i.payload,d=s>0?(u.value/s*100).toFixed(0):"0";return `${m} (${u.value} - ${d}%)`}})]}):jsxs(BarChart,{data:n,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(Ad,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:n.map((m,i)=>jsx(Cell,{fill:p[i]},`cell-${i}`))})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:s})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Categories"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((m,i)=>i.value>m.value?i:m).name})]})]})]})}var hn=memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,p]=useState(false),[m,i]=useState(false),[u,d]=useState(false),[g,h]=useState(false);if(e.length===0)return null;let C=e.map(x=>x.id),T=x=>{r.onBulkUpdate?.(C,{priority:x}),p(false);},c=x=>{r.onBulkMove?.(C,x),i(false),a();},b=x=>{r.onBulkUpdate?.(C,{assignedUserIds:x}),d(false);},y=x=>{let v=new Set;e.forEach(k=>{k.labels?.forEach(w=>v.add(w));});let S=Array.from(new Set([...v,...x]));r.onBulkUpdate?.(C,{labels:S}),h(false);},l=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(C),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:()=>p(!n),title:"Update priority",children:jsx("span",{className:"text-sm",children:"Priority"})}),n&&jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(x=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>T(x),children:[jsx("span",{className:f("asakaa-priority-dot",x==="LOW"&&"bg-asakaa-priority-low",x==="MEDIUM"&&"bg-asakaa-priority-medium",x==="HIGH"&&"bg-asakaa-priority-high",x==="URGENT"&&"bg-asakaa-priority-urgent")}),x]},x))})]}),o.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!m),title:"Move to column",children:jsx("span",{className:"text-sm",children:"Move"})}),m&&jsx("div",{className:"asakaa-bulk-menu",children:o.map(x=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>c(x.id),children:x.title},x.id))})]}),t.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!u),title:"Assign users",children:jsx("span",{className:"text-sm",children:"Assign"})}),u&&jsx("div",{className:"asakaa-bulk-menu",children:t.map(x=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([x.id]),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:x.color},children:x.initials}),x.name]},x.id))})]}),s.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>h(!g),title:"Add labels",children:jsx("span",{className:"text-sm",children:"Labels"})}),g&&jsx("div",{className:"asakaa-bulk-menu",children:s.map(x=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>y([x]),children:x},x))})]}),jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:l,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"})})]})]})})});hn.displayName="BulkOperationsToolbar";function Eg(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,p,m,i;switch(t){case "assignee":let u=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);u.length>0?u.forEach(h=>{let C=a?.find(T=>T.id===h);n=`assignee-${h}`,p=C?.name||`User ${h}`,m=C?.color,i=C?.avatar,r.has(n)||r.set(n,{id:n,title:p,groupValue:h,cardIds:[],color:m,icon:i}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",p="Unassigned",m="#6b7280",i="\u{1F464}",r.has(n)||r.set(n,{id:n,title:p,groupValue:null,cardIds:[],color:m,icon:i}),r.get(n).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",n=`priority-${s}`;let g={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];p=g.title,m=g.color,r.has(n)||r.set(n,{id:n,title:p,groupValue:s,cardIds:[],color:m}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(h=>{n=`label-${h}`,p=h,m="#6b7280",r.has(n)||r.set(n,{id:n,title:p,groupValue:h,cardIds:[],color:m}),r.get(n).cardIds.push(o.id);}):(n="label-none",p="No Labels",m="#6b7280",r.has(n)||r.set(n,{id:n,title:p,groupValue:null,cardIds:[],color:m}),r.get(n).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function Us({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=useState(new Set),p=useMemo(()=>Eg(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),m=useCallback(i=>{n(u=>{let d=new Set(u);return d.has(i)?d.delete(i):d.add(i),d});},[]);return t.groupBy==="none"||p.length===0?jsx(Er,{board:e,callbacks:r,availableUsers:a,className:o}):jsxs("div",{className:f("asakaa-swimlane-view",o),children:[p.map(i=>{let u=s.has(i.id),d=e.cards.filter(h=>i.cardIds.includes(h.id)),g={...e,cards:d};return jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&m(i.id),style:{borderLeft:i.color?`4px solid ${i.color}`:void 0},children:[jsxs("div",{className:"flex items-center gap-3",children:[i.icon&&jsx("span",{className:"text-2xl leading-none",children:i.icon}),jsx("h3",{className:"text-lg font-semibold",style:{color:i.color},children:i.title}),jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",i.cardIds.length," ",i.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":u?"Expand lane":"Collapse lane",children:u?"\u25B6":"\u25BC"})]}),!u&&jsx("div",{className:"asakaa-swimlane-content p-4",children:jsx(Er,{board:g,callbacks:r,availableUsers:a})})]},i.id)}),p.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 Hs=[{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 Ws({value:e,onChange:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null),p=Hs.find(i=>i.value===e)||Hs[0];useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&n.current&&!n.current.contains(u.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let m=i=>{t(i),o(false);};return jsxs("div",{className:f("relative inline-block",a),children:[jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsx("span",{className:"text-base leading-none",children:p.icon}),jsx("span",{children:p.label}),jsx("svg",{className:f("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:Hs.map(i=>jsxs("button",{onClick:()=>m(i.value),className:f("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===i.value&&"bg-white/5"),children:[jsx("span",{className:"text-xl leading-none mt-0.5",children:i.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"font-semibold text-sm text-white",children:i.label}),e===i.value&&jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsx("p",{className:"text-xs text-white/60 mt-0.5",children:i.description})]})]},i.value))})]})]})}var Lo=[{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 Ag(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(i=>e.key===i||e.code===i))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,n=o.shift?e.shiftKey:!e.shiftKey,p=o.alt?e.altKey:!e.altKey,m=o.meta?e.metaKey:true;return s&&n&&p&&m}function Rd(e={}){let{shortcuts:t=Lo,enabled:a=true,preventDefault:r=true}=e,o=useRef(t),s=useRef(a);useEffect(()=>{o.current=t,s.current=a;},[t,a]);let n=useCallback(m=>{o.current=[...o.current,m];},[]),p=useCallback(m=>{o.current=o.current.filter(i=>i.action!==m);},[]);return useEffect(()=>{function m(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 d of o.current)if(Ag(i,d)){r&&i.preventDefault();let g=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(g);break}}}return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[r]),{registerShortcut:n,unregisterShortcut:p,isEnabled:a}}function Lg(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Ig(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 Bg(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Ig(e),r=t?Lg(t):"";return a?`${a} + ${r}`:r}function Rg(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 Gs({shortcuts:e=Lo,isOpen:t,onClose:a,className:r}){let[o,s]=useState(false);if(useEffect(()=>{s(true);},[]),useEffect(()=>{function p(m){m.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[t,a]),!o||!t)return null;let n=Rg(e);return jsxs("div",{className:f("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: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-3xl w-full mx-4 max-h-[80vh] overflow-hidden",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:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Speed up your workflow with these shortcuts"})]}),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"})]}),jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(n).map(([p,m])=>m.length===0?null:jsxs("div",{children:[jsxs("h3",{className:"text-lg font-semibold text-white/90 mb-4 flex items-center gap-2",children:[jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),p]}),jsx("div",{className:"space-y-3",children:m.map(i=>jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg bg-white/5 hover:bg-white/10 transition-colors",children:[jsx("span",{className:"text-sm text-white/80",children:i.description}),jsx("kbd",{className:"px-3 py-1.5 bg-gradient-to-br from-gray-700 to-gray-800 border border-white/20 rounded-md text-xs font-mono text-white/90 shadow-lg whitespace-nowrap",children:Bg(i)})]},i.action))})]},p))})}),jsx("div",{className:"px-6 py-4 border-t border-white/10 bg-white/5",children:jsxs("p",{className:"text-xs text-white/50 text-center",children:["Press ",jsx("kbd",{className:"px-2 py-0.5 bg-white/10 rounded text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var _s=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
72
72
  1.
73
73
 
74
74
  **Expected behavior:**
@@ -108,8 +108,8 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
108
108
  1.
109
109
 
110
110
  **Action items:**
111
- - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Vs({templates:e,onSelectTemplate:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null);useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&n.current&&!n.current.contains(u.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let p=i=>{t(i),o(false);},m=e.reduce((i,u)=>{let d=u.category||"Other";return i[d]||(i[d]=[]),i[d].push(u),i},{});return jsxs("div",{className:f("relative inline-block",a),children:[jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsx("span",{children:"Templates"}),jsx("svg",{className:f("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(m).map(([i,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(d=>jsxs("button",{onClick:()=>p(d),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{className:"text-2xl leading-none mt-0.5",children:d.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:d.name}),d.description&&jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:d.description})]})]},d.id))})]},i)),e.length===0&&jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function Ks({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,p]=useState("export"),[m,i]=useState("json"),[u,d]=useState(null),g=useRef(null);if(!t)return null;let h=async()=>{let T=o?.current||void 0,c=await Sl(e,m,T);El(c,m);},C=async T=>{let c=T.target.files?.[0];if(c){try{let b=await Al(c),y=c.name.endsWith(".json")?"json":"csv",l=Ml(b,y);d(l),l.success&&r&&r(l,b);}catch(b){d({success:false,errors:[`Failed to read file: ${b instanceof Error?b.message:"Unknown error"}`]});}g.current&&(g.current.value="");}};return jsxs("div",{className:f("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:()=>p("export"),className:f("flex-1 px-6 py-4 font-semibold transition-colors",n==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsx("button",{onClick:()=>p("import"),className:f("flex-1 px-6 py-4 font-semibold transition-colors",n==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxs("div",{className:"p-6",children:[n==="export"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(T=>jsxs("button",{onClick:()=>i(T),className:f("p-4 rounded-lg border-2 transition-all text-center",m===T?"border-blue-500 bg-blue-500/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxs("div",{className:"text-2xl mb-2",children:[T==="json"&&"\u{1F4C4}",T==="csv"&&"\u{1F4CA}",T==="pdf"&&"\u{1F4DD}"]}),jsx("div",{className:"font-semibold uppercase text-xs",children:T})]},T))})]}),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:h,className:"w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600 text-white font-semibold rounded-lg transition-all shadow-lg shadow-blue-500/20",children:"Export Board"})]}),n==="import"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsx("input",{ref:g,type:"file",accept:".json,.csv",onChange:C,className:"hidden"}),jsxs("button",{onClick:()=>g.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:f("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:f("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((T,c)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",T]},c))})]})]})]})]})]})}var Hg=["URGENT","HIGH","MEDIUM","LOW"],Wg=[{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"}],Gg=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Ys({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:p,availableUsers:m=[],availableLabels:i=[],availableColumns:u=[],showQuickFilters:d=true,compact:g=false,groupBy:h="none",onGroupByChange:C}){let[T,c]=useState(true),b=useCallback(S=>{a({search:S.target.value});},[a]),y=useCallback(S=>{a({dateFilter:S.target.value});},[a]),l=useCallback(S=>{r({by:S.target.value});},[r]),x=useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),v=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 ${g?"filter-bar--compact":""} ${T?"filter-bar--collapsed":""}`,children:[jsxs("div",{className:"filter-bar__header",onClick:()=>c(!T),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:T?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:S=>{S.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:S=>{S.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:T?"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"}),v&&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)"]})]}),!T&&jsxs("div",{className:"filter-bar__content",children:[d&&jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),n&&jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),p&&jsx("button",{onClick:p,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxs("div",{className:"filter-bar__main",children:[jsx("div",{className:"filter-bar__field",children:jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:b,className:"filter-bar__search"})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.dateFilter,onChange:y,className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Dates"}),jsx("option",{value:"overdue",children:"Overdue"}),jsx("option",{value:"today",children:"Today"}),jsx("option",{value:"this-week",children:"This Week"})]})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.priorities[0]||"all",onChange:S=>{let k=S.target.value;a({priorities:k==="all"?[]:[k]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Priorities"}),Hg.map(S=>jsx("option",{value:S,children:S},S))]})}),m.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.assignees[0]||"all",onChange:S=>{let k=S.target.value;a({assignees:k==="all"?[]:[k]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Assignees"}),m.map(S=>jsx("option",{value:S.id,children:S.name},S.id))]})}),i.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.labels[0]||"all",onChange:S=>{let k=S.target.value;a({labels:k==="all"?[]:[k]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Labels"}),i.map(S=>jsx("option",{value:S,children:S},S))]})}),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:l,className:"filter-bar__select filter-bar__select--sm",children:Wg.map(S=>jsx("option",{value:S.value,children:S.label},S.value))}),t.by!=="none"&&jsx("button",{onClick:x,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),C&&jsx("div",{className:"filter-bar__field",children:jsx("select",{value:h,onChange:S=>C(S.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Gg.map(S=>jsx("option",{value:S.value,children:S.label},S.value))})}),v&&jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function qs({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:p,onExportGanttCSV:m}){let[i,u]=useState(false),d=useRef(null);useEffect(()=>{let h=C=>{d.current&&!d.current.contains(C.target)&&u(false);};return i&&document.addEventListener("mousedown",h),()=>{document.removeEventListener("mousedown",h);}},[i]);let g=h=>{h(),u(false);};return jsxs("div",{className:f("relative",r),ref:d,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:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",h.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",h.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":i,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"3"}),jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsx("span",{children:"Config"})]}),i&&jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxs("button",{onClick:()=>g(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:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.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:()=>g(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:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.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:()=>g(async()=>await n?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.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:()=>g(async()=>await p?.()),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:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.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:()=>g(()=>m?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.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:()=>g(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:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.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:()=>g(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:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.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 Xs={name:"dark",displayName:"Dark (Enhanced)",emoji:"\u{1F319}",colors:{bgPrimary:"#222326",bgSecondary:"#2A2B2F",bgTertiary:"#33343A",bgCard:"#2d2d2d",bgHover:"#353535",bgActive:"#404040",bgInput:"#2a2a2a",textPrimary:"#F4F5F8",textSecondary:"#AEB6C0",textTertiary:"#7A7F8A",textDisabled:"#606060",textInverse:"#1a1a1a",borderPrimary:"rgba(255, 255, 255, 0.1)",borderSecondary:"rgba(255, 255, 255, 0.05)",borderDefault:"#404040",borderHover:"#505050",borderSubtle:"#2a2a2a",accentPrimary:"#5E6AD2",accentHover:"#7780DD",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.1)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.2)",success:"#10B981",warning:"#F59E0B",error:"#EF4444",info:"#3B82F6",danger:"#ef4444",dangerBorder:"rgba(239, 68, 68, 0.3)",dangerBackground:"rgba(239, 68, 68, 0.1)",dangerBackgroundHover:"rgba(239, 68, 68, 0.2)"},shadows:{sm:"0 1px 2px rgba(0, 0, 0, 0.3)",md:"0 4px 12px rgba(0, 0, 0, 0.4)",lg:"0 12px 32px rgba(0, 0, 0, 0.5)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},Js={name:"light",displayName:"Light (Standard)",emoji:"\u2600\uFE0F",colors:{bgPrimary:"#FFFFFF",bgSecondary:"#F7F7F8",bgTertiary:"#EEEFF1",bgCard:"#ffffff",bgHover:"#f3f4f6",bgActive:"#e5e7eb",bgInput:"#f9fafb",textPrimary:"#1A1A1A",textSecondary:"#5A5A5A",textTertiary:"#8A8A8A",textDisabled:"#d1d5db",textInverse:"#ffffff",borderPrimary:"rgba(0, 0, 0, 0.1)",borderSecondary:"rgba(0, 0, 0, 0.05)",borderDefault:"#e5e7eb",borderHover:"#d1d5db",borderSubtle:"#f3f4f6",accentPrimary:"#5E6AD2",accentHover:"#4A56B8",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.08)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.15)",success:"#059669",warning:"#D97706",error:"#DC2626",info:"#2563EB",danger:"#dc2626",dangerBorder:"rgba(220, 38, 38, 0.3)",dangerBackground:"rgba(220, 38, 38, 0.08)",dangerBackgroundHover:"rgba(220, 38, 38, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.12)",md:"0 4px 12px rgba(0, 0, 0, 0.15)",lg:"0 12px 32px rgba(0, 0, 0, 0.2)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},Qs={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"}},Kr={dark:Xs,light:Js,neutral:Qs},yn="dark";var vn=createContext(void 0),Zg="asakaa-theme";function zd({children:e,defaultTheme:t=yn,storageKey:a=Zg}){let[r,o]=useState(()=>{if(typeof window<"u"){let p=localStorage.getItem(a);if(p&&(p==="dark"||p==="light"||p==="neutral"))return p}return t}),s=useCallback(p=>{o(p),typeof window<"u"&&localStorage.setItem(a,p);},[a]);useEffect(()=>{if(typeof window>"u")return;let p=document.documentElement,m=Kr[r];Object.entries(m.colors).forEach(([u,d])=>{d&&p.style.setProperty(`--theme-${ef(u)}`,d);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([u,d])=>{let g=m.colors[u];g&&p.style.setProperty(d,g);}),p.setAttribute("data-theme",r),p.classList.remove("theme-dark","theme-light","theme-neutral"),p.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:Kr};return jsx(vn.Provider,{value:n,children:e})}function go(){let e=useContext(vn);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function ef(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Zs({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=go();return e?jsxs("div",{className:f("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(Kr).map(([s,n])=>jsxs("button",{onClick:()=>{o(s),t();},className:f("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsx("div",{className:"text-3xl",children:n.emoji}),jsxs("div",{className:"text-left flex-1",children:[jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:n.displayName}),jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),r===s&&jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}function Ud(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return qe[e]||qe.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",qe[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",qe[e].bgSecondary),bgGrid:r("--theme-bg-card",qe[e].bgGrid),bgWeekend:r("--theme-bg-hover",qe[e].bgWeekend),border:r("--theme-border-primary",qe[e].border),borderLight:r("--theme-border-subtle",qe[e].borderLight),textPrimary:r("--theme-text-primary",qe[e].textPrimary),textSecondary:r("--theme-text-secondary",qe[e].textSecondary),textTertiary:r("--theme-text-tertiary",qe[e].textTertiary),accent:r("--theme-accent-primary",qe[e].accent),accentHover:r("--theme-accent-hover",qe[e].accentHover),accentLight:r("--theme-accent-primary",qe[e].accentLight),taskBarPrimary:r("--theme-accent-primary",qe[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",qe[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",qe[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",qe[e].dependency),dependencyHover:r("--theme-border-secondary",qe[e].dependencyHover),criticalPath:r("--theme-error",qe[e].criticalPath),criticalPathLight:r("--theme-error",qe[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",qe[e].today):e==="neutral"?r("--theme-text-primary",qe[e].today):r("--theme-error",qe[e].today),todayLight:e==="light"?r("--theme-accent-primary",qe[e].todayLight):e==="neutral"?r("--theme-text-primary",qe[e].todayLight):r("--theme-error",qe[e].todayLight),milestone:r("--theme-warning",qe[e].milestone),milestoneLight:r("--theme-warning",qe[e].milestoneLight),statusTodo:r("--theme-text-tertiary",qe[e].statusTodo),statusInProgress:r("--theme-accent-primary",qe[e].statusInProgress),statusCompleted:r("--theme-success",qe[e].statusCompleted),hoverBg:r("--theme-bg-hover",qe[e].hoverBg),focusRing:r("--theme-accent-primary",qe[e].focusRing)}}var xn={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:"Filter",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"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",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"},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"}},Hd={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:"Filtrar",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"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",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"},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"}},ei={en:xn,es:Hd};function Wd(e){return ei[e]||ei.en}function ti(e,t){let a=Wd(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 ho=createContext(xn);function bo(){return useContext(ho)}function bf({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[p,m]=useState(false),[i,u]=useState(null),d=useRef(null),g=bo();if(useEffect(()=>{let c=b=>{d.current&&!d.current.contains(b.target)&&m(false);};return p&&document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[p]),!(t||a||r||o||s||n))return null;let C=[{id:"png",label:"PNG",description:"Image",icon:jsx(FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsx(FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsx(FolderKanban,{className:"w-4 h-4"}),handler:n}].filter(c=>c.handler),T=async(c,b)=>{if(b){u(c);try{await b();}catch(y){console.error(`Export ${c} failed:`,y);}finally{u(null),m(false);}}};return jsxs("div",{ref:d,className:"relative",children:[jsxs(motion.button,{onClick:()=>m(!p),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:p?e.accent:e.bgSecondary,border:`1px solid ${p?e.accent:e.borderLight}`,color:p?"#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:p?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:p&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsx("div",{className:"py-1",children:C.map((c,b)=>jsxs(motion.button,{onClick:()=>T(c.id,c.handler),disabled:i!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:b<C.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:b*.03},children:[jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===c.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-4 h-4"})}):c.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:c.label}),jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:c.description})]})]},c.id))})})})]})}function yf({options:e,value:t,onChange:a,theme:r,layoutId:o="activeSegment"}){return jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(s=>{let n=t===s.value;return jsxs(motion.button,{onClick:()=>a(s.value),className:"relative px-3 py-1.5 rounded-md text-xs transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:n?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:n?600:500,zIndex:n?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[n&&jsx(motion.div,{layoutId:o,className:"absolute inset-0 rounded-md",style:{backgroundColor:r.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.icon}),jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function vf({options:e,value:t,onChange:a,theme:r}){return jsx("div",{className:"inline-flex items-center gap-1",children:e.map(o=>{let s=t===o.value;return jsxs(motion.button,{onClick:()=>a(o.value),className:"relative px-3 py-1.5 text-xs transition-all",style:{color:s?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsx("span",{children:o.label}),s&&jsx(motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:r.accent},transition:{type:"spring",stiffness:400,damping:30}})]},o.value)})})}function xf({theme:e,value:t,onChange:a}){let[r,o]=useState(false),s=useRef(null),n=bo();useEffect(()=>{let i=u=>{s.current&&!s.current.contains(u.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let p=[{value:"compact",label:n.toolbar.compact||"Compact"},{value:"comfortable",label:n.toolbar.normal||"Normal"},{value:"spacious",label:n.toolbar.spacious||"Spacious"}],m=p.find(i=>i.value===t)?.label||"Normal";return jsxs("div",{ref:s,className:"relative",children:[jsx(motion.button,{onClick:()=>o(!r),className:"flex items-center justify-center p-2 rounded-lg transition-all",style:{backgroundColor:r?e.accentLight:e.bgSecondary,border:`1px solid ${r?e.accent:e.borderLight}`,color:r?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${n.toolbar.density||"Density"}: ${m}`,children:jsx(Rows3,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:r&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-36 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsx("div",{className:"py-1",children:p.map((i,u)=>{let d=t===i.value;return jsxs(motion.button,{onClick:()=>{a(i.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:d?e.accentLight:"transparent",borderBottom:u<p.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:d?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.03},children:[jsx("span",{className:"text-xs",style:{color:d?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:d?600:500},children:i.label}),d&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},i.value)})})})})]})}function kf({theme:e,value:t,onChange:a}){let[r,o]=useState(false),s=useRef(null),n=bo();useEffect(()=>{let i=u=>{s.current&&!s.current.contains(u.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let p=[{value:"all",label:n.toolbar.filterAll||"All tasks",description:n.toolbar.filterAllDesc||"Show all tasks"},{value:"incomplete",label:n.toolbar.filterIncomplete||"Incomplete only",description:n.toolbar.filterIncompleteDesc||"Hide completed tasks"},{value:"in_progress",label:n.toolbar.filterInProgress||"In progress",description:n.toolbar.filterInProgressDesc||"Tasks currently being worked on"},{value:"completed",label:n.toolbar.filterCompleted||"Completed",description:n.toolbar.filterCompletedDesc||"Only show finished tasks"}],m=t!=="all";return jsxs("div",{ref:s,className:"relative",children:[jsxs(motion.button,{onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:m||r?e.accentLight:e.bgSecondary,border:`1px solid ${m||r?e.accent:e.borderLight}`,color:m||r?e.accent:e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.accentLight,borderColor:e.accent,color:e.accent,scale:1.02},whileTap:{scale:.98},children:[jsx(Filter,{className:"w-3.5 h-3.5"}),jsx("span",{children:n.toolbar.filter||"Filter"}),m&&jsx(motion.span,{initial:{scale:0},animate:{scale:1},className:"flex items-center justify-center w-4 h-4 rounded-full text-[10px] font-semibold",style:{backgroundColor:e.accent,color:"#FFFFFF"},children:"1"}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:r?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:r&&jsxs(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-56 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:"px-3 py-2 border-b",style:{borderColor:e.borderLight},children:jsx("span",{className:"text-xs font-medium",style:{color:e.textTertiary},children:n.toolbar.filterBy||"Filter by status"})}),jsx("div",{className:"py-1",children:p.map((i,u)=>{let d=t===i.value;return jsxs(motion.button,{onClick:()=>{a(i.value),o(false);},className:"w-full flex items-start gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:d?e.accentLight:"transparent"},whileHover:{backgroundColor:d?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.03},children:[jsx("div",{className:"flex items-center justify-center w-4 h-4 rounded border mt-0.5 flex-shrink-0",style:{borderColor:d?e.accent:e.border,backgroundColor:d?e.accent:"transparent"},children:d&&jsx(Check,{className:"w-3 h-3",style:{color:"#FFFFFF"}})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium",style:{color:d?e.accent:e.textPrimary},children:i.label}),jsx("div",{className:"text-[10px] mt-0.5",style:{color:e.textTertiary},children:i.description})]})]},i.value)})}),m&&jsx("div",{className:"px-3 py-2 border-t",style:{borderColor:e.borderLight},children:jsx(motion.button,{onClick:()=>{a("all"),o(false);},className:"w-full text-xs py-1.5 rounded-md",style:{color:e.textTertiary},whileHover:{backgroundColor:e.hoverBg,color:e.textSecondary},children:n.toolbar.clearFilter||"Clear filter"})})]})})]})}function wn({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:p,onRowDensityChange:m,showThemeSelector:i=false,showCreateTaskButton:u=false,createTaskLabel:d,onCreateTask:g,taskFilter:h="all",onTaskFilterChange:C,onExportPNG:T,onExportPDF:c,onExportExcel:b,onExportCSV:y,onExportJSON:l,onExportMSProject:x}){let v=bo(),S=T||c||b||y||l||x,k=[{value:"day",label:v.toolbar.day},{value:"week",label:v.toolbar.week},{value:"month",label:v.toolbar.month}],w=[{value:"dark",label:"Dark",icon:jsx(Moon,{className:"w-3.5 h-3.5"})},{value:"light",label:"Light",icon:jsx(Sun,{className:"w-3.5 h-3.5"})},{value:"neutral",label:"Zen",icon:jsx(Palette,{className:"w-3.5 h-3.5"})}];return jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.bgGrid,borderColor:e.border},children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx(vf,{options:k,value:t,onChange:B=>a(B),theme:e}),jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxs("div",{className:"flex items-center gap-1",children:[jsx(motion.button,{onClick:()=>o(Math.max(.5,r-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(ZoomOut,{className:"w-3.5 h-3.5"})}),jsxs("div",{className:"px-2 py-0.5 rounded text-xs tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},children:[Math.round(r*100),"%"]}),jsx(motion.button,{onClick:()=>o(Math.min(2,r+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsx(xf,{theme:e,value:p,onChange:m}),C&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsx(kf,{theme:e,value:h,onChange:C})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[u&&g&&jsxs(Fragment,{children:[jsxs(motion.button,{onClick:g,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:d||v.toolbar.createTask})]}),(S||i)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),S&&jsxs(Fragment,{children:[jsx(bf,{theme:e,onExportPNG:T,onExportPDF:c,onExportExcel:b,onExportCSV:y,onExportJSON:l,onExportMSProject:x}),i&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsx(yf,{options:w,value:s,onChange:B=>n(B),theme:e})]})]})}function Cn({columns:e,onToggleColumn:t,theme:a}){let[r,o]=useState(false),[s,n]=useState({x:0,y:0}),p=useRef(null),m=useRef(null);useEffect(()=>{if(!r)return;let u=d=>{p.current&&!p.current.contains(d.target)&&o(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:m,onClick:()=>{if(!r&&m.current){let u=m.current.getBoundingClientRect();n({x:u.left,y:u.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(Plus,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:r&&jsx(lt,{children:jsx(motion.div,{ref:p,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:d=>{d.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{children:u.label}),u.visible&&jsx(Check,{className:"w-4 h-4",style:{color:a.accent}})]},u.id))]})})})})]})}function yo({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=useRef(null),[p,m]=useState({x:t,y:a});if(useEffect(()=>{if(!e)return;let u=200,d=r.length*36+8,g=8,h=window.innerWidth,C=window.innerHeight,T=t,c=a;t+u+g>h&&(T=t-u,T<g&&(T=g)),a+d+g>C&&(c=C-d-g,c<g&&(c=g)),m({x:T,y:c});},[e,t,a,r.length]),useEffect(()=>{if(!e)return;let u=g=>{n.current&&!n.current.contains(g.target)&&o();},d=g=>{g.key==="Escape"&&o();};return document.addEventListener("mousedown",u),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",d);}},[e,o]),!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:n,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${p.x}px`,top:`${p.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(),o());},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:d=>{u.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.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 Rt={Edit:jsx(Edit3,{className:"w-4 h-4"}),Pencil:jsx(Pencil,{className:"w-4 h-4"}),Delete:jsx(Trash2,{className:"w-4 h-4"}),Add:jsx(Plus,{className:"w-4 h-4"}),AddSubtask:jsx(Plus,{className:"w-4 h-4"}),Remove:jsx(Minus,{className:"w-4 h-4"}),Link:jsx(Link2,{className:"w-4 h-4"}),Progress:jsx(BarChart3,{className:"w-4 h-4"}),Sort:jsx(ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsx(ArrowUp,{className:"w-4 h-4"}),SortDesc:jsx(ArrowDown,{className:"w-4 h-4"}),Hide:jsx(EyeOff,{className:"w-4 h-4"}),Show:jsx(Eye,{className:"w-4 h-4"}),Settings:jsx(Settings,{className:"w-4 h-4"}),Split:jsx(Scissors,{className:"w-4 h-4"}),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 Zd({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:p,onTaskOutdent:m,onTaskRename:i,onTaskToggleExpand:u,onOpenTaskModal:d,enableKeyboard:g=true}){let h=useRef(false),C=useCallback(l=>{h.current=l;},[]),T=useCallback(l=>{let x=[],v=S=>{for(let k of S)x.push(k),k.subtasks&&k.subtasks.length>0&&k.isExpanded&&v(k.subtasks);};return v(l),x},[]),c=useCallback(()=>{let l=T(e);for(let x of l)if(t.has(x.id))return x;return null},[e,t,T]),b=useCallback((l,x)=>{let v=T(e);if(v.length===0)return;let S=c();if(!S){a(v[0].id,false);return}let k=v.findIndex(M=>M.id===S.id);if(k===-1)return;let w=l==="up"?k-1:k+1;if(w<0||w>=v.length)return;let B=v[w];a(B.id,x);},[e,c,T,a]),y=useCallback(l=>{if(!g)return;let x=l.target;if(x.tagName==="INPUT"||x.tagName==="TEXTAREA"||x.isContentEditable||h.current){l.key==="Escape"&&(x.blur(),h.current=false);return}let k=navigator.platform.toUpperCase().indexOf("MAC")>=0?l.metaKey:l.ctrlKey,w=Array.from(t),B=c();if(l.key==="ArrowUp"){l.preventDefault(),b("up",l.shiftKey);return}if(l.key==="ArrowDown"){l.preventDefault(),b("down",l.shiftKey);return}if(B&&(l.key==="ArrowRight"||l.key==="ArrowLeft")){B.subtasks&&B.subtasks.length>0&&(l.preventDefault(),(l.key==="ArrowRight"&&!B.isExpanded||l.key==="ArrowLeft"&&B.isExpanded)&&u(B.id));return}if(l.altKey&&(l.key==="ArrowUp"||l.key==="ArrowDown")){w.length>0&&(l.preventDefault(),n(w,l.key==="ArrowUp"?"up":"down"));return}if(l.key==="Tab"&&!l.shiftKey){w.length>0&&(l.preventDefault(),p(w));return}if(l.key==="Tab"&&l.shiftKey){w.length>0&&(l.preventDefault(),m(w));return}if(l.key==="Enter"&&!l.shiftKey&&!k){B&&(l.preventDefault(),r(B.id,"below"));return}if(l.key==="Enter"&&l.shiftKey&&!k){B&&(l.preventDefault(),r(B.id,"above"));return}if(l.key==="Enter"&&k){B&&(l.preventDefault(),d(B.id));return}if(l.key==="F2"){B&&(l.preventDefault(),i(B.id));return}if(l.key==="Delete"||l.key==="Backspace"&&k){w.length>0&&(l.preventDefault(),o(w));return}if(l.key==="d"&&k&&!l.shiftKey){w.length>0&&(l.preventDefault(),s(w));return}},[g,t,c,b,r,o,s,n,p,m,i,u,d]);return useEffect(()=>{if(g)return window.addEventListener("keydown",y),()=>{window.removeEventListener("keydown",y);}},[g,y]),{setIsEditing:C}}function tc(){let[e,t]=useState(new Set),[a,r]=useState(null),o=useCallback(d=>{t(new Set([d])),r(d);},[]),s=useCallback(d=>{t(g=>{let h=new Set(g);return h.has(d)?h.delete(d):h.add(d),h}),r(d);},[]),n=useCallback((d,g)=>{if(!a){o(d);return}let h=g.indexOf(a),C=g.indexOf(d);if(h===-1||C===-1){o(d);return}let T=Math.min(h,C),c=Math.max(h,C),b=g.slice(T,c+1);t(new Set(b)),r(d);},[a,o]),p=useCallback((d,g,h,C)=>{C?n(d,g):h?s(d):o(d);},[o,s,n]),m=useCallback((d,g)=>{g?t(h=>{let C=new Set(h);return C.add(d),C}):o(d);},[o]),i=useCallback(()=>{t(new Set),r(null);},[]),u=useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:p,handleKeyboardSelection:m,clearSelection:i,isTaskSelected:u}}function vo(e){let t=[],a=(r,o,s=0)=>{for(let n=0;n<r.length;n++){let p={...r[n],parentId:o,level:s,position:n};t.push(p),p.subtasks&&p.subtasks.length>0&&p.isExpanded&&a(p.subtasks,p.id,s+1);}};return a(e),t}function ac(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=ac(a.subtasks,t);if(r)return r}}return null}function ii(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=ii(a.subtasks,t);if(r)return r}return null}function li(e,t){if(t.length===0)return e;let a=vo(e),r=t[0],o=a.findIndex(d=>d.id===r);if(o<=0)return e;let s=a[o-1],n=(d,g)=>{let h=[];return {tasks:d.filter(T=>{if(g.has(T.id))return h.push(T),false;if(T.subtasks){let c=n(T.subtasks,g);T.subtasks=c.tasks,h.push(...c.removed);}return true}),removed:h}},p=(d,g,h)=>d.map(C=>C.id===g?{...C,subtasks:[...C.subtasks||[],...h],isExpanded:true}:C.subtasks?{...C,subtasks:p(C.subtasks,g,h)}:C),m=new Set(t),{tasks:i,removed:u}=n(e,m);return p(i,s.id,u)}function di(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=ii(a,r);if(!o)continue;let s=ii(a,o.id),n=(i,u,d)=>{for(let g=0;g<i.length;g++){let h=i[g];if(h.id===u&&h.subtasks){let C=h.subtasks.findIndex(T=>T.id===d);if(C!==-1){let[T]=h.subtasks.splice(C,1);return T}}if(h.subtasks){let C=n(h.subtasks,u,d);if(C)return C}}return null},p=(i,u,d)=>{let g=i.findIndex(h=>h.id===u);if(g!==-1)return i.splice(g+1,0,d),i;for(let h of i)h.subtasks&&p(h.subtasks,u,d);return i},m=n(a,o.id,r);m&&(s&&s.subtasks?p(s.subtasks,o.id,m):p(a,o.id,m));}return a}function ci(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,p,m)=>{let i=n.findIndex(d=>d.id===p);if(i===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,p,m))return true;return false}let u=m==="up"?i-1:i+1;return u<0||u>=n.length?false:([n[i],n[u]]=[n[u],n[i]],true)};return s(r,o,a),r}function mi(e,t){let a=new Set(t),r=o=>o.filter(s=>!a.has(s.id)).map(s=>s.subtasks?{...s,subtasks:r(s.subtasks)}:s);return r(e)}function pi(e,t){let a=[...e];for(let r of t){let o=n=>{let p=n.findIndex(u=>u.id===r);if(p===-1){for(let u of n)if(u.subtasks&&o(u.subtasks))return true;return false}let m=n[p],i={...m,id:`${m.id}-copy-${Date.now()}`,name:`${m.name} (Copy)`,subtasks:m.subtasks?s(m.subtasks):void 0};return n.splice(p+1,0,i),true},s=n=>n.map(p=>({...p,id:`${p.id}-copy-${Date.now()}`,subtasks:p.subtasks?s(p.subtasks):void 0}));o(a);}return a}function rc(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#6366F1"},p=m=>{let i=m.findIndex(d=>d.id===t);if(i===-1){for(let d of m)if(d.subtasks&&p(d.subtasks))return true;return false}let u=a==="above"?i:i+1;return m.splice(u,0,n),true};return p(r),{tasks:r,newTask:n}}function ui(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:ui(r.subtasks,t,a)}:r)}function gi(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:gi(a.subtasks,t)}:a)}function fi(e,t){let a=u=>{for(let d of u){if(d.id===t)return d;if(d.subtasks){let g=a(d.subtasks);if(g)return g}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,p=r?.endDate||s,m={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(p),color:r?.color||"#3B82F6"},i=u=>u.map(d=>{if(d.id===t){let g=d.subtasks||[];return {...d,subtasks:[...g,m],isExpanded:true}}return d.subtasks?{...d,subtasks:i(d.subtasks)}:d});return {tasks:i(e),newTask:m}}function oc(e,t,a,r){if(t===a)return e;let o=ac(e,t);if(!o)return e;if(a){let p=(m,i)=>{if(!m.subtasks)return false;for(let u of m.subtasks)if(u.id===i||p(u,i))return true;return false};if(p(o,a))return e}let s=p=>p.filter(m=>m.id!==t).map(m=>m.subtasks&&m.subtasks.length>0?{...m,subtasks:s(m.subtasks)}:m),n=s(e);if(a===null){let p=r!==void 0?r:n.length;n.splice(p,0,{...o,parentId:void 0});}else {let p=m=>m.map(i=>{if(i.id===a){let u=i.subtasks||[],d=r!==void 0?r:u.length,g=[...u];return g.splice(d,0,{...o,parentId:a}),{...i,subtasks:g,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:p(i.subtasks)}:i});n=p(n);}return n}function Dn({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:p,onTaskToggle:m,scrollTop:i,columns:u,onToggleColumn:d,onColumnResize:g,onTaskUpdate:h,onTaskIndent:C,onTaskOutdent:T,onTaskMove:c,onMultiTaskDelete:b,onTaskDuplicate:y,onTaskCreate:l,onTaskRename:x,onCreateSubtask:v,onOpenTaskModal:S,onDeleteRequest:k,onTaskReparent:w}){let B=useContext(ho),[M,D]=useState(null),[I,R]=useState(null),[Y,te]=useState(""),ye=useRef(null),[De,Se]=useState(null),[O,V]=useState(0),[$,G]=useState(0),[A,X]=useState({isOpen:false,x:0,y:0,type:"header"}),[q,U]=useState(null),[fe,Me]=useState(null),[Oe,he]=useState(null),Ye=useRef(0),We=5,et=useRef(false),[vt,Mt]=useState(null),[mt,z]=useState(false),[ie,ve]=useState(null),[Pe,ze]=useState(false),at=useRef(null);useEffect(()=>{function _(ae){at.current&&!at.current.contains(ae.target)&&ze(false);}if(Pe)return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[Pe]),useEffect(()=>{I&&ye.current&&(ye.current.focus(),ye.current.select());},[I]),useEffect(()=>{if(!De)return;let _=Ee=>{let Ue=Ee.clientX-O,He=$+Ue;g?.(De,He);},ae=()=>{Se(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",_),document.addEventListener("mouseup",ae),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",_),document.removeEventListener("mouseup",ae),document.body.style.cursor="",document.body.style.userSelect="";}},[De,O,$,g]);let{selectedTaskIds:Et,handleTaskClick:Fe,isTaskSelected:Xt}=tc(),{setIsEditing:Ot}=Zd({tasks:e,selectedTaskIds:Et,onTaskSelect:(_,ae)=>{let Ue=vo(e).map(He=>He.id);Fe(_,Ue,ae||false,false);},onTaskCreate:l||(()=>{}),onTaskDelete:b||(()=>{}),onTaskDuplicate:y||(()=>{}),onTaskMove:c||(()=>{}),onTaskIndent:C||(()=>{}),onTaskOutdent:T||(()=>{}),onTaskRename:_=>{let ae=vo(e).find(Ee=>Ee.id===_);ae&&me(ae);},onTaskToggleExpand:m||(()=>{}),onOpenTaskModal:_=>{let ae=vo(e).find(Ee=>Ee.id===_);ae&&S&&S(ae);},enableKeyboard:true}),Nt=(_,ae=0)=>{let Ee=[];for(let Ue of _)Ee.push({task:Ue,level:ae}),Ue.subtasks&&Ue.subtasks.length>0&&Ue.isExpanded&&Ee.push(...Nt(Ue.subtasks,ae+1));return Ee},ct=Nt(e),Jt=48,Ea=Math.max(ct.length*a,600-Jt),oe=_=>!_.startDate||!_.endDate?"-":`${Math.ceil((_.endDate.getTime()-_.startDate.getTime())/(1e3*60*60*24))}d`,me=_=>{R(_.id),te(_.name),Ot(true);},pa=_=>{Y.trim()&&Y!==e.find(ae=>ae.id===_)?.name&&x?.(_,Y.trim()),R(null),te(""),Ot(false);},ya=()=>{R(null),te(""),Ot(false);},N=(_,ae)=>{ae.stopPropagation(),v?.(_.id);},ee=(_,ae)=>{ae.preventDefault(),Ye.current=ae.clientY,U(_),et.current=false,z(false),Mt({x:ae.clientX,y:ae.clientY});},se=_=>{if(!q||(Math.abs(_.clientY-Ye.current)>We&&!et.current&&(et.current=true,z(true)),Mt({x:_.clientX,y:_.clientY}),!et.current))return;let Ee=document.querySelectorAll("[data-task-row]"),Ue=null,He=null;Ee.forEach(W=>{let le=W.getBoundingClientRect(),Ie=W.getAttribute("data-task-row");if(Ie&&Ie!==q&&_.clientY>=le.top&&_.clientY<=le.bottom){Ue=Ie;let Dt=_.clientY-le.top,Je=le.height;Dt<Je*.25?He="above":Dt>Je*.75?He="below":He="child";}}),Me(Ue),he(He);},Te=()=>{if(et.current&&q&&fe&&Oe){if(Oe==="child")w?.(q,fe);else if(Oe==="above"||Oe==="below"){let _=(Ue,He,W=null)=>{for(let le of Ue){if(le.id===He)return W;if(le.subtasks){let Ie=_(le.subtasks,He,le.id);if(Ie!==void 0)return Ie}}},ae=_(e,fe,null),Ee=(Ue,He)=>{let W=Ue.findIndex(le=>le.id===He);return Oe==="below"?W+1:W};if(ae===null){let Ue=Ee(e,fe);w?.(q,null,Ue);}else {let Ue=ct.find(He=>He.task.id===ae)?.task;if(Ue?.subtasks){let He=Ee(Ue.subtasks,fe);w?.(q,ae,He);}}}}U(null),Me(null),he(null),Mt(null),et.current=false,z(false);};useEffect(()=>{if(q)return document.addEventListener("mousemove",se),document.addEventListener("mouseup",Te),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",se),document.removeEventListener("mouseup",Te),document.body.style.cursor="",document.body.style.userSelect="";}},[q,fe,Oe]);let $e=(_,ae,Ee)=>{switch(_.id){case "name":let Ue=I===ae.id,He=M===ae.id;return jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${Ee*20}px`},children:[w&&jsx("div",{className:"cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-white/10 transition-all flex-shrink-0",style:{color:t.textTertiary,opacity:He?1:.3},onMouseDown:Q=>ee(ae.id,Q),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),ae.subtasks&&ae.subtasks.length>0?jsx("button",{onClick:Q=>{Q.stopPropagation(),m?.(ae.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:ae.isExpanded?jsx(ChevronDown,{className:"w-4 h-4"}):jsx(ChevronRight,{className:"w-4 h-4"})}):jsx("div",{className:"w-5 h-5 flex-shrink-0 flex items-center justify-center",children:jsx("div",{className:"w-3 h-3 rounded-full border",style:{backgroundColor:ae.color||"#3B82F6",opacity:ae.parentId?.6:1,borderColor:ae.isMilestone?t.accent:"transparent",borderWidth:ae.isMilestone?"2px":"0px"},title:ae.isMilestone?"Milestone":ae.parentId?"Subtask":"Task"})}),Ue?jsx("input",{ref:ye,type:"text",value:Y,onChange:Q=>te(Q.target.value),onKeyDown:Q=>{Q.key==="Enter"?pa(ae.id):Q.key==="Escape"&&ya();},onBlur:()=>pa(ae.id),className:"flex-1 px-2 py-1 rounded border outline-none",style:{backgroundColor:t.bgPrimary,borderColor:t.accent,color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:"13px",fontWeight:500},onClick:Q=>Q.stopPropagation()}):jsxs(Fragment,{children:[jsx("span",{className:"flex-1",style:{color:ae.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:ae.parentId?"13px":"14px",fontWeight:ae.isMilestone?600:ae.parentId?400:600,letterSpacing:ae.parentId?"0":"-0.01em"},title:ae.name,children:ae.name}),He&&!Ue&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:Q=>Q.stopPropagation(),children:[jsx("button",{onClick:Q=>N(ae,Q),className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Create subtask",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx("button",{onClick:Q=>{Q.stopPropagation(),me(ae);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsx(Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":case "endDate":let le=_.id==="startDate"?"startDate":"endDate",Ie=ae[le],Dt=ie?.taskId===ae.id&&ie?.field===le,Je=Q=>Q?(typeof Q=="string"?new Date(Q):Q).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:Q=>Q.stopPropagation(),children:[jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors hover:bg-white/5",style:{color:t.textSecondary},onClick:Q=>{if(Dt)ve(null);else {let Ae=Q.currentTarget.getBoundingClientRect();ve({taskId:ae.id,field:le,month:Ie?typeof Ie=="string"?new Date(Ie):Ie:new Date,position:{top:Ae.bottom+4,left:Ae.left}});}},children:[jsx(Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsx("span",{children:Je(Ie)})]}),Dt&&typeof document<"u"&&createPortal(jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>ve(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"fixed z-[9999] rounded-xl shadow-2xl overflow-visible flex",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,top:ie?.position.top,left:ie?.position.left},onClick:Q=>Q.stopPropagation(),children:[jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let Q=new Date,Ae=new Date(Q);Ae.setDate(Q.getDate()+1);let ot=new Date(Q);ot.setDate(Q.getDate()+7);let ne=new Date(Q);return ne.setDate(Q.getDate()+14),[{label:"Hoy",date:Q},{label:"Ma\xF1ana",date:Ae},{label:"Pr\xF3xima semana",date:ot},{label:"2 semanas",date:ne}].map((xt,Le)=>jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:At=>At.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:At=>At.currentTarget.style.backgroundColor="transparent",onClick:()=>{h?.(ae.id,{[le]:xt.date}),ve(null);},children:xt.label},Le))})(),jsx("div",{style:{borderTop:`1px solid ${t.border}`,margin:"0.25rem 0"}}),jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:Q=>Q.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Q=>Q.currentTarget.style.backgroundColor="transparent",onClick:()=>{h?.(ae.id,{[le]:void 0}),ve(null);},children:"Borrar"})]}),jsxs("div",{className:"p-2",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("button",{type:"button",onClick:()=>ve(Q=>Q?{...Q,month:new Date(Q.month.getFullYear(),Q.month.getMonth()-1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronLeft,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})}),jsx("span",{className:"text-xs font-medium",style:{color:t.textPrimary},children:ie?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>ve(Q=>Q?{...Q,month:new Date(Q.month.getFullYear(),Q.month.getMonth()+1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:["D","L","M","M","J","V","S"].map((Q,Ae)=>jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:Q},Ae))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let Q=ie?.month||new Date,Ae=Q.getFullYear(),ot=Q.getMonth(),ne=new Date(Ae,ot,1).getDay(),Re=new Date(Ae,ot+1,0).getDate(),xt=new Date,Le=[];for(let st=ne-1;st>=0;st--)Le.push({day:new Date(Ae,ot,-st).getDate(),date:new Date(Ae,ot-1,new Date(Ae,ot,-st).getDate()),isCurrentMonth:false});for(let st=1;st<=Re;st++)Le.push({day:st,date:new Date(Ae,ot,st),isCurrentMonth:true});let At=42-Le.length;for(let st=1;st<=At;st++)Le.push({day:st,date:new Date(Ae,ot+1,st),isCurrentMonth:false});return Le.map((st,ga)=>{let zt=st.date.toDateString()===xt.toDateString(),kt=(Ie?typeof Ie=="string"?new Date(Ie):Ie:null)?.toDateString()===st.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:st.isCurrentMonth?kt?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:kt?"#3B82F6":"transparent",boxShadow:zt&&!kt?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{h?.(ae.id,{[le]:st.date}),ve(null);},children:st.day},ga)})})()})]})]})]}),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:oe(ae)})});case "assignees":let va=r.filter(Q=>ae.assignees?.some(Ae=>Ae.name===Q.name||Ae.initials===Q.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:Q=>Q.stopPropagation(),children:jsx(Hr,{assignedUsers:va,availableUsers:r,onChange:Q=>{let Ae=Q.map(ot=>({id:ot.id,name:ot.name,initials:ot.initials,color:ot.color}));h?.(ae.id,{assignees:Ae.length>0?Ae:void 0});}})});case "status":return jsx("div",{className:"flex items-center justify-center w-full",onClick:Q=>Q.stopPropagation(),children:jsx(Xl,{status:ae.status||"todo",onChange:Q=>{h?.(ae.id,{status:Q,progress:Q==="completed"?100:ae.progress});}})});case "progress":return jsxs("div",{className:"flex items-center justify-center gap-2 w-full",children:[jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${ae.progress}%`,backgroundColor:ae.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:[ae.progress,"%"]})]});case "priority":let ua={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},E={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},be=ua[ae.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:Q=>Q.stopPropagation(),children:jsx(zr,{priority:be,onChange:Q=>{Q&&h?.(ae.id,{priority:E[Q]||"medium"});}})});default:return null}},tt=_=>[{id:"hide",label:"Hide Column",icon:Rt.Hide,onClick:()=>d(_),disabled:_==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Rt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Rt.SortDesc,onClick:()=>{}}],Ge=_=>_.subtasks&&_.subtasks.length>0?[{id:"addSubtask",label:B?.contextMenu?.addSubtask||"Add Subtask",icon:Rt.Add,onClick:()=>{v?.(_.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:B?.contextMenu?.deleteTask||"Delete Task",icon:Rt.Delete,onClick:()=>{k?k(_.id,_.name):b?.([_.id]);}}]:[{id:"edit",label:B?.contextMenu?.editTask||"Edit Task",icon:Rt.Pencil,onClick:()=>{n?.(_);}},{id:"addSubtask",label:B?.contextMenu?.addSubtask||"Add Subtask",icon:Rt.Add,onClick:()=>{v?.(_.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:B?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Rt.MarkIncomplete,onClick:()=>{h?.(_.id,{status:"todo",progress:0});},disabled:_.status==="todo"},{id:"setInProgress",label:B?.contextMenu?.setInProgress||"Set In Progress",icon:Rt.SetInProgress,onClick:()=>{h?.(_.id,{status:"in-progress"});},disabled:_.status==="in-progress"},{id:"markComplete",label:B?.contextMenu?.markComplete||"Mark Complete",icon:Rt.MarkComplete,onClick:()=>{h?.(_.id,{status:"completed",progress:100});},disabled:_.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:B?.contextMenu?.splitTask||"Split Task",icon:Rt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:B?.contextMenu?.deleteTask||"Delete Task",icon:Rt.Delete,onClick:()=>{k?k(_.id,_.name):b?.([_.id]);}}],Be=u.filter(_=>_.visible),rt=Be.reduce((_,ae)=>_+ae.width,0);return jsxs("div",{className:"h-full",style:{backgroundColor:t.bgPrimary,minWidth:rt},children:[jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,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:Be.map((_,ae)=>{let Ee=ae===Be.length-1,Ue=_.id==="name";return jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${Ue?"":"justify-center"}`,style:{width:`${_.width}px`,minWidth:`${_.minWidth??(Ue?200:60)}px`,maxWidth:`${_.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:Ee?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:He=>{He.preventDefault(),X({isOpen:true,x:He.clientX,y:He.clientY,type:"header",columnId:_.id});},onMouseEnter:He=>{He.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:He=>{He.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:_.label,children:_.label}),_.resizable&&jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:De===_.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:He=>{He.preventDefault(),He.stopPropagation(),Se(_.id),V(He.clientX),G(_.width);},title:"Drag to resize column",children:jsx("div",{className:"absolute top-2 bottom-2 opacity-0 group-hover:opacity-100 transition-opacity",style:{left:"3px",width:"2px",backgroundColor:t.accent,borderRadius:"1px"}})})]},_.id)})}),jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.bgGrid,zIndex:5},children:[jsx(Cn,{columns:u,onToggleColumn:d,theme:t}),jsx("button",{onClick:()=>ze(!Pe),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"})}),Pe&&jsxs("div",{ref:at,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:_=>_.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:()=>ze(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxs("div",{className:"space-y-3 text-xs",children:[jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]}),jsx("div",{className:"gantt-taskgrid-content",style:{minHeight:Ea},children:ct.map(({task:_,level:ae},Ee)=>{let Ue=Xt(_.id),He=fe===_.id,W=He&&Oe==="above",le=He&&Oe==="below",Ie=He&&Oe==="child",Dt={};return Ie&&(Dt.backgroundColor=`${t.accent}15`,Dt.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":_.id,className:`flex items-center cursor-pointer group ${q===_.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:Ue?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:Ue?t.accentLight:Ie?`${t.accent}15`:Ee%2===0?t.bgPrimary:t.bgGrid,...Dt},onMouseEnter:()=>D(_.id),onMouseLeave:()=>D(null),onClick:Je=>{let ua=vo(e).map(Q=>Q.id),be=navigator.platform.toUpperCase().indexOf("MAC")>=0?Je.metaKey:Je.ctrlKey;Fe(_.id,ua,be,Je.shiftKey),s?.(_);},onDoubleClick:Je=>{Je.stopPropagation(),n?.(_);},onContextMenu:Je=>{Je.preventDefault(),X({isOpen:true,x:Je.clientX,y:Je.clientY,type:"task",task:_}),p?.(_,Je);},whileHover:{backgroundColor:Ue?t.accentLight:t.hoverBg},children:[W&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),le&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Be.map((Je,va)=>{let ua=va===Be.length-1,E=Je.id==="name";return jsx("div",{className:`px-4 flex items-center ${E?"justify-start":"justify-center"}`,style:{width:`${Je.width}px`,minWidth:`${Je.minWidth??(E?200:60)}px`,maxWidth:`${Je.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:ua?"none":`1px solid ${M===_.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:$e(Je,_,E?ae:0)},`${_.id}-${Je.id}`)})]},_.id)})}),jsx(yo,{isOpen:A.isOpen,x:A.x,y:A.y,items:A.type==="header"&&A.columnId?tt(A.columnId):A.type==="task"&&A.task?Ge(A.task):[],onClose:()=>X({...A,isOpen:false}),theme:t}),mt&&vt&&q&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:vt.x+12,top:vt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let _=ct.find(ae=>ae.task.id===q)?.task;return _?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:_.name})}):null})()}),document.body)]})}function dc(e,t){let[a,r]=useState("none"),[o,s]=useState(0),[n,p]=useState(e),[m,i]=useState(t),[u,d]=useState(null),[g,h]=useState(null),[C,T]=useState(null),[c,b]=useState(null),[y,l]=useState(0),[x,v]=useState(0),[S,k]=useState(null),[w,B]=useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:p,ghostWidth:m,setGhostWidth:i,connectionLine:u,setConnectionLine:d,hoveredTaskId:g,setHoveredTaskId:h,activeZone:C,setActiveZone:T,draggedSegmentIndex:c,setDraggedSegmentIndex:b,draggedSegmentStartX:y,setDraggedSegmentStartX:l,segmentDragOffsetX:x,setSegmentDragOffsetX:v,hoveredSegmentIndex:S,setHoveredSegmentIndex:k,isHovered:w,setIsHovered:B,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(Y,te)=>{r("none"),d(null),h(null),p(Y),i(te),v(0),b(null),l(0);}}}function Sn({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:p,onClick:m,onDoubleClick:i,onContextMenu:u,onDateChange:d,onDependencyCreate:g,allTaskPositions:h=[],onDragMove:C,onHoverChange:T}){let c=dc(t,r),b=useRef(null),{dragMode:y,setDragMode:l,dragOffset:x,setDragOffset:v,ghostX:S,setGhostX:k,ghostWidth:w,setGhostWidth:B,connectionLine:M,setConnectionLine:D,hoveredTaskId:I,setHoveredTaskId:R,activeZone:Y,setActiveZone:te,draggedSegmentIndex:ye,setDraggedSegmentIndex:De,draggedSegmentStartX:Se,setDraggedSegmentStartX:O,segmentDragOffsetX:V,setSegmentDragOffsetX:$,hoveredSegmentIndex:G,setHoveredSegmentIndex:A,isHovered:X,setIsHovered:q,isDragging:U,isResizing:fe,isConnecting:Me,resetDragState:Oe}=c,he=32,Ye=8,We=e.endDate&&e.endDate<new Date&&e.progress<100,et=e.isCriticalPath,vt=o.name==="neutral"||o.today==="#1C1917",Mt=e.status==="completed"||e.progress===100,mt={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},ie=e.isCriticalPath||We?"#DC2626":e.color?e.color:e.priority&&mt[e.priority]?mt[e.priority]:o.taskBarPrimary,Pe=(N=>N>=80?20:N>=60?15:N>=50?12:10)(r),ze=r<50,at=r<40;useEffect(()=>{if(T)if(X&&!U&&!e.segments){let N=a<100;T({task:e,x:t,y:a,width:r,height:he,showBelow:N});}else T(null);},[X,U,e,t,a,r,he,T]);let Et=N=>N.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Fe=()=>{let N=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${N} day${N!==1?"s":""}`},Xt=N=>Math.round(N/s)*s,Ot=N=>{let ee=Math.round(N/s),se=new Date(n);return se.setDate(se.getDate()+ee),se},Nt=(N,ee)=>{for(let se of h){if(se.id===e.id)continue;let Te=5;if(N>=se.x-Te&&N<=se.x+se.width+Te&&ee>=se.y-Te&&ee<=se.y+se.height+Te)return se.id}return null},ct=useCallback((N,ee,se)=>{N.preventDefault(),N.stopPropagation();let Te=b.current?.ownerSVGElement;if(!Te)return;let $e=Te.createSVGPoint();$e.x=N.clientX,$e.y=N.clientY;let tt=$e.matrixTransform(Te.getScreenCTM()?.inverse()),Ge=se!==void 0?se:t,Be=ee;if(!Be){let rt=tt.x-Ge;N.shiftKey?(Be="connect",D({x:t+r,y:a+he/2})):N.ctrlKey||N.metaKey?Be="move":N.altKey?Be=rt<r/2?"resize-start":"resize-end":at?rt<r/2?Be="move":Be="resize-end":ze?rt<=Pe/2?Be="resize-start":rt>=r-Pe/2?Be="resize-end":Be="move":rt<=Pe?Be="resize-start":rt>=r-Pe?Be="resize-end":Be="move";}l(Be),q(false),te(null),Be==="move"?v(tt.x-Ge):Be==="connect"?D({x:t+r,y:a+he/2}):v(0),k(Ge),B(r);},[t,r,a,he]),Jt=useCallback(N=>{if(y==="none")return;let ee=b.current?.ownerSVGElement;if(!ee)return;let se=ee.createSVGPoint();se.x=N.clientX,se.y=N.clientY;let Te=se.matrixTransform(ee.getScreenCTM()?.inverse());if(y==="connect"){D({x:Te.x,y:Te.y});let $e=Nt(Te.x,Te.y);R($e);}else if(y==="move"){let $e=Te.x-x,tt=Xt($e);k(tt),B(r);let Ge=Math.round((tt-t)/s);if(C?.(e.id,Ge,true),e.segments&&e.segments.length>0&&ye!==null){let Be=tt-Se;$(Be);}}else if(y==="resize-start"){let $e=Te.x,tt=Xt($e),Ge=t+r-tt;Ge>=s&&(k(tt),B(Ge));}else if(y==="resize-end"){let $e=Te.x,Ge=Xt($e)-t;Ge>=s&&B(Ge);}},[y,t,r,s,x,e,Xt,ye,Se,Nt,R,D,k,B,$,C]),Ea=useCallback(()=>{if(y!=="none"){if(y==="connect")I&&g&&g(e,I),D(null),R(null);else {let N=e.endDate.getTime()-e.startDate.getTime(),ee,se,Te=true;if(y==="move"){if(ee=Ot(S),se=new Date(ee.getTime()+N),e.segments&&e.segments.length>0&&ye!==null){let $e=Math.round(V/s),tt=e.segments.map((_,ae)=>{if(ae===ye){let Ee=new Date(_.startDate),Ue=new Date(_.endDate);return Ee.setDate(Ee.getDate()+$e),Ue.setDate(Ue.getDate()+$e),{startDate:Ee,endDate:Ue}}return _}),Ge=tt.flatMap(_=>[_.startDate,_.endDate]),Be=new Date(Math.min(...Ge.map(_=>_.getTime()))),rt=new Date(Math.max(...Ge.map(_=>_.getTime())));d?.({...e,segments:tt},Be,rt),Oe(t,r);return}}else y==="resize-start"?(ee=Ot(S),se=e.endDate,ee>se&&(console.warn("Invalid date range: start date must be before or equal to end date"),Te=false)):y==="resize-end"?(ee=e.startDate,se=Ot(S+w),se<ee&&(console.warn("Invalid date range: end date must be after or equal to start date"),Te=false)):Te=false;Te&&ee&&se&&(se.getTime()<ee.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,ee,se));}C?.(e.id,0,false),Oe(t,r);}},[y,S,w,e,d,I,g,t,r,s,Ot,V,ye,Oe,C]);useEffect(()=>{if(y==="none")return;let N=se=>{Jt(se);},ee=()=>{Ea();};return window.addEventListener("mousemove",N),window.addEventListener("mouseup",ee),()=>{window.removeEventListener("mousemove",N),window.removeEventListener("mouseup",ee);}},[y,Jt,Ea]);let oe=U&&!Me?S:t,me=U&&!Me?w:r,pa=p.taskClass(e);return jsxs("g",{ref:b,onClick:()=>!U&&m?.(e),onDoubleClick:N=>{U||(N.stopPropagation(),i?.(e));},onContextMenu:N=>{N.preventDefault(),u?.(e,N);},onMouseEnter:()=>!U&&q(true),onMouseLeave:()=>{U||(q(false),te(null));},children:[jsx("rect",{x:t,y:a,width:r+40,height:he,fill:"transparent",style:{pointerEvents:"all"}}),X&&!U&&!ze&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:Pe,height:he,fill:Y==="resize-start"?o.accent:"transparent",opacity:Y==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>te("resize-start"),onMouseDown:N=>ct(N,"resize-start")}),jsx("rect",{x:t+Pe,y:a,width:r-Pe*2,height:he,fill:Y==="move"?o.accent:"transparent",opacity:Y==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>te("move"),onMouseDown:N=>ct(N,"move")}),jsx("rect",{x:t+r-Pe,y:a,width:Pe,height:he,fill:Y==="resize-end"?o.accent:"transparent",opacity:Y==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>te("resize-end"),onMouseDown:N=>ct(N,"resize-end")})]}),X&&!U&&at&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:r/2,height:he,fill:Y==="move"?o.accent:"transparent",opacity:Y==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>te("move"),onMouseDown:N=>ct(N,"move")}),jsx("rect",{x:t+r/2,y:a,width:r/2,height:he,fill:Y==="resize-end"?o.accent:"transparent",opacity:Y==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>te("resize-end"),onMouseDown:N=>ct(N,"resize-end")}),X&&jsx(motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+he-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),U&&!Me&&!e.segments&&jsx(motion.rect,{x:S,y:a,width:w,height:he,rx:Ye,fill:o.accent,opacity:.5,stroke:o.accent,strokeWidth:2,strokeDasharray:"4 4",initial:{opacity:0},animate:{opacity:.6},transition:{duration:.15},style:{pointerEvents:"none"}}),!e.segments&&jsx(motion.rect,{x:oe,y:a,width:me,height:he,rx:Ye,fill:ie,"data-task-class":pa,initial:{opacity:0,scale:.95},animate:{opacity:U&&!Me?.15:e.parentId?.6:X?.9:.8,scale:X&&!U?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:N=>ct(N),style:{cursor:U?Me?"crosshair":fe?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsx("rect",{x:oe,y:a,width:me*(e.progress/100),height:he,rx:Ye,fill:ie,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((N,ee)=>{let se=(N.startDate.getTime()-n.getTime())/864e5*s,$e=(N.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-se+s,tt=U&&y==="move"&&ye===ee,Ge=G===ee,Be=tt?se+V:se;return jsxs("g",{onMouseEnter:()=>!U&&A(ee),onMouseLeave:()=>!U&&A(null),children:[jsx(motion.rect,{x:Be,y:a,width:$e,height:he,rx:Ye,fill:ie,initial:{opacity:0,scale:.95},animate:{opacity:tt||e.parentId?.6:Ge?.9:.8,scale:Ge&&!U?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:rt=>{rt.stopPropagation(),De(ee),O(se),ct(rt,void 0,se);},style:{cursor:U?Me?"crosshair":fe?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsx("rect",{x:Be,y:a,width:$e*(e.progress/100),height:he,rx:Ye,fill:ie,opacity:1,style:{pointerEvents:"none"}})]},`segment-${ee}`)}),vt&&(We||et)&&!e.segments&&jsxs(Fragment,{children:[et&&!We&&jsx("rect",{x:oe,y:a,width:me,height:he,rx:Ye,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),We&&jsx("rect",{x:oe,y:a,width:me,height:he,rx:Ye,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),me>60&&!e.segments&&(()=>{let N=p.taskLabel(e),ee=typeof N=="string"?N:e.name,se=ee.length>Math.floor(me/8)?`${ee.substring(0,Math.floor(me/8))}...`:ee;return jsx("text",{x:oe+12,y:a+he/2,dominantBaseline:"middle",fill:Mt?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:Mt?"line-through":"none"},children:se})})(),me>100&&e.progress>0&&e.progress<100&&!U&&!e.segments&&jsxs("text",{x:oe+me-12,y:a+he/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}),e.status&&me>80&&!U&&!e.segments&&jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsx("circle",{cx:oe+me-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsx("circle",{cx:oe+me-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(X||fe)&&!Me&&!e.segments&&jsxs(Fragment,{children:[jsxs("g",{children:[jsx("rect",{x:oe-2,y:a,width:16,height:he,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>te("resize-start"),onMouseLeave:()=>te(null),onMouseDown:N=>{N.stopPropagation(),ct(N,"resize-start");}}),jsx(motion.rect,{x:oe+4,y:a+8,width:3,height:he-16,rx:1.5,fill:Y==="resize-start"||y==="resize-start"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]}),jsxs("g",{children:[jsx("rect",{x:oe+me-14,y:a,width:16,height:he,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>te("resize-end"),onMouseLeave:()=>te(null),onMouseDown:N=>{N.stopPropagation(),ct(N,"resize-end");}}),jsx(motion.rect,{x:oe+me-7,y:a+8,width:3,height:he-16,rx:1.5,fill:Y==="resize-end"||y==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsx(AnimatePresence,{children:X&&!U&&!e.segments&&jsxs(motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsx("circle",{cx:t+r+18,cy:a+he/2,r:14,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>te("connect"),onMouseLeave:()=>te(null),onMouseDown:N=>{N.stopPropagation(),ct(N,"connect");}}),jsx(motion.circle,{cx:t+r+18,cy:a+he/2,r:7,fill:o.accent,stroke:"#FFFFFF",strokeWidth:2,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:Y==="connect"?1.3:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}}),jsx("text",{x:t+r+32,y:a+he/2,dominantBaseline:"middle",fill:Y==="connect"?o.accent:o.textTertiary,fontSize:Y==="connect"?"11":"10",fontWeight:Y==="connect"?"600":"400",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),Me&&M&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:t+r,y1:a+he/2,x2:M.x,y2:M.y,stroke:I?o.statusCompleted:o.accent,strokeWidth:I?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:I?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:M.x,cy:M.y,r:I?8:6,fill:I?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),I&&jsx(motion.text,{x:M.x+15,y:M.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:M.x+10},animate:{opacity:1,x:M.x+15},transition:{duration:.2},children:"Connect"})]}),(X||U)&&!Me&&!e.segments&&jsx(motion.rect,{x:oe-2,y:a-2,width:me+4,height:he+4,rx:Ye+2,fill:"none",stroke:U?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:U?.6:.4,initial:{opacity:0},animate:{opacity:U?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),fe&&jsxs(Fragment,{children:[jsx("line",{x1:S,y1:0,x2:S,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsx("line",{x1:S+w,y1:0,x2:S+w,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:X&&!U&&!e.segments&&!T&&(()=>{let se=a<100,Te=se?a+he+13:a-82-13,$e=se?`M ${oe+me/2-6} ${a+he+3} L ${oe+me/2} ${a+he+13} L ${oe+me/2+6} ${a+he+3}`:`M ${oe+me/2-6} ${a-13} L ${oe+me/2} ${a-3} L ${oe+me/2+6} ${a-13}`,tt=Te+22,Ge=Te+40,Be=Te+55,rt=Te+70,_=se?Te+82-5:a-18;return jsxs(motion.g,{initial:{opacity:0,y:se?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:se?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:$e,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsx("rect",{x:oe+me/2-120,y:Te,width:240,height:82,rx:8,fill:o.bgSecondary,stroke:o.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("text",{x:oe+me/2,y:tt,textAnchor:"middle",fill:o.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsx("text",{x:oe+me/2-110,y:Ge,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:oe+me/2-70,y:Ge,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Et(e.startDate)}),jsx("text",{x:oe+me/2-110,y:Be,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:oe+me/2-70,y:Be,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Et(e.endDate)}),jsx("text",{x:oe+me/2+10,y:Ge,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:oe+me/2+65,y:Ge,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Fe()}),jsx("text",{x:oe+me/2+10,y:Be,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:oe+me/2+65,y:Be,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxs(Fragment,{children:[jsx("text",{x:oe+me/2-110,y:rt,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:oe+me/2-50,y:rt,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(ae=>ae.name).join(", ").substring(0,30),e.assignees.map(ae=>ae.name).join(", ").length>30?"...":""]})]}),!se&&jsx("text",{x:oe+me/2,y:_,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:at?"Left: move \u2022 Right: resize":ze?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}function pc({tooltipData:e,theme:t}){if(!e)return null;let {task:a,x:r,y:o,width:s,height:n,showBelow:p}=e,m=82,i=13,u=p?o+n+i:o-m-i,d=p?`M ${r+s/2-6} ${o+n+3} L ${r+s/2} ${o+n+13} L ${r+s/2+6} ${o+n+3}`:`M ${r+s/2-6} ${o-13} L ${r+s/2} ${o-3} L ${r+s/2+6} ${o-13}`,g=u+22,h=u+40,C=u+55,T=u+70,c=x=>x.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),b=()=>{if(!a.startDate||!a.endDate)return "N/A";let x=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${x} day${x!==1?"s":""}`};return jsx(AnimatePresence,{children:jsxs(motion.g,{initial:{opacity:0,y:p?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:p?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsx("rect",{x:r+s/2-120,y:u,width:240,height:m,rx:8,fill:t.bgSecondary,stroke:t.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("text",{x:r+s/2,y:g,textAnchor:"middle",fill:t.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:a.name.length>28?`${a.name.substring(0,28)}...`:a.name}),jsx("text",{x:r+s/2-110,y:h,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:r+s/2-70,y:h,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.startDate?c(a.startDate):"N/A"}),jsx("text",{x:r+s/2-110,y:C,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:r+s/2-70,y:C,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?c(a.endDate):"N/A"}),jsx("text",{x:r+s/2+10,y:h,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:r+s/2+65,y:h,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:b()}),jsx("text",{x:r+s/2+10,y:C,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:r+s/2+65,y:C,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.progress,"%"]}),a.assignees&&a.assignees.length>0&&jsxs(Fragment,{children:[jsx("text",{x:r+s/2-110,y:T,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:r+s/2-50,y:T,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.assignees.map(x=>x.name).join(", ").substring(0,30),a.assignees.map(x=>x.name).join(", ").length>30?"...":""]})]})]})})}function Mn({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:p=false}){let[m,i]=useState(false),[u,d]=useState(null),g=r-t,h=g>0,C=Math.abs(g)<5,c=5,b=20,y=!C&&a<=e,l,x;if(C)if(x=(e+a)/2,n==="squared")l=`M ${e} ${t} L ${a} ${r}`;else {let Se=Math.min(Math.abs(a-e)/3,30);l=`M ${e} ${t} C ${e+Se} ${t}, ${a-Se} ${r}, ${a} ${r}`;}else if(x=a-b,y){let O=e+15,V=a-b,$=h?t+20:t-20;x=V,n==="squared"?l=`M ${e} ${t} L ${O} ${t} L ${O} ${$} L ${V} ${$} L ${V} ${r} L ${a} ${r}`:h?l=`M ${e} ${t} L ${O-c} ${t} Q ${O} ${t} ${O} ${t+c} L ${O} ${$-c} Q ${O} ${$} ${O-c} ${$} L ${V+c} ${$} Q ${V} ${$} ${V} ${$+c} L ${V} ${r-c} Q ${V} ${r} ${V+c} ${r} L ${a} ${r}`:l=`M ${e} ${t} L ${O-c} ${t} Q ${O} ${t} ${O} ${t-c} L ${O} ${$+c} Q ${O} ${$} ${O-c} ${$} L ${V+c} ${$} Q ${V} ${$} ${V} ${$-c} L ${V} ${r+c} Q ${V} ${r} ${V+c} ${r} L ${a} ${r}`;}else n==="squared"?l=`M ${e} ${t} L ${x} ${t} L ${x} ${r} L ${a} ${r}`:h?l=`M ${e} ${t} L ${x-c} ${t} Q ${x} ${t} ${x} ${t+c} L ${x} ${r-c} Q ${x} ${r} ${x+c} ${r} L ${a} ${r}`:l=`M ${e} ${t} L ${x-c} ${t} Q ${x} ${t} ${x} ${t-c} L ${x} ${r+c} Q ${x} ${r} ${x+c} ${r} L ${a} ${r}`;let v=5,S=`M ${a} ${r} L ${a-v} ${r-v*.5} M ${a} ${r} L ${a-v} ${r+v*.5}`,k=o.dependency,w=o.dependencyHover||k,B="#f87171",M="rgba(248, 113, 113, 0.15)",D=x,I=(t+r)/2,R=e+50,Y=u&&u.x>=e-5&&u.x<=R&&Math.abs(u.y-t)<=30;if(u&&!Y)if(C)D=Math.max(e+10,Math.min(a-10,u.x)),I=t;else if(y){let Se=e+15,O=a-b,V=h?t+20:t-20,$=[[e,t,Se,t],[Se,t,Se,V],[Se,V,O,V],[O,V,O,r],[O,r,a,r]],G=1/0,A={x:D,y:I};for(let X of $){let q=te(u.x,u.y,X[0],X[1],X[2],X[3]),U=Math.hypot(u.x-q.x,u.y-q.y);U<G&&(G=U,A=q);}D=A.x,I=A.y;}else {let Se=[[e,t,x,t],[x,t,x,r],[x,r,a,r]],O=1/0,V={x:D,y:I};for(let $ of Se){let G=te(u.x,u.y,$[0],$[1],$[2],$[3]),A=Math.hypot(u.x-G.x,u.y-G.y);A<O&&(O=A,V=G);}D=V.x,I=V.y;}function te(Se,O,V,$,G,A){let X=G-V,q=A-$,U=X*X+q*q;if(U===0)return {x:V,y:$};let fe=((Se-V)*X+(O-$)*q)/U;return fe=Math.max(0,Math.min(1,fe)),{x:V+fe*X,y:$+fe*q}}let ye=Se=>{let O=Se.currentTarget.ownerSVGElement;if(!O)return;let V=O.getBoundingClientRect();d({x:Se.clientX-V.left,y:Se.clientY-V.top});},De=()=>{i(false),d(null);};return p?jsxs("g",{onMouseLeave:De,onMouseMove:ye,children:[jsx("path",{d:l,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsx("path",{d:l,fill:"none",stroke:w,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsx("path",{d:l,fill:"none",stroke:w,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("path",{d:S,fill:"none",stroke:w,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("circle",{cx:a,cy:r,r:4,fill:w,opacity:.9,style:{pointerEvents:"none"}}),s&&!Y&&jsxs(motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:Se=>{Se.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsx("circle",{cx:D,cy:I,r:9,fill:M,stroke:B,strokeWidth:1.5}),jsx("line",{x1:D-3,y1:I-3,x2:D+3,y2:I+3,stroke:B,strokeWidth:1.5,strokeLinecap:"round"}),jsx("line",{x1:D+3,y1:I-3,x2:D-3,y2:I+3,stroke:B,strokeWidth:1.5,strokeLinecap:"round"})]})]}):jsxs("g",{onMouseEnter:()=>i(true),onMouseLeave:De,onMouseMove:ye,style:{cursor:s?"pointer":"default"},children:[jsx("path",{d:l,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsx(motion.path,{d:l,fill:"none",stroke:m?w:k,strokeWidth:m?2.5:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}}}),jsx(motion.path,{d:S,fill:"none",stroke:m?w:k,strokeWidth:m?2.5:2,strokeLinecap:"round",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3}}),jsx(motion.circle,{cx:a,cy:r,r:m?4:3,fill:m?w:k,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15}}),m&&s&&!Y&&jsxs(motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.15},onClick:Se=>{Se.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsx("circle",{cx:D,cy:I,r:9,fill:M,stroke:B,strokeWidth:1.5}),jsx("line",{x1:D-3,y1:I-3,x2:D+3,y2:I+3,stroke:B,strokeWidth:1.5,strokeLinecap:"round"}),jsx("line",{x1:D+3,y1:I-3,x2:D-3,y2:I+3,stroke:B,strokeWidth:1.5,strokeLinecap:"round"})]})]})}function Fn({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=useState(false),p=16,m=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxs("g",{onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsx(motion.circle,{cx:t,cy:a+16,r:p+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsx(motion.rect,{x:t-p/2,y:a+16-p/2,width:p,height:p,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-(p+4)/2,y:a+16-(p+4)/2,width:p+4,height:p+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsx(AnimatePresence,{children:s&&jsxs(motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:m(e.startDate)}),e.isCriticalPath&&jsxs("g",{children:[jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var ue={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=i=>{i.forEach(u=>{u.dependencies&&r.set(u.id,u.dependencies),u.subtasks&&o(u.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,p=new Set,m=i=>{if(!n.has(i)){n.add(i),p.add(i);let u=r.get(i)||[];for(let d of u){if(!n.has(d)&&m(d))return true;if(p.has(d))return true}}return p.delete(i),false};return m(a)},flattenTasks:e=>{let t=[],a=r=>{r.forEach(o=>{t.push(o),o.subtasks&&o.subtasks.length>0&&a(o.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=ue.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=ue.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=ue.findTaskById(e,o);if(s)a.unshift(s),o=s.parentId;else break}return a},exportToJSON:e=>JSON.stringify(e,null,2),importFromJSON:e=>{try{let t=JSON.parse(e);if(!Array.isArray(t))throw new Error("Invalid JSON: expected an array of tasks");return t.forEach((a,r)=>{if(!a.id||!a.name)throw new Error(`Invalid task at index ${r}: missing required fields (id, name)`)}),t}catch(t){throw new Error(`Failed to import tasks: ${t instanceof Error?t.message:"Unknown error"}`)}},exportToCSV:e=>{let t=ue.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let s=[o.id,`"${o.name.replace(/"/g,'""')}"`,o.startDate?o.startDate.toISOString().split("T")[0]:"",o.endDate?o.endDate.toISOString().split("T")[0]:"",o.progress.toString(),o.status||"",o.dependencies?.join(";")||""];r.push(s.join(","));}),r.join(`
112
- `)},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=ue.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=ue.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)=>ue.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=ue.findTaskById(e,t);return !a||!a.dependencies?[]:ue.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>ue.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>ue.flattenTasks(e).filter(r=>!r.startDate||!r.endDate?false:r.startDate<=a&&r.endDate>=t),sortByStartDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.startDate||!r.startDate)return 0;let o=a.startDate.getTime()-r.startDate.getTime();return t?o:-o}),sortByEndDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.endDate||!r.endDate)return 0;let o=a.endDate.getTime()-r.endDate.getTime();return t?o:-o}),sortByProgress:(e,t=true)=>[...e].sort((a,r)=>{let o=a.progress-r.progress;return t?o:-o}),calculateTotalProgress:e=>{let t=ue.flattenTasks(e);if(t.length===0)return 0;let a=t.reduce((r,o)=>r+o.progress,0);return Math.round(a/t.length)},getTaskByPath:(e,t)=>{let a=e,r;for(let o=0;o<t.length;o++){let s=t[o];if(!a||s===void 0||s>=a.length||(r=a[s],!r))return;o<t.length-1&&(a=r.subtasks||[]);}return r},cloneTask:(e,t)=>({...e,id:t||`${e.id}-copy`,subtasks:e.subtasks?.map(a=>ue.cloneTask(a))}),exportToPDF:async(e,t="gantt-chart.pdf")=>{try{if(!e||e.length===0){alert("No tasks available to export to PDF");return}let{jsPDF:a}=await import('jspdf'),{default:r}=await import('jspdf-autotable'),o=new a,s=ue.flattenTasks(e);if(s.length===0){alert("No tasks found to export");return}o.setFontSize(16),o.text("Gantt Chart - Task List",14,20);let n=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],p=s.map(m=>{let i=m.startDate&&m.endDate?ue.calculateDuration(m.startDate,m.endDate):0;return [m.name,m.startDate?ue.formatDate(m.startDate):"N/A",m.endDate?ue.formatDate(m.endDate):"N/A",i>0?`${i} days`:"N/A",`${m.progress}%`,m.status||"N/A"]});r(o,{head:n,body:p,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),o.save(t);}catch(a){throw a}},exportToExcel:async(e,t="gantt-chart.xlsx")=>{let a=await import('xlsx'),o=ue.flattenTasks(e).map(m=>{let i=m.startDate&&m.endDate?ue.calculateDuration(m.startDate,m.endDate):0;return {"Task ID":m.id,"Task Name":m.name,"Start Date":m.startDate?ue.formatDate(m.startDate):"","End Date":m.endDate?ue.formatDate(m.endDate):"","Duration (days)":i>0?i:"","Progress (%)":m.progress,Status:m.status||"",Assignees:m.assignees?.map(u=>u.name).join(", ")||"",Dependencies:m.dependencies?.join(", ")||"","Is Milestone":m.isMilestone?"Yes":"No","Parent ID":m.parentId||"",Level:m.level||0}}),s=a.utils.json_to_sheet(o),n=[{wch:15},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:20},{wch:12},{wch:15},{wch:8}];s["!cols"]=n;let p=a.utils.book_new();a.utils.book_append_sheet(p,s,"Gantt Tasks"),a.writeFile(p,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=ue.flattenTasks(e),o=new Map;r.forEach((g,h)=>{o.set(g.id,h+1);});let s=g=>g.toISOString().replace("Z",""),n=ue.getEarliestStartDate(e)||new Date,p=ue.getLatestEndDate(e)||new Date,m=r.map((g,h)=>{let C=o.get(g.id),T=g.startDate&&g.endDate?ue.calculateDuration(g.startDate,g.endDate):0,c=(g.dependencies||[]).filter(b=>o.has(b)).map(b=>`
111
+ - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Vs({templates:e,onSelectTemplate:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null);useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&n.current&&!n.current.contains(u.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let p=i=>{t(i),o(false);},m=e.reduce((i,u)=>{let d=u.category||"Other";return i[d]||(i[d]=[]),i[d].push(u),i},{});return jsxs("div",{className:f("relative inline-block",a),children:[jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsx("span",{children:"Templates"}),jsx("svg",{className:f("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(m).map(([i,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(d=>jsxs("button",{onClick:()=>p(d),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{className:"text-2xl leading-none mt-0.5",children:d.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:d.name}),d.description&&jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:d.description})]})]},d.id))})]},i)),e.length===0&&jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function Ks({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,p]=useState("export"),[m,i]=useState("json"),[u,d]=useState(null),g=useRef(null);if(!t)return null;let h=async()=>{let T=o?.current||void 0,c=await Sl(e,m,T);El(c,m);},C=async T=>{let c=T.target.files?.[0];if(c){try{let b=await Al(c),y=c.name.endsWith(".json")?"json":"csv",l=Ml(b,y);d(l),l.success&&r&&r(l,b);}catch(b){d({success:false,errors:[`Failed to read file: ${b instanceof Error?b.message:"Unknown error"}`]});}g.current&&(g.current.value="");}};return jsxs("div",{className:f("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:()=>p("export"),className:f("flex-1 px-6 py-4 font-semibold transition-colors",n==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsx("button",{onClick:()=>p("import"),className:f("flex-1 px-6 py-4 font-semibold transition-colors",n==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxs("div",{className:"p-6",children:[n==="export"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(T=>jsxs("button",{onClick:()=>i(T),className:f("p-4 rounded-lg border-2 transition-all text-center",m===T?"border-blue-500 bg-blue-500/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxs("div",{className:"text-2xl mb-2",children:[T==="json"&&"\u{1F4C4}",T==="csv"&&"\u{1F4CA}",T==="pdf"&&"\u{1F4DD}"]}),jsx("div",{className:"font-semibold uppercase text-xs",children:T})]},T))})]}),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:h,className:"w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600 text-white font-semibold rounded-lg transition-all shadow-lg shadow-blue-500/20",children:"Export Board"})]}),n==="import"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsx("input",{ref:g,type:"file",accept:".json,.csv",onChange:C,className:"hidden"}),jsxs("button",{onClick:()=>g.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:f("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:f("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((T,c)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",T]},c))})]})]})]})]})]})}var Hg=["URGENT","HIGH","MEDIUM","LOW"],Wg=[{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"}],Gg=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Ys({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:p,availableUsers:m=[],availableLabels:i=[],availableColumns:u=[],showQuickFilters:d=true,compact:g=false,groupBy:h="none",onGroupByChange:C}){let[T,c]=useState(true),b=useCallback(S=>{a({search:S.target.value});},[a]),y=useCallback(S=>{a({dateFilter:S.target.value});},[a]),l=useCallback(S=>{r({by:S.target.value});},[r]),x=useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),v=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 ${g?"filter-bar--compact":""} ${T?"filter-bar--collapsed":""}`,children:[jsxs("div",{className:"filter-bar__header",onClick:()=>c(!T),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:T?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:S=>{S.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:S=>{S.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:T?"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"}),v&&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)"]})]}),!T&&jsxs("div",{className:"filter-bar__content",children:[d&&jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),n&&jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),p&&jsx("button",{onClick:p,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxs("div",{className:"filter-bar__main",children:[jsx("div",{className:"filter-bar__field",children:jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:b,className:"filter-bar__search"})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.dateFilter,onChange:y,className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Dates"}),jsx("option",{value:"overdue",children:"Overdue"}),jsx("option",{value:"today",children:"Today"}),jsx("option",{value:"this-week",children:"This Week"})]})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.priorities[0]||"all",onChange:S=>{let k=S.target.value;a({priorities:k==="all"?[]:[k]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Priorities"}),Hg.map(S=>jsx("option",{value:S,children:S},S))]})}),m.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.assignees[0]||"all",onChange:S=>{let k=S.target.value;a({assignees:k==="all"?[]:[k]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Assignees"}),m.map(S=>jsx("option",{value:S.id,children:S.name},S.id))]})}),i.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.labels[0]||"all",onChange:S=>{let k=S.target.value;a({labels:k==="all"?[]:[k]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Labels"}),i.map(S=>jsx("option",{value:S,children:S},S))]})}),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:l,className:"filter-bar__select filter-bar__select--sm",children:Wg.map(S=>jsx("option",{value:S.value,children:S.label},S.value))}),t.by!=="none"&&jsx("button",{onClick:x,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),C&&jsx("div",{className:"filter-bar__field",children:jsx("select",{value:h,onChange:S=>C(S.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Gg.map(S=>jsx("option",{value:S.value,children:S.label},S.value))})}),v&&jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function qs({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:p,onExportGanttCSV:m}){let[i,u]=useState(false),d=useRef(null);useEffect(()=>{let h=C=>{d.current&&!d.current.contains(C.target)&&u(false);};return i&&document.addEventListener("mousedown",h),()=>{document.removeEventListener("mousedown",h);}},[i]);let g=h=>{h(),u(false);};return jsxs("div",{className:f("relative",r),ref:d,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:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",h.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",h.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":i,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"3"}),jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsx("span",{children:"Config"})]}),i&&jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxs("button",{onClick:()=>g(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:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.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:()=>g(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:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.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:()=>g(async()=>await n?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.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:()=>g(async()=>await p?.()),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:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.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:()=>g(()=>m?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.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:()=>g(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:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.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:()=>g(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:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.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 Xs={name:"dark",displayName:"Dark (Enhanced)",emoji:"\u{1F319}",colors:{bgPrimary:"#222326",bgSecondary:"#2A2B2F",bgTertiary:"#33343A",bgCard:"#2d2d2d",bgHover:"#353535",bgActive:"#404040",bgInput:"#2a2a2a",textPrimary:"#F4F5F8",textSecondary:"#AEB6C0",textTertiary:"#7A7F8A",textDisabled:"#606060",textInverse:"#1a1a1a",borderPrimary:"rgba(255, 255, 255, 0.1)",borderSecondary:"rgba(255, 255, 255, 0.05)",borderDefault:"#404040",borderHover:"#505050",borderSubtle:"#2a2a2a",accentPrimary:"#5E6AD2",accentHover:"#7780DD",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.1)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.2)",success:"#10B981",warning:"#F59E0B",error:"#EF4444",info:"#3B82F6",danger:"#ef4444",dangerBorder:"rgba(239, 68, 68, 0.3)",dangerBackground:"rgba(239, 68, 68, 0.1)",dangerBackgroundHover:"rgba(239, 68, 68, 0.2)"},shadows:{sm:"0 1px 2px rgba(0, 0, 0, 0.3)",md:"0 4px 12px rgba(0, 0, 0, 0.4)",lg:"0 12px 32px rgba(0, 0, 0, 0.5)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},Js={name:"light",displayName:"Light (Standard)",emoji:"\u2600\uFE0F",colors:{bgPrimary:"#FFFFFF",bgSecondary:"#F7F7F8",bgTertiary:"#EEEFF1",bgCard:"#ffffff",bgHover:"#f3f4f6",bgActive:"#e5e7eb",bgInput:"#f9fafb",textPrimary:"#1A1A1A",textSecondary:"#5A5A5A",textTertiary:"#8A8A8A",textDisabled:"#d1d5db",textInverse:"#ffffff",borderPrimary:"rgba(0, 0, 0, 0.1)",borderSecondary:"rgba(0, 0, 0, 0.05)",borderDefault:"#e5e7eb",borderHover:"#d1d5db",borderSubtle:"#f3f4f6",accentPrimary:"#5E6AD2",accentHover:"#4A56B8",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.08)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.15)",success:"#059669",warning:"#D97706",error:"#DC2626",info:"#2563EB",danger:"#dc2626",dangerBorder:"rgba(220, 38, 38, 0.3)",dangerBackground:"rgba(220, 38, 38, 0.08)",dangerBackgroundHover:"rgba(220, 38, 38, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.12)",md:"0 4px 12px rgba(0, 0, 0, 0.15)",lg:"0 12px 32px rgba(0, 0, 0, 0.2)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},Qs={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"}},Kr={dark:Xs,light:Js,neutral:Qs},yn="dark";var vn=createContext(void 0),Zg="asakaa-theme";function zd({children:e,defaultTheme:t=yn,storageKey:a=Zg}){let[r,o]=useState(()=>{if(typeof window<"u"){let p=localStorage.getItem(a);if(p&&(p==="dark"||p==="light"||p==="neutral"))return p}return t}),s=useCallback(p=>{o(p),typeof window<"u"&&localStorage.setItem(a,p);},[a]);useEffect(()=>{if(typeof window>"u")return;let p=document.documentElement,m=Kr[r];Object.entries(m.colors).forEach(([u,d])=>{d&&p.style.setProperty(`--theme-${ef(u)}`,d);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([u,d])=>{let g=m.colors[u];g&&p.style.setProperty(d,g);}),p.setAttribute("data-theme",r),p.classList.remove("theme-dark","theme-light","theme-neutral"),p.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:Kr};return jsx(vn.Provider,{value:n,children:e})}function go(){let e=useContext(vn);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function ef(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Zs({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=go();return e?jsxs("div",{className:f("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(Kr).map(([s,n])=>jsxs("button",{onClick:()=>{o(s),t();},className:f("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsx("div",{className:"text-3xl",children:n.emoji}),jsxs("div",{className:"text-left flex-1",children:[jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:n.displayName}),jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),r===s&&jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}function Ud(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return qe[e]||qe.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",qe[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",qe[e].bgSecondary),bgGrid:r("--theme-bg-card",qe[e].bgGrid),bgWeekend:r("--theme-bg-hover",qe[e].bgWeekend),border:r("--theme-border-primary",qe[e].border),borderLight:r("--theme-border-subtle",qe[e].borderLight),textPrimary:r("--theme-text-primary",qe[e].textPrimary),textSecondary:r("--theme-text-secondary",qe[e].textSecondary),textTertiary:r("--theme-text-tertiary",qe[e].textTertiary),accent:r("--theme-accent-primary",qe[e].accent),accentHover:r("--theme-accent-hover",qe[e].accentHover),accentLight:r("--theme-accent-primary",qe[e].accentLight),taskBarPrimary:r("--theme-accent-primary",qe[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",qe[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",qe[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",qe[e].dependency),dependencyHover:r("--theme-border-secondary",qe[e].dependencyHover),criticalPath:r("--theme-error",qe[e].criticalPath),criticalPathLight:r("--theme-error",qe[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",qe[e].today):e==="neutral"?r("--theme-text-primary",qe[e].today):r("--theme-error",qe[e].today),todayLight:e==="light"?r("--theme-accent-primary",qe[e].todayLight):e==="neutral"?r("--theme-text-primary",qe[e].todayLight):r("--theme-error",qe[e].todayLight),milestone:r("--theme-warning",qe[e].milestone),milestoneLight:r("--theme-warning",qe[e].milestoneLight),statusTodo:r("--theme-text-tertiary",qe[e].statusTodo),statusInProgress:r("--theme-accent-primary",qe[e].statusInProgress),statusCompleted:r("--theme-success",qe[e].statusCompleted),hoverBg:r("--theme-bg-hover",qe[e].hoverBg),focusRing:r("--theme-accent-primary",qe[e].focusRing)}}var xn={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:"Filter",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"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",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"},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"}},Hd={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:"Filtrar",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"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",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"},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"}},ei={en:xn,es:Hd};function Wd(e){return ei[e]||ei.en}function ti(e,t){let a=Wd(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 ho=createContext(xn);function bo(){return useContext(ho)}function bf({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[p,m]=useState(false),[i,u]=useState(null),d=useRef(null),g=bo();if(useEffect(()=>{let c=b=>{d.current&&!d.current.contains(b.target)&&m(false);};return p&&document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[p]),!(t||a||r||o||s||n))return null;let C=[{id:"png",label:"PNG",description:"Image",icon:jsx(FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsx(FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsx(FolderKanban,{className:"w-4 h-4"}),handler:n}].filter(c=>c.handler),T=async(c,b)=>{if(b){u(c);try{await b();}catch(y){console.error(`Export ${c} failed:`,y);}finally{u(null),m(false);}}};return jsxs("div",{ref:d,className:"relative",children:[jsxs(motion.button,{onClick:()=>m(!p),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:p?e.accent:e.bgSecondary,border:`1px solid ${p?e.accent:e.borderLight}`,color:p?"#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:p?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:p&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsx("div",{className:"py-1",children:C.map((c,b)=>jsxs(motion.button,{onClick:()=>T(c.id,c.handler),disabled:i!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:b<C.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:b*.03},children:[jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===c.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-4 h-4"})}):c.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:c.label}),jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:c.description})]})]},c.id))})})})]})}function yf({options:e,value:t,onChange:a,theme:r,layoutId:o="activeSegment"}){return jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(s=>{let n=t===s.value;return jsxs(motion.button,{onClick:()=>a(s.value),className:"relative px-3 py-1.5 rounded-md text-xs transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:n?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:n?600:500,zIndex:n?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[n&&jsx(motion.div,{layoutId:o,className:"absolute inset-0 rounded-md",style:{backgroundColor:r.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.icon}),jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function vf({options:e,value:t,onChange:a,theme:r}){return jsx("div",{className:"inline-flex items-center gap-1",children:e.map(o=>{let s=t===o.value;return jsxs(motion.button,{onClick:()=>a(o.value),className:"relative px-3 py-1.5 text-xs transition-all",style:{color:s?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsx("span",{children:o.label}),s&&jsx(motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:r.accent},transition:{type:"spring",stiffness:400,damping:30}})]},o.value)})})}function xf({theme:e,value:t,onChange:a}){let[r,o]=useState(false),s=useRef(null),n=bo();useEffect(()=>{let i=u=>{s.current&&!s.current.contains(u.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let p=[{value:"compact",label:n.toolbar.compact||"Compact"},{value:"comfortable",label:n.toolbar.normal||"Normal"},{value:"spacious",label:n.toolbar.spacious||"Spacious"}],m=p.find(i=>i.value===t)?.label||"Normal";return jsxs("div",{ref:s,className:"relative",children:[jsx(motion.button,{onClick:()=>o(!r),className:"flex items-center justify-center p-2 rounded-lg transition-all",style:{backgroundColor:r?e.accentLight:e.bgSecondary,border:`1px solid ${r?e.accent:e.borderLight}`,color:r?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${n.toolbar.density||"Density"}: ${m}`,children:jsx(Rows3,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:r&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-36 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsx("div",{className:"py-1",children:p.map((i,u)=>{let d=t===i.value;return jsxs(motion.button,{onClick:()=>{a(i.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:d?e.accentLight:"transparent",borderBottom:u<p.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:d?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.03},children:[jsx("span",{className:"text-xs",style:{color:d?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:d?600:500},children:i.label}),d&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},i.value)})})})})]})}function kf({theme:e,value:t,onChange:a}){let[r,o]=useState(false),s=useRef(null),n=bo();useEffect(()=>{let i=u=>{s.current&&!s.current.contains(u.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let p=[{value:"all",label:n.toolbar.filterAll||"All tasks",description:n.toolbar.filterAllDesc||"Show all tasks"},{value:"incomplete",label:n.toolbar.filterIncomplete||"Incomplete only",description:n.toolbar.filterIncompleteDesc||"Hide completed tasks"},{value:"in_progress",label:n.toolbar.filterInProgress||"In progress",description:n.toolbar.filterInProgressDesc||"Tasks currently being worked on"},{value:"completed",label:n.toolbar.filterCompleted||"Completed",description:n.toolbar.filterCompletedDesc||"Only show finished tasks"}],m=t!=="all";return jsxs("div",{ref:s,className:"relative",children:[jsxs(motion.button,{onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:m||r?e.accentLight:e.bgSecondary,border:`1px solid ${m||r?e.accent:e.borderLight}`,color:m||r?e.accent:e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.accentLight,borderColor:e.accent,color:e.accent,scale:1.02},whileTap:{scale:.98},children:[jsx(Filter,{className:"w-3.5 h-3.5"}),jsx("span",{children:n.toolbar.filter||"Filter"}),m&&jsx(motion.span,{initial:{scale:0},animate:{scale:1},className:"flex items-center justify-center w-4 h-4 rounded-full text-[10px] font-semibold",style:{backgroundColor:e.accent,color:"#FFFFFF"},children:"1"}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:r?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:r&&jsxs(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-56 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:"px-3 py-2 border-b",style:{borderColor:e.borderLight},children:jsx("span",{className:"text-xs font-medium",style:{color:e.textTertiary},children:n.toolbar.filterBy||"Filter by status"})}),jsx("div",{className:"py-1",children:p.map((i,u)=>{let d=t===i.value;return jsxs(motion.button,{onClick:()=>{a(i.value),o(false);},className:"w-full flex items-start gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:d?e.accentLight:"transparent"},whileHover:{backgroundColor:d?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.03},children:[jsx("div",{className:"flex items-center justify-center w-4 h-4 rounded border mt-0.5 flex-shrink-0",style:{borderColor:d?e.accent:e.border,backgroundColor:d?e.accent:"transparent"},children:d&&jsx(Check,{className:"w-3 h-3",style:{color:"#FFFFFF"}})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium",style:{color:d?e.accent:e.textPrimary},children:i.label}),jsx("div",{className:"text-[10px] mt-0.5",style:{color:e.textTertiary},children:i.description})]})]},i.value)})}),m&&jsx("div",{className:"px-3 py-2 border-t",style:{borderColor:e.borderLight},children:jsx(motion.button,{onClick:()=>{a("all"),o(false);},className:"w-full text-xs py-1.5 rounded-md",style:{color:e.textTertiary},whileHover:{backgroundColor:e.hoverBg,color:e.textSecondary},children:n.toolbar.clearFilter||"Clear filter"})})]})})]})}function wn({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:p,onRowDensityChange:m,showThemeSelector:i=false,showCreateTaskButton:u=false,createTaskLabel:d,onCreateTask:g,taskFilter:h="all",onTaskFilterChange:C,onExportPNG:T,onExportPDF:c,onExportExcel:b,onExportCSV:y,onExportJSON:l,onExportMSProject:x}){let v=bo(),S=T||c||b||y||l||x,k=[{value:"day",label:v.toolbar.day},{value:"week",label:v.toolbar.week},{value:"month",label:v.toolbar.month}],w=[{value:"dark",label:"Dark",icon:jsx(Moon,{className:"w-3.5 h-3.5"})},{value:"light",label:"Light",icon:jsx(Sun,{className:"w-3.5 h-3.5"})},{value:"neutral",label:"Zen",icon:jsx(Palette,{className:"w-3.5 h-3.5"})}];return jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.bgGrid,borderColor:e.border},children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx(vf,{options:k,value:t,onChange:R=>a(R),theme:e}),jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxs("div",{className:"flex items-center gap-1",children:[jsx(motion.button,{onClick:()=>o(Math.max(.5,r-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(ZoomOut,{className:"w-3.5 h-3.5"})}),jsxs("div",{className:"px-2 py-0.5 rounded text-xs tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},children:[Math.round(r*100),"%"]}),jsx(motion.button,{onClick:()=>o(Math.min(2,r+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsx(xf,{theme:e,value:p,onChange:m}),C&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsx(kf,{theme:e,value:h,onChange:C})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[u&&g&&jsxs(Fragment,{children:[jsxs(motion.button,{onClick:g,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:d||v.toolbar.createTask})]}),(S||i)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),S&&jsxs(Fragment,{children:[jsx(bf,{theme:e,onExportPNG:T,onExportPDF:c,onExportExcel:b,onExportCSV:y,onExportJSON:l,onExportMSProject:x}),i&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsx(yf,{options:w,value:s,onChange:R=>n(R),theme:e})]})]})}function Cn({columns:e,onToggleColumn:t,theme:a}){let[r,o]=useState(false),[s,n]=useState({x:0,y:0}),p=useRef(null),m=useRef(null);useEffect(()=>{if(!r)return;let u=d=>{p.current&&!p.current.contains(d.target)&&o(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:m,onClick:()=>{if(!r&&m.current){let u=m.current.getBoundingClientRect();n({x:u.left,y:u.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(Plus,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:r&&jsx(lt,{children:jsx(motion.div,{ref:p,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:d=>{d.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{children:u.label}),u.visible&&jsx(Check,{className:"w-4 h-4",style:{color:a.accent}})]},u.id))]})})})})]})}function yo({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=useRef(null),[p,m]=useState({x:t,y:a});if(useEffect(()=>{if(!e)return;let u=200,d=r.length*36+8,g=8,h=window.innerWidth,C=window.innerHeight,T=t,c=a;t+u+g>h&&(T=t-u,T<g&&(T=g)),a+d+g>C&&(c=C-d-g,c<g&&(c=g)),m({x:T,y:c});},[e,t,a,r.length]),useEffect(()=>{if(!e)return;let u=g=>{n.current&&!n.current.contains(g.target)&&o();},d=g=>{g.key==="Escape"&&o();};return document.addEventListener("mousedown",u),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",d);}},[e,o]),!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:n,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${p.x}px`,top:`${p.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(),o());},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:d=>{u.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.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 Rt={Edit:jsx(Edit3,{className:"w-4 h-4"}),Pencil:jsx(Pencil,{className:"w-4 h-4"}),Delete:jsx(Trash2,{className:"w-4 h-4"}),Add:jsx(Plus,{className:"w-4 h-4"}),AddSubtask:jsx(Plus,{className:"w-4 h-4"}),Remove:jsx(Minus,{className:"w-4 h-4"}),Link:jsx(Link2,{className:"w-4 h-4"}),Progress:jsx(BarChart3,{className:"w-4 h-4"}),Sort:jsx(ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsx(ArrowUp,{className:"w-4 h-4"}),SortDesc:jsx(ArrowDown,{className:"w-4 h-4"}),Hide:jsx(EyeOff,{className:"w-4 h-4"}),Show:jsx(Eye,{className:"w-4 h-4"}),Settings:jsx(Settings,{className:"w-4 h-4"}),Split:jsx(Scissors,{className:"w-4 h-4"}),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 Zd({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:p,onTaskOutdent:m,onTaskRename:i,onTaskToggleExpand:u,onOpenTaskModal:d,enableKeyboard:g=true}){let h=useRef(false),C=useCallback(l=>{h.current=l;},[]),T=useCallback(l=>{let x=[],v=S=>{for(let k of S)x.push(k),k.subtasks&&k.subtasks.length>0&&k.isExpanded&&v(k.subtasks);};return v(l),x},[]),c=useCallback(()=>{let l=T(e);for(let x of l)if(t.has(x.id))return x;return null},[e,t,T]),b=useCallback((l,x)=>{let v=T(e);if(v.length===0)return;let S=c();if(!S){a(v[0].id,false);return}let k=v.findIndex(M=>M.id===S.id);if(k===-1)return;let w=l==="up"?k-1:k+1;if(w<0||w>=v.length)return;let R=v[w];a(R.id,x);},[e,c,T,a]),y=useCallback(l=>{if(!g)return;let x=l.target;if(x.tagName==="INPUT"||x.tagName==="TEXTAREA"||x.isContentEditable||h.current){l.key==="Escape"&&(x.blur(),h.current=false);return}let k=navigator.platform.toUpperCase().indexOf("MAC")>=0?l.metaKey:l.ctrlKey,w=Array.from(t),R=c();if(l.key==="ArrowUp"){l.preventDefault(),b("up",l.shiftKey);return}if(l.key==="ArrowDown"){l.preventDefault(),b("down",l.shiftKey);return}if(R&&(l.key==="ArrowRight"||l.key==="ArrowLeft")){R.subtasks&&R.subtasks.length>0&&(l.preventDefault(),(l.key==="ArrowRight"&&!R.isExpanded||l.key==="ArrowLeft"&&R.isExpanded)&&u(R.id));return}if(l.altKey&&(l.key==="ArrowUp"||l.key==="ArrowDown")){w.length>0&&(l.preventDefault(),n(w,l.key==="ArrowUp"?"up":"down"));return}if(l.key==="Tab"&&!l.shiftKey){w.length>0&&(l.preventDefault(),p(w));return}if(l.key==="Tab"&&l.shiftKey){w.length>0&&(l.preventDefault(),m(w));return}if(l.key==="Enter"&&!l.shiftKey&&!k){R&&(l.preventDefault(),r(R.id,"below"));return}if(l.key==="Enter"&&l.shiftKey&&!k){R&&(l.preventDefault(),r(R.id,"above"));return}if(l.key==="Enter"&&k){R&&(l.preventDefault(),d(R.id));return}if(l.key==="F2"){R&&(l.preventDefault(),i(R.id));return}if(l.key==="Delete"||l.key==="Backspace"&&k){w.length>0&&(l.preventDefault(),o(w));return}if(l.key==="d"&&k&&!l.shiftKey){w.length>0&&(l.preventDefault(),s(w));return}},[g,t,c,b,r,o,s,n,p,m,i,u,d]);return useEffect(()=>{if(g)return window.addEventListener("keydown",y),()=>{window.removeEventListener("keydown",y);}},[g,y]),{setIsEditing:C}}function tc(){let[e,t]=useState(new Set),[a,r]=useState(null),o=useCallback(d=>{t(new Set([d])),r(d);},[]),s=useCallback(d=>{t(g=>{let h=new Set(g);return h.has(d)?h.delete(d):h.add(d),h}),r(d);},[]),n=useCallback((d,g)=>{if(!a){o(d);return}let h=g.indexOf(a),C=g.indexOf(d);if(h===-1||C===-1){o(d);return}let T=Math.min(h,C),c=Math.max(h,C),b=g.slice(T,c+1);t(new Set(b)),r(d);},[a,o]),p=useCallback((d,g,h,C)=>{C?n(d,g):h?s(d):o(d);},[o,s,n]),m=useCallback((d,g)=>{g?t(h=>{let C=new Set(h);return C.add(d),C}):o(d);},[o]),i=useCallback(()=>{t(new Set),r(null);},[]),u=useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:p,handleKeyboardSelection:m,clearSelection:i,isTaskSelected:u}}function vo(e){let t=[],a=(r,o,s=0)=>{for(let n=0;n<r.length;n++){let p={...r[n],parentId:o,level:s,position:n};t.push(p),p.subtasks&&p.subtasks.length>0&&p.isExpanded&&a(p.subtasks,p.id,s+1);}};return a(e),t}function ac(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=ac(a.subtasks,t);if(r)return r}}return null}function ii(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=ii(a.subtasks,t);if(r)return r}return null}function li(e,t){if(t.length===0)return e;let a=vo(e),r=t[0],o=a.findIndex(d=>d.id===r);if(o<=0)return e;let s=a[o-1],n=(d,g)=>{let h=[];return {tasks:d.filter(T=>{if(g.has(T.id))return h.push(T),false;if(T.subtasks){let c=n(T.subtasks,g);T.subtasks=c.tasks,h.push(...c.removed);}return true}),removed:h}},p=(d,g,h)=>d.map(C=>C.id===g?{...C,subtasks:[...C.subtasks||[],...h],isExpanded:true}:C.subtasks?{...C,subtasks:p(C.subtasks,g,h)}:C),m=new Set(t),{tasks:i,removed:u}=n(e,m);return p(i,s.id,u)}function di(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=ii(a,r);if(!o)continue;let s=ii(a,o.id),n=(i,u,d)=>{for(let g=0;g<i.length;g++){let h=i[g];if(h.id===u&&h.subtasks){let C=h.subtasks.findIndex(T=>T.id===d);if(C!==-1){let[T]=h.subtasks.splice(C,1);return T}}if(h.subtasks){let C=n(h.subtasks,u,d);if(C)return C}}return null},p=(i,u,d)=>{let g=i.findIndex(h=>h.id===u);if(g!==-1)return i.splice(g+1,0,d),i;for(let h of i)h.subtasks&&p(h.subtasks,u,d);return i},m=n(a,o.id,r);m&&(s&&s.subtasks?p(s.subtasks,o.id,m):p(a,o.id,m));}return a}function ci(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,p,m)=>{let i=n.findIndex(d=>d.id===p);if(i===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,p,m))return true;return false}let u=m==="up"?i-1:i+1;return u<0||u>=n.length?false:([n[i],n[u]]=[n[u],n[i]],true)};return s(r,o,a),r}function mi(e,t){let a=new Set(t),r=o=>o.filter(s=>!a.has(s.id)).map(s=>s.subtasks?{...s,subtasks:r(s.subtasks)}:s);return r(e)}function pi(e,t){let a=[...e];for(let r of t){let o=n=>{let p=n.findIndex(u=>u.id===r);if(p===-1){for(let u of n)if(u.subtasks&&o(u.subtasks))return true;return false}let m=n[p],i={...m,id:`${m.id}-copy-${Date.now()}`,name:`${m.name} (Copy)`,subtasks:m.subtasks?s(m.subtasks):void 0};return n.splice(p+1,0,i),true},s=n=>n.map(p=>({...p,id:`${p.id}-copy-${Date.now()}`,subtasks:p.subtasks?s(p.subtasks):void 0}));o(a);}return a}function rc(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#6366F1"},p=m=>{let i=m.findIndex(d=>d.id===t);if(i===-1){for(let d of m)if(d.subtasks&&p(d.subtasks))return true;return false}let u=a==="above"?i:i+1;return m.splice(u,0,n),true};return p(r),{tasks:r,newTask:n}}function ui(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:ui(r.subtasks,t,a)}:r)}function gi(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:gi(a.subtasks,t)}:a)}function fi(e,t){let a=u=>{for(let d of u){if(d.id===t)return d;if(d.subtasks){let g=a(d.subtasks);if(g)return g}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,p=r?.endDate||s,m={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(p),color:r?.color||"#3B82F6"},i=u=>u.map(d=>{if(d.id===t){let g=d.subtasks||[];return {...d,subtasks:[...g,m],isExpanded:true}}return d.subtasks?{...d,subtasks:i(d.subtasks)}:d});return {tasks:i(e),newTask:m}}function oc(e,t,a,r){if(t===a)return e;let o=ac(e,t);if(!o)return e;if(a){let p=(m,i)=>{if(!m.subtasks)return false;for(let u of m.subtasks)if(u.id===i||p(u,i))return true;return false};if(p(o,a))return e}let s=p=>p.filter(m=>m.id!==t).map(m=>m.subtasks&&m.subtasks.length>0?{...m,subtasks:s(m.subtasks)}:m),n=s(e);if(a===null){let p=r!==void 0?r:n.length;n.splice(p,0,{...o,parentId:void 0});}else {let p=m=>m.map(i=>{if(i.id===a){let u=i.subtasks||[],d=r!==void 0?r:u.length,g=[...u];return g.splice(d,0,{...o,parentId:a}),{...i,subtasks:g,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:p(i.subtasks)}:i});n=p(n);}return n}function Dn({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:p,onTaskToggle:m,scrollTop:i,columns:u,onToggleColumn:d,onColumnResize:g,onTaskUpdate:h,onTaskIndent:C,onTaskOutdent:T,onTaskMove:c,onMultiTaskDelete:b,onTaskDuplicate:y,onTaskCreate:l,onTaskRename:x,onCreateSubtask:v,onOpenTaskModal:S,onDeleteRequest:k,onTaskReparent:w}){let R=useContext(ho),[M,D]=useState(null),[I,B]=useState(null),[K,te]=useState(""),ie=useRef(null),[de,be]=useState(null),[$,J]=useState(0),[U,G]=useState(0),[A,Q]=useState({isOpen:false,x:0,y:0,type:"header"}),[X,H]=useState(null),[Ce,Me]=useState(null),[Oe,ye]=useState(null),Ye=useRef(0),We=5,et=useRef(false),[vt,Mt]=useState(null),[mt,O]=useState(false),[le,xe]=useState(null),[Pe,ze]=useState(false),at=useRef(null);useEffect(()=>{function _(ae){at.current&&!at.current.contains(ae.target)&&ze(false);}if(Pe)return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[Pe]),useEffect(()=>{I&&ie.current&&(ie.current.focus(),ie.current.select());},[I]),useEffect(()=>{if(!de)return;let _=Ee=>{let Ue=Ee.clientX-$,He=U+Ue;g?.(de,He);},ae=()=>{be(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",_),document.addEventListener("mouseup",ae),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",_),document.removeEventListener("mouseup",ae),document.body.style.cursor="",document.body.style.userSelect="";}},[de,$,U,g]);let{selectedTaskIds:Et,handleTaskClick:Fe,isTaskSelected:Xt}=tc(),{setIsEditing:Ot}=Zd({tasks:e,selectedTaskIds:Et,onTaskSelect:(_,ae)=>{let Ue=vo(e).map(He=>He.id);Fe(_,Ue,ae||false,false);},onTaskCreate:l||(()=>{}),onTaskDelete:b||(()=>{}),onTaskDuplicate:y||(()=>{}),onTaskMove:c||(()=>{}),onTaskIndent:C||(()=>{}),onTaskOutdent:T||(()=>{}),onTaskRename:_=>{let ae=vo(e).find(Ee=>Ee.id===_);ae&&ue(ae);},onTaskToggleExpand:m||(()=>{}),onOpenTaskModal:_=>{let ae=vo(e).find(Ee=>Ee.id===_);ae&&S&&S(ae);},enableKeyboard:true}),Nt=(_,ae=0)=>{let Ee=[];for(let Ue of _)Ee.push({task:Ue,level:ae}),Ue.subtasks&&Ue.subtasks.length>0&&Ue.isExpanded&&Ee.push(...Nt(Ue.subtasks,ae+1));return Ee},ct=Nt(e),Jt=48,Ea=Math.max(ct.length*a,600-Jt),oe=_=>!_.startDate||!_.endDate?"-":`${Math.ceil((_.endDate.getTime()-_.startDate.getTime())/(1e3*60*60*24))}d`,ue=_=>{B(_.id),te(_.name),Ot(true);},pa=_=>{K.trim()&&K!==e.find(ae=>ae.id===_)?.name&&x?.(_,K.trim()),B(null),te(""),Ot(false);},ya=()=>{B(null),te(""),Ot(false);},N=(_,ae)=>{ae.stopPropagation(),v?.(_.id);},ee=(_,ae)=>{ae.preventDefault(),Ye.current=ae.clientY,H(_),et.current=false,O(false),Mt({x:ae.clientX,y:ae.clientY});},se=_=>{if(!X||(Math.abs(_.clientY-Ye.current)>We&&!et.current&&(et.current=true,O(true)),Mt({x:_.clientX,y:_.clientY}),!et.current))return;let Ee=document.querySelectorAll("[data-task-row]"),Ue=null,He=null;Ee.forEach(W=>{let ce=W.getBoundingClientRect(),Ie=W.getAttribute("data-task-row");if(Ie&&Ie!==X&&_.clientY>=ce.top&&_.clientY<=ce.bottom){Ue=Ie;let Dt=_.clientY-ce.top,Je=ce.height;Dt<Je*.25?He="above":Dt>Je*.75?He="below":He="child";}}),Me(Ue),ye(He);},De=()=>{if(et.current&&X&&Ce&&Oe){if(Oe==="child")w?.(X,Ce);else if(Oe==="above"||Oe==="below"){let _=(Ue,He,W=null)=>{for(let ce of Ue){if(ce.id===He)return W;if(ce.subtasks){let Ie=_(ce.subtasks,He,ce.id);if(Ie!==void 0)return Ie}}},ae=_(e,Ce,null),Ee=(Ue,He)=>{let W=Ue.findIndex(ce=>ce.id===He);return Oe==="below"?W+1:W};if(ae===null){let Ue=Ee(e,Ce);w?.(X,null,Ue);}else {let Ue=ct.find(He=>He.task.id===ae)?.task;if(Ue?.subtasks){let He=Ee(Ue.subtasks,Ce);w?.(X,ae,He);}}}}H(null),Me(null),ye(null),Mt(null),et.current=false,O(false);};useEffect(()=>{if(X)return document.addEventListener("mousemove",se),document.addEventListener("mouseup",De),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",se),document.removeEventListener("mouseup",De),document.body.style.cursor="",document.body.style.userSelect="";}},[X,Ce,Oe]);let $e=(_,ae,Ee)=>{switch(_.id){case "name":let Ue=I===ae.id,He=M===ae.id;return jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${Ee*20}px`},children:[w&&jsx("div",{className:"cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-white/10 transition-all flex-shrink-0",style:{color:t.textTertiary,opacity:He?1:.3},onMouseDown:q=>ee(ae.id,q),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),ae.subtasks&&ae.subtasks.length>0?jsx("button",{onClick:q=>{q.stopPropagation(),m?.(ae.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:ae.isExpanded?jsx(ChevronDown,{className:"w-4 h-4"}):jsx(ChevronRight,{className:"w-4 h-4"})}):jsx("div",{className:"w-5 h-5 flex-shrink-0 flex items-center justify-center",children:jsx("div",{className:"w-3 h-3 rounded-full border",style:{backgroundColor:ae.color||"#3B82F6",opacity:ae.parentId?.6:1,borderColor:ae.isMilestone?t.accent:"transparent",borderWidth:ae.isMilestone?"2px":"0px"},title:ae.isMilestone?"Milestone":ae.parentId?"Subtask":"Task"})}),Ue?jsx("input",{ref:ie,type:"text",value:K,onChange:q=>te(q.target.value),onKeyDown:q=>{q.key==="Enter"?pa(ae.id):q.key==="Escape"&&ya();},onBlur:()=>pa(ae.id),className:"flex-1 px-2 py-1 rounded border outline-none",style:{backgroundColor:t.bgPrimary,borderColor:t.accent,color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:"13px",fontWeight:500},onClick:q=>q.stopPropagation()}):jsxs(Fragment,{children:[jsx("span",{className:"flex-1",style:{color:ae.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:ae.parentId?"13px":"14px",fontWeight:ae.isMilestone?600:ae.parentId?400:600,letterSpacing:ae.parentId?"0":"-0.01em"},title:ae.name,children:ae.name}),He&&!Ue&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:q=>q.stopPropagation(),children:[jsx("button",{onClick:q=>N(ae,q),className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Create subtask",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx("button",{onClick:q=>{q.stopPropagation(),ue(ae);},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 ce=_.id==="startDate"?"startDate":"endDate",Ie=ae[ce],Dt=le?.taskId===ae.id&&le?.field===ce,Je=q=>q?(typeof q=="string"?new Date(q):q).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:q=>q.stopPropagation(),children:[jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors hover:bg-white/5",style:{color:t.textSecondary},onClick:q=>{if(Dt)xe(null);else {let Ae=q.currentTarget.getBoundingClientRect();xe({taskId:ae.id,field:ce,month:Ie?typeof Ie=="string"?new Date(Ie):Ie:new Date,position:{top:Ae.bottom+4,left:Ae.left}});}},children:[jsx(Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsx("span",{children:Je(Ie)})]}),Dt&&typeof document<"u"&&createPortal(jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>xe(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:le?.position.top,left:le?.position.left},onClick:q=>q.stopPropagation(),children:[jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let q=new Date,Ae=new Date(q);Ae.setDate(q.getDate()+1);let ot=new Date(q);ot.setDate(q.getDate()+7);let ne=new Date(q);return ne.setDate(q.getDate()+14),[{label:"Hoy",date:q},{label:"Ma\xF1ana",date:Ae},{label:"Pr\xF3xima semana",date:ot},{label:"2 semanas",date:ne}].map((xt,Le)=>jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:At=>At.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:At=>At.currentTarget.style.backgroundColor="transparent",onClick:()=>{h?.(ae.id,{[ce]:xt.date}),xe(null);},children:xt.label},Le))})(),jsx("div",{style:{borderTop:`1px solid ${t.border}`,margin:"0.25rem 0"}}),jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:q=>q.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:q=>q.currentTarget.style.backgroundColor="transparent",onClick:()=>{h?.(ae.id,{[ce]:void 0}),xe(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:()=>xe(q=>q?{...q,month:new Date(q.month.getFullYear(),q.month.getMonth()-1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronLeft,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})}),jsx("span",{className:"text-xs font-medium",style:{color:t.textPrimary},children:le?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>xe(q=>q?{...q,month:new Date(q.month.getFullYear(),q.month.getMonth()+1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:["D","L","M","M","J","V","S"].map((q,Ae)=>jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:q},Ae))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let q=le?.month||new Date,Ae=q.getFullYear(),ot=q.getMonth(),ne=new Date(Ae,ot,1).getDay(),Re=new Date(Ae,ot+1,0).getDate(),xt=new Date,Le=[];for(let st=ne-1;st>=0;st--)Le.push({day:new Date(Ae,ot,-st).getDate(),date:new Date(Ae,ot-1,new Date(Ae,ot,-st).getDate()),isCurrentMonth:false});for(let st=1;st<=Re;st++)Le.push({day:st,date:new Date(Ae,ot,st),isCurrentMonth:true});let At=42-Le.length;for(let st=1;st<=At;st++)Le.push({day:st,date:new Date(Ae,ot+1,st),isCurrentMonth:false});return Le.map((st,ga)=>{let zt=st.date.toDateString()===xt.toDateString(),kt=(Ie?typeof Ie=="string"?new Date(Ie):Ie:null)?.toDateString()===st.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:st.isCurrentMonth?kt?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:kt?"#3B82F6":"transparent",boxShadow:zt&&!kt?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{h?.(ae.id,{[ce]:st.date}),xe(null);},children:st.day},ga)})})()})]})]})]}),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:oe(ae)})});case "assignees":let va=r.filter(q=>ae.assignees?.some(Ae=>Ae.name===q.name||Ae.initials===q.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:q=>q.stopPropagation(),children:jsx(Hr,{assignedUsers:va,availableUsers:r,onChange:q=>{let Ae=q.map(ot=>({id:ot.id,name:ot.name,initials:ot.initials,color:ot.color}));h?.(ae.id,{assignees:Ae.length>0?Ae:void 0});}})});case "status":return jsx("div",{className:"flex items-center justify-center w-full",onClick:q=>q.stopPropagation(),children:jsx(Xl,{status:ae.status||"todo",onChange:q=>{h?.(ae.id,{status:q,progress:q==="completed"?100:ae.progress});}})});case "progress":return jsxs("div",{className:"flex items-center justify-center gap-2 w-full",children:[jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${ae.progress}%`,backgroundColor:ae.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:[ae.progress,"%"]})]});case "priority":let ua={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},E={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},ve=ua[ae.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:q=>q.stopPropagation(),children:jsx(zr,{priority:ve,onChange:q=>{q&&h?.(ae.id,{priority:E[q]||"medium"});}})});default:return null}},tt=_=>[{id:"hide",label:"Hide Column",icon:Rt.Hide,onClick:()=>d(_),disabled:_==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Rt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Rt.SortDesc,onClick:()=>{}}],Ge=_=>_.subtasks&&_.subtasks.length>0?[{id:"addSubtask",label:R?.contextMenu?.addSubtask||"Add Subtask",icon:Rt.Add,onClick:()=>{v?.(_.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:R?.contextMenu?.deleteTask||"Delete Task",icon:Rt.Delete,onClick:()=>{k?k(_.id,_.name):b?.([_.id]);}}]:[{id:"edit",label:R?.contextMenu?.editTask||"Edit Task",icon:Rt.Pencil,onClick:()=>{n?.(_);}},{id:"addSubtask",label:R?.contextMenu?.addSubtask||"Add Subtask",icon:Rt.Add,onClick:()=>{v?.(_.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:R?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Rt.MarkIncomplete,onClick:()=>{h?.(_.id,{status:"todo",progress:0});},disabled:_.status==="todo"},{id:"setInProgress",label:R?.contextMenu?.setInProgress||"Set In Progress",icon:Rt.SetInProgress,onClick:()=>{h?.(_.id,{status:"in-progress"});},disabled:_.status==="in-progress"},{id:"markComplete",label:R?.contextMenu?.markComplete||"Mark Complete",icon:Rt.MarkComplete,onClick:()=>{h?.(_.id,{status:"completed",progress:100});},disabled:_.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:R?.contextMenu?.splitTask||"Split Task",icon:Rt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:R?.contextMenu?.deleteTask||"Delete Task",icon:Rt.Delete,onClick:()=>{k?k(_.id,_.name):b?.([_.id]);}}],Be=u.filter(_=>_.visible),rt=Be.reduce((_,ae)=>_+ae.width,0);return jsxs("div",{className:"h-full",style:{backgroundColor:t.bgPrimary,minWidth:rt},children:[jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,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:Be.map((_,ae)=>{let Ee=ae===Be.length-1,Ue=_.id==="name";return jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${Ue?"":"justify-center"}`,style:{width:`${_.width}px`,minWidth:`${_.minWidth??(Ue?200:60)}px`,maxWidth:`${_.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:Ee?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:He=>{He.preventDefault(),Q({isOpen:true,x:He.clientX,y:He.clientY,type:"header",columnId:_.id});},onMouseEnter:He=>{He.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:He=>{He.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:_.label,children:_.label}),_.resizable&&jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:de===_.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:He=>{He.preventDefault(),He.stopPropagation(),be(_.id),J(He.clientX),G(_.width);},title:"Drag to resize column",children:jsx("div",{className:"absolute top-2 bottom-2 opacity-0 group-hover:opacity-100 transition-opacity",style:{left:"3px",width:"2px",backgroundColor:t.accent,borderRadius:"1px"}})})]},_.id)})}),jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.bgGrid,zIndex:5},children:[jsx(Cn,{columns:u,onToggleColumn:d,theme:t}),jsx("button",{onClick:()=>ze(!Pe),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"})}),Pe&&jsxs("div",{ref:at,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:_=>_.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:()=>ze(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxs("div",{className:"space-y-3 text-xs",children:[jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]}),jsx("div",{className:"gantt-taskgrid-content",style:{minHeight:Ea},children:ct.map(({task:_,level:ae},Ee)=>{let Ue=Xt(_.id),He=Ce===_.id,W=He&&Oe==="above",ce=He&&Oe==="below",Ie=He&&Oe==="child",Dt={};return Ie&&(Dt.backgroundColor=`${t.accent}15`,Dt.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":_.id,className:`flex items-center cursor-pointer group ${X===_.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:Ue?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:Ue?t.accentLight:Ie?`${t.accent}15`:Ee%2===0?t.bgPrimary:t.bgGrid,...Dt},onMouseEnter:()=>D(_.id),onMouseLeave:()=>D(null),onClick:Je=>{let ua=vo(e).map(q=>q.id),ve=navigator.platform.toUpperCase().indexOf("MAC")>=0?Je.metaKey:Je.ctrlKey;Fe(_.id,ua,ve,Je.shiftKey),s?.(_);},onDoubleClick:Je=>{Je.stopPropagation(),n?.(_);},onContextMenu:Je=>{Je.preventDefault(),Q({isOpen:true,x:Je.clientX,y:Je.clientY,type:"task",task:_}),p?.(_,Je);},whileHover:{backgroundColor:Ue?t.accentLight:t.hoverBg},children:[W&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),ce&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Be.map((Je,va)=>{let ua=va===Be.length-1,E=Je.id==="name";return jsx("div",{className:`px-4 flex items-center ${E?"justify-start":"justify-center"}`,style:{width:`${Je.width}px`,minWidth:`${Je.minWidth??(E?200:60)}px`,maxWidth:`${Je.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:ua?"none":`1px solid ${M===_.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:$e(Je,_,E?ae:0)},`${_.id}-${Je.id}`)})]},_.id)})}),jsx(yo,{isOpen:A.isOpen,x:A.x,y:A.y,items:A.type==="header"&&A.columnId?tt(A.columnId):A.type==="task"&&A.task?Ge(A.task):[],onClose:()=>Q({...A,isOpen:false}),theme:t}),mt&&vt&&X&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:vt.x+12,top:vt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let _=ct.find(ae=>ae.task.id===X)?.task;return _?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:_.name})}):null})()}),document.body)]})}function dc(e,t){let[a,r]=useState("none"),[o,s]=useState(0),[n,p]=useState(e),[m,i]=useState(t),[u,d]=useState(null),[g,h]=useState(null),[C,T]=useState(null),[c,b]=useState(null),[y,l]=useState(0),[x,v]=useState(0),[S,k]=useState(null),[w,R]=useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:p,ghostWidth:m,setGhostWidth:i,connectionLine:u,setConnectionLine:d,hoveredTaskId:g,setHoveredTaskId:h,activeZone:C,setActiveZone:T,draggedSegmentIndex:c,setDraggedSegmentIndex:b,draggedSegmentStartX:y,setDraggedSegmentStartX:l,segmentDragOffsetX:x,setSegmentDragOffsetX:v,hoveredSegmentIndex:S,setHoveredSegmentIndex:k,isHovered:w,setIsHovered:R,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(K,te)=>{r("none"),d(null),h(null),p(K),i(te),v(0),b(null),l(0);}}}function Sn({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:p,onClick:m,onDoubleClick:i,onContextMenu:u,onDateChange:d,onDependencyCreate:g,allTaskPositions:h=[],onDragMove:C,onHoverChange:T}){let c=dc(t,r),b=useRef(null),{dragMode:y,setDragMode:l,dragOffset:x,setDragOffset:v,ghostX:S,setGhostX:k,ghostWidth:w,setGhostWidth:R,connectionLine:M,setConnectionLine:D,hoveredTaskId:I,setHoveredTaskId:B,activeZone:K,setActiveZone:te,draggedSegmentIndex:ie,setDraggedSegmentIndex:de,draggedSegmentStartX:be,setDraggedSegmentStartX:$,segmentDragOffsetX:J,setSegmentDragOffsetX:U,hoveredSegmentIndex:G,setHoveredSegmentIndex:A,isHovered:Q,setIsHovered:X,isDragging:H,isResizing:Ce,isConnecting:Me,resetDragState:Oe}=c,ye=32,Ye=8,We=e.endDate&&e.endDate<new Date&&e.progress<100,et=e.isCriticalPath,vt=o.name==="neutral"||o.today==="#1C1917",Mt=e.status==="completed"||e.progress===100,mt={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},le=e.isCriticalPath||We?"#DC2626":e.color?e.color:e.priority&&mt[e.priority]?mt[e.priority]:o.taskBarPrimary,Pe=(N=>N>=80?20:N>=60?15:N>=50?12:10)(r),ze=r<50,at=r<40;useEffect(()=>{if(T)if(Q&&!H&&!e.segments){let N=a<100;T({task:e,x:t,y:a,width:r,height:ye,showBelow:N});}else T(null);},[Q,H,e,t,a,r,ye,T]);let Et=N=>N.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Fe=()=>{let N=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${N} day${N!==1?"s":""}`},Xt=N=>Math.round(N/s)*s,Ot=N=>{let ee=Math.round(N/s),se=new Date(n);return se.setDate(se.getDate()+ee),se},Nt=(N,ee)=>{for(let se of h){if(se.id===e.id)continue;let De=5;if(N>=se.x-De&&N<=se.x+se.width+De&&ee>=se.y-De&&ee<=se.y+se.height+De)return se.id}return null},ct=useCallback((N,ee,se)=>{N.preventDefault(),N.stopPropagation();let De=b.current?.ownerSVGElement;if(!De)return;let $e=De.createSVGPoint();$e.x=N.clientX,$e.y=N.clientY;let tt=$e.matrixTransform(De.getScreenCTM()?.inverse()),Ge=se!==void 0?se:t,Be=ee;if(!Be){let rt=tt.x-Ge;N.shiftKey?(Be="connect",D({x:t+r,y:a+ye/2})):N.ctrlKey||N.metaKey?Be="move":N.altKey?Be=rt<r/2?"resize-start":"resize-end":at?rt<r/2?Be="move":Be="resize-end":ze?rt<=Pe/2?Be="resize-start":rt>=r-Pe/2?Be="resize-end":Be="move":rt<=Pe?Be="resize-start":rt>=r-Pe?Be="resize-end":Be="move";}l(Be),X(false),te(null),Be==="move"?v(tt.x-Ge):Be==="connect"?D({x:t+r,y:a+ye/2}):v(0),k(Ge),R(r);},[t,r,a,ye]),Jt=useCallback(N=>{if(y==="none")return;let ee=b.current?.ownerSVGElement;if(!ee)return;let se=ee.createSVGPoint();se.x=N.clientX,se.y=N.clientY;let De=se.matrixTransform(ee.getScreenCTM()?.inverse());if(y==="connect"){D({x:De.x,y:De.y});let $e=Nt(De.x,De.y);B($e);}else if(y==="move"){let $e=De.x-x,tt=Xt($e);k(tt),R(r);let Ge=Math.round((tt-t)/s);if(C?.(e.id,Ge,true),e.segments&&e.segments.length>0&&ie!==null){let Be=tt-be;U(Be);}}else if(y==="resize-start"){let $e=De.x,tt=Xt($e),Ge=t+r-tt;Ge>=s&&(k(tt),R(Ge));}else if(y==="resize-end"){let $e=De.x,Ge=Xt($e)-t;Ge>=s&&R(Ge);}},[y,t,r,s,x,e,Xt,ie,be,Nt,B,D,k,R,U,C]),Ea=useCallback(()=>{if(y!=="none"){if(y==="connect")I&&g&&g(e,I),D(null),B(null);else {let N=e.endDate.getTime()-e.startDate.getTime(),ee,se,De=true;if(y==="move"){if(ee=Ot(S),se=new Date(ee.getTime()+N),e.segments&&e.segments.length>0&&ie!==null){let $e=Math.round(J/s),tt=e.segments.map((_,ae)=>{if(ae===ie){let Ee=new Date(_.startDate),Ue=new Date(_.endDate);return Ee.setDate(Ee.getDate()+$e),Ue.setDate(Ue.getDate()+$e),{startDate:Ee,endDate:Ue}}return _}),Ge=tt.flatMap(_=>[_.startDate,_.endDate]),Be=new Date(Math.min(...Ge.map(_=>_.getTime()))),rt=new Date(Math.max(...Ge.map(_=>_.getTime())));d?.({...e,segments:tt},Be,rt),Oe(t,r);return}}else y==="resize-start"?(ee=Ot(S),se=e.endDate,ee>se&&(console.warn("Invalid date range: start date must be before or equal to end date"),De=false)):y==="resize-end"?(ee=e.startDate,se=Ot(S+w),se<ee&&(console.warn("Invalid date range: end date must be after or equal to start date"),De=false)):De=false;De&&ee&&se&&(se.getTime()<ee.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,ee,se));}C?.(e.id,0,false),Oe(t,r);}},[y,S,w,e,d,I,g,t,r,s,Ot,J,ie,Oe,C]);useEffect(()=>{if(y==="none")return;let N=se=>{Jt(se);},ee=()=>{Ea();};return window.addEventListener("mousemove",N),window.addEventListener("mouseup",ee),()=>{window.removeEventListener("mousemove",N),window.removeEventListener("mouseup",ee);}},[y,Jt,Ea]);let oe=H&&!Me?S:t,ue=H&&!Me?w:r,pa=p.taskClass(e);return jsxs("g",{ref:b,onClick:()=>!H&&m?.(e),onDoubleClick:N=>{H||(N.stopPropagation(),i?.(e));},onContextMenu:N=>{N.preventDefault(),u?.(e,N);},onMouseEnter:()=>!H&&X(true),onMouseLeave:()=>{H||(X(false),te(null));},children:[jsx("rect",{x:t,y:a,width:r+40,height:ye,fill:"transparent",style:{pointerEvents:"all"}}),Q&&!H&&!ze&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:Pe,height:ye,fill:K==="resize-start"?o.accent:"transparent",opacity:K==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>te("resize-start"),onMouseDown:N=>ct(N,"resize-start")}),jsx("rect",{x:t+Pe,y:a,width:r-Pe*2,height:ye,fill:K==="move"?o.accent:"transparent",opacity:K==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>te("move"),onMouseDown:N=>ct(N,"move")}),jsx("rect",{x:t+r-Pe,y:a,width:Pe,height:ye,fill:K==="resize-end"?o.accent:"transparent",opacity:K==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>te("resize-end"),onMouseDown:N=>ct(N,"resize-end")})]}),Q&&!H&&at&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:r/2,height:ye,fill:K==="move"?o.accent:"transparent",opacity:K==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>te("move"),onMouseDown:N=>ct(N,"move")}),jsx("rect",{x:t+r/2,y:a,width:r/2,height:ye,fill:K==="resize-end"?o.accent:"transparent",opacity:K==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>te("resize-end"),onMouseDown:N=>ct(N,"resize-end")}),Q&&jsx(motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+ye-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),H&&!Me&&!e.segments&&jsx(motion.rect,{x:S,y:a,width:w,height:ye,rx:Ye,fill:o.accent,opacity:.5,stroke:o.accent,strokeWidth:2,strokeDasharray:"4 4",initial:{opacity:0},animate:{opacity:.6},transition:{duration:.15},style:{pointerEvents:"none"}}),!e.segments&&jsx(motion.rect,{x:oe,y:a,width:ue,height:ye,rx:Ye,fill:le,"data-task-class":pa,initial:{opacity:0,scale:.95},animate:{opacity:H&&!Me?.15:e.parentId?.6:Q?.9:.8,scale:Q&&!H?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:N=>ct(N),style:{cursor:H?Me?"crosshair":Ce?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsx("rect",{x:oe,y:a,width:ue*(e.progress/100),height:ye,rx:Ye,fill:le,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((N,ee)=>{let se=(N.startDate.getTime()-n.getTime())/864e5*s,$e=(N.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-se+s,tt=H&&y==="move"&&ie===ee,Ge=G===ee,Be=tt?se+J:se;return jsxs("g",{onMouseEnter:()=>!H&&A(ee),onMouseLeave:()=>!H&&A(null),children:[jsx(motion.rect,{x:Be,y:a,width:$e,height:ye,rx:Ye,fill:le,initial:{opacity:0,scale:.95},animate:{opacity:tt||e.parentId?.6:Ge?.9:.8,scale:Ge&&!H?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:rt=>{rt.stopPropagation(),de(ee),$(se),ct(rt,void 0,se);},style:{cursor:H?Me?"crosshair":Ce?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsx("rect",{x:Be,y:a,width:$e*(e.progress/100),height:ye,rx:Ye,fill:le,opacity:1,style:{pointerEvents:"none"}})]},`segment-${ee}`)}),vt&&(We||et)&&!e.segments&&jsxs(Fragment,{children:[et&&!We&&jsx("rect",{x:oe,y:a,width:ue,height:ye,rx:Ye,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),We&&jsx("rect",{x:oe,y:a,width:ue,height:ye,rx:Ye,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),ue>60&&!e.segments&&(()=>{let N=p.taskLabel(e),ee=typeof N=="string"?N:e.name,se=ee.length>Math.floor(ue/8)?`${ee.substring(0,Math.floor(ue/8))}...`:ee;return jsx("text",{x:oe+12,y:a+ye/2,dominantBaseline:"middle",fill:Mt?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:Mt?"line-through":"none"},children:se})})(),ue>100&&e.progress>0&&e.progress<100&&!H&&!e.segments&&jsxs("text",{x:oe+ue-12,y:a+ye/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}),e.status&&ue>80&&!H&&!e.segments&&jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsx("circle",{cx:oe+ue-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsx("circle",{cx:oe+ue-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(Q||Ce)&&!Me&&!e.segments&&jsxs(Fragment,{children:[jsxs("g",{children:[jsx("rect",{x:oe-2,y:a,width:16,height:ye,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>te("resize-start"),onMouseLeave:()=>te(null),onMouseDown:N=>{N.stopPropagation(),ct(N,"resize-start");}}),jsx(motion.rect,{x:oe+4,y:a+8,width:3,height:ye-16,rx:1.5,fill:K==="resize-start"||y==="resize-start"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]}),jsxs("g",{children:[jsx("rect",{x:oe+ue-14,y:a,width:16,height:ye,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>te("resize-end"),onMouseLeave:()=>te(null),onMouseDown:N=>{N.stopPropagation(),ct(N,"resize-end");}}),jsx(motion.rect,{x:oe+ue-7,y:a+8,width:3,height:ye-16,rx:1.5,fill:K==="resize-end"||y==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsx(AnimatePresence,{children:Q&&!H&&!e.segments&&jsxs(motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsx("circle",{cx:t+r+18,cy:a+ye/2,r:14,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>te("connect"),onMouseLeave:()=>te(null),onMouseDown:N=>{N.stopPropagation(),ct(N,"connect");}}),jsx(motion.circle,{cx:t+r+18,cy:a+ye/2,r:7,fill:o.accent,stroke:"#FFFFFF",strokeWidth:2,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:K==="connect"?1.3:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}}),jsx("text",{x:t+r+32,y:a+ye/2,dominantBaseline:"middle",fill:K==="connect"?o.accent:o.textTertiary,fontSize:K==="connect"?"11":"10",fontWeight:K==="connect"?"600":"400",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),Me&&M&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:t+r,y1:a+ye/2,x2:M.x,y2:M.y,stroke:I?o.statusCompleted:o.accent,strokeWidth:I?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:I?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:M.x,cy:M.y,r:I?8:6,fill:I?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),I&&jsx(motion.text,{x:M.x+15,y:M.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:M.x+10},animate:{opacity:1,x:M.x+15},transition:{duration:.2},children:"Connect"})]}),(Q||H)&&!Me&&!e.segments&&jsx(motion.rect,{x:oe-2,y:a-2,width:ue+4,height:ye+4,rx:Ye+2,fill:"none",stroke:H?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:H?.6:.4,initial:{opacity:0},animate:{opacity:H?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Ce&&jsxs(Fragment,{children:[jsx("line",{x1:S,y1:0,x2:S,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsx("line",{x1:S+w,y1:0,x2:S+w,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:Q&&!H&&!e.segments&&!T&&(()=>{let se=a<100,De=se?a+ye+13:a-82-13,$e=se?`M ${oe+ue/2-6} ${a+ye+3} L ${oe+ue/2} ${a+ye+13} L ${oe+ue/2+6} ${a+ye+3}`:`M ${oe+ue/2-6} ${a-13} L ${oe+ue/2} ${a-3} L ${oe+ue/2+6} ${a-13}`,tt=De+22,Ge=De+40,Be=De+55,rt=De+70,_=se?De+82-5:a-18;return jsxs(motion.g,{initial:{opacity:0,y:se?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:se?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:$e,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsx("rect",{x:oe+ue/2-120,y:De,width:240,height:82,rx:8,fill:o.bgSecondary,stroke:o.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("text",{x:oe+ue/2,y:tt,textAnchor:"middle",fill:o.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsx("text",{x:oe+ue/2-110,y:Ge,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:oe+ue/2-70,y:Ge,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Et(e.startDate)}),jsx("text",{x:oe+ue/2-110,y:Be,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:oe+ue/2-70,y:Be,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Et(e.endDate)}),jsx("text",{x:oe+ue/2+10,y:Ge,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:oe+ue/2+65,y:Ge,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Fe()}),jsx("text",{x:oe+ue/2+10,y:Be,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:oe+ue/2+65,y:Be,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxs(Fragment,{children:[jsx("text",{x:oe+ue/2-110,y:rt,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:oe+ue/2-50,y:rt,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(ae=>ae.name).join(", ").substring(0,30),e.assignees.map(ae=>ae.name).join(", ").length>30?"...":""]})]}),!se&&jsx("text",{x:oe+ue/2,y:_,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:at?"Left: move \u2022 Right: resize":ze?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}function pc({tooltipData:e,theme:t}){if(!e)return null;let {task:a,x:r,y:o,width:s,height:n,showBelow:p}=e,m=82,i=13,u=p?o+n+i:o-m-i,d=p?`M ${r+s/2-6} ${o+n+3} L ${r+s/2} ${o+n+13} L ${r+s/2+6} ${o+n+3}`:`M ${r+s/2-6} ${o-13} L ${r+s/2} ${o-3} L ${r+s/2+6} ${o-13}`,g=u+22,h=u+40,C=u+55,T=u+70,c=x=>x.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),b=()=>{if(!a.startDate||!a.endDate)return "N/A";let x=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${x} day${x!==1?"s":""}`};return jsx(AnimatePresence,{children:jsxs(motion.g,{initial:{opacity:0,y:p?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:p?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsx("rect",{x:r+s/2-120,y:u,width:240,height:m,rx:8,fill:t.bgSecondary,stroke:t.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("text",{x:r+s/2,y:g,textAnchor:"middle",fill:t.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:a.name.length>28?`${a.name.substring(0,28)}...`:a.name}),jsx("text",{x:r+s/2-110,y:h,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:r+s/2-70,y:h,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.startDate?c(a.startDate):"N/A"}),jsx("text",{x:r+s/2-110,y:C,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:r+s/2-70,y:C,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?c(a.endDate):"N/A"}),jsx("text",{x:r+s/2+10,y:h,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:r+s/2+65,y:h,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:b()}),jsx("text",{x:r+s/2+10,y:C,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:r+s/2+65,y:C,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.progress,"%"]}),a.assignees&&a.assignees.length>0&&jsxs(Fragment,{children:[jsx("text",{x:r+s/2-110,y:T,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:r+s/2-50,y:T,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.assignees.map(x=>x.name).join(", ").substring(0,30),a.assignees.map(x=>x.name).join(", ").length>30?"...":""]})]})]})})}function Mn({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:p=false}){let[m,i]=useState(false),[u,d]=useState(null),g=r-t,h=g>0,C=Math.abs(g)<5,c=5,b=20,y=!C&&a<=e,l,x;if(C)if(x=(e+a)/2,n==="squared")l=`M ${e} ${t} L ${a} ${r}`;else {let ie=Math.min(Math.abs(a-e)/3,30);l=`M ${e} ${t} C ${e+ie} ${t}, ${a-ie} ${r}, ${a} ${r}`;}else if(x=a-b,y){let de=e+15,be=a-b,$=h?t+20:t-20;x=be,n==="squared"?l=`M ${e} ${t} L ${de} ${t} L ${de} ${$} L ${be} ${$} L ${be} ${r} L ${a} ${r}`:h?l=`M ${e} ${t} L ${de-c} ${t} Q ${de} ${t} ${de} ${t+c} L ${de} ${$-c} Q ${de} ${$} ${de-c} ${$} L ${be+c} ${$} Q ${be} ${$} ${be} ${$+c} L ${be} ${r-c} Q ${be} ${r} ${be+c} ${r} L ${a} ${r}`:l=`M ${e} ${t} L ${de-c} ${t} Q ${de} ${t} ${de} ${t-c} L ${de} ${$+c} Q ${de} ${$} ${de-c} ${$} L ${be+c} ${$} Q ${be} ${$} ${be} ${$-c} L ${be} ${r+c} Q ${be} ${r} ${be+c} ${r} L ${a} ${r}`;}else n==="squared"?l=`M ${e} ${t} L ${x} ${t} L ${x} ${r} L ${a} ${r}`:h?l=`M ${e} ${t} L ${x-c} ${t} Q ${x} ${t} ${x} ${t+c} L ${x} ${r-c} Q ${x} ${r} ${x+c} ${r} L ${a} ${r}`:l=`M ${e} ${t} L ${x-c} ${t} Q ${x} ${t} ${x} ${t-c} L ${x} ${r+c} Q ${x} ${r} ${x+c} ${r} L ${a} ${r}`;let v=5,S=`M ${a} ${r} L ${a-v} ${r-v*.5} M ${a} ${r} L ${a-v} ${r+v*.5}`,k=o.dependency,w=o.dependencyHover||k,R="#f87171",M="rgba(248, 113, 113, 0.15)",D=x,I=(t+r)/2;if(u)if(C)D=Math.max(e+10,Math.min(a-10,u.x)),I=t;else if(y){let ie=e+15,de=a-b,be=h?t+20:t-20,$=[[e,t,ie,t],[ie,t,ie,be],[ie,be,de,be],[de,be,de,r],[de,r,a,r]],J=1/0,U={x:D,y:I};for(let G of $){let A=B(u.x,u.y,G[0],G[1],G[2],G[3]),Q=Math.hypot(u.x-A.x,u.y-A.y);Q<J&&(J=Q,U=A);}D=U.x,I=U.y;}else {let ie=[[e,t,x,t],[x,t,x,r],[x,r,a,r]],de=1/0,be={x:D,y:I};for(let $ of ie){let J=B(u.x,u.y,$[0],$[1],$[2],$[3]),U=Math.hypot(u.x-J.x,u.y-J.y);U<de&&(de=U,be=J);}D=be.x,I=be.y;}function B(ie,de,be,$,J,U){let G=J-be,A=U-$,Q=G*G+A*A;if(Q===0)return {x:be,y:$};let X=((ie-be)*G+(de-$)*A)/Q;return X=Math.max(0,Math.min(1,X)),{x:be+X*G,y:$+X*A}}let K=ie=>{let de=ie.currentTarget.ownerSVGElement;if(!de)return;let be=de.getBoundingClientRect();d({x:ie.clientX-be.left,y:ie.clientY-be.top});},te=()=>{i(false),d(null);};return p?jsxs("g",{onMouseLeave:te,onMouseMove:K,children:[jsx("path",{d:l,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsx("path",{d:l,fill:"none",stroke:w,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsx("path",{d:l,fill:"none",stroke:w,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("path",{d:S,fill:"none",stroke:w,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("circle",{cx:a,cy:r,r:4,fill:w,opacity:.9,style:{pointerEvents:"none"}}),s&&jsxs(motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:ie=>{ie.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsx("circle",{cx:D,cy:I,r:9,fill:M,stroke:R,strokeWidth:1.5}),jsx("line",{x1:D-3,y1:I-3,x2:D+3,y2:I+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"}),jsx("line",{x1:D+3,y1:I-3,x2:D-3,y2:I+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"})]})]}):jsxs("g",{onMouseEnter:()=>i(true),onMouseLeave:te,onMouseMove:K,style:{cursor:s?"pointer":"default"},children:[jsx("path",{d:l,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsx(motion.path,{d:l,fill:"none",stroke:m?w:k,strokeWidth:m?2.5:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}}}),jsx(motion.path,{d:S,fill:"none",stroke:m?w:k,strokeWidth:m?2.5:2,strokeLinecap:"round",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3}}),jsx(motion.circle,{cx:a,cy:r,r:m?4:3,fill:m?w:k,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15}}),m&&s&&jsxs(motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.15},onClick:ie=>{ie.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsx("circle",{cx:D,cy:I,r:9,fill:M,stroke:R,strokeWidth:1.5}),jsx("line",{x1:D-3,y1:I-3,x2:D+3,y2:I+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"}),jsx("line",{x1:D+3,y1:I-3,x2:D-3,y2:I+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"})]})]})}function Fn({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=useState(false),p=16,m=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxs("g",{onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsx(motion.circle,{cx:t,cy:a+16,r:p+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsx(motion.rect,{x:t-p/2,y:a+16-p/2,width:p,height:p,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-(p+4)/2,y:a+16-(p+4)/2,width:p+4,height:p+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsx(AnimatePresence,{children:s&&jsxs(motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:m(e.startDate)}),e.isCriticalPath&&jsxs("g",{children:[jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var fe={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=i=>{i.forEach(u=>{u.dependencies&&r.set(u.id,u.dependencies),u.subtasks&&o(u.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,p=new Set,m=i=>{if(!n.has(i)){n.add(i),p.add(i);let u=r.get(i)||[];for(let d of u){if(!n.has(d)&&m(d))return true;if(p.has(d))return true}}return p.delete(i),false};return m(a)},flattenTasks:e=>{let t=[],a=r=>{r.forEach(o=>{t.push(o),o.subtasks&&o.subtasks.length>0&&a(o.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=fe.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=fe.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=fe.findTaskById(e,o);if(s)a.unshift(s),o=s.parentId;else break}return a},exportToJSON:e=>JSON.stringify(e,null,2),importFromJSON:e=>{try{let t=JSON.parse(e);if(!Array.isArray(t))throw new Error("Invalid JSON: expected an array of tasks");return t.forEach((a,r)=>{if(!a.id||!a.name)throw new Error(`Invalid task at index ${r}: missing required fields (id, name)`)}),t}catch(t){throw new Error(`Failed to import tasks: ${t instanceof Error?t.message:"Unknown error"}`)}},exportToCSV:e=>{let t=fe.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let s=[o.id,`"${o.name.replace(/"/g,'""')}"`,o.startDate?o.startDate.toISOString().split("T")[0]:"",o.endDate?o.endDate.toISOString().split("T")[0]:"",o.progress.toString(),o.status||"",o.dependencies?.join(";")||""];r.push(s.join(","));}),r.join(`
112
+ `)},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=fe.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=fe.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)=>fe.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=fe.findTaskById(e,t);return !a||!a.dependencies?[]:fe.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>fe.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>fe.flattenTasks(e).filter(r=>!r.startDate||!r.endDate?false:r.startDate<=a&&r.endDate>=t),sortByStartDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.startDate||!r.startDate)return 0;let o=a.startDate.getTime()-r.startDate.getTime();return t?o:-o}),sortByEndDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.endDate||!r.endDate)return 0;let o=a.endDate.getTime()-r.endDate.getTime();return t?o:-o}),sortByProgress:(e,t=true)=>[...e].sort((a,r)=>{let o=a.progress-r.progress;return t?o:-o}),calculateTotalProgress:e=>{let t=fe.flattenTasks(e);if(t.length===0)return 0;let a=t.reduce((r,o)=>r+o.progress,0);return Math.round(a/t.length)},getTaskByPath:(e,t)=>{let a=e,r;for(let o=0;o<t.length;o++){let s=t[o];if(!a||s===void 0||s>=a.length||(r=a[s],!r))return;o<t.length-1&&(a=r.subtasks||[]);}return r},cloneTask:(e,t)=>({...e,id:t||`${e.id}-copy`,subtasks:e.subtasks?.map(a=>fe.cloneTask(a))}),exportToPDF:async(e,t="gantt-chart.pdf")=>{try{if(!e||e.length===0){alert("No tasks available to export to PDF");return}let{jsPDF:a}=await import('jspdf'),{default:r}=await import('jspdf-autotable'),o=new a,s=fe.flattenTasks(e);if(s.length===0){alert("No tasks found to export");return}o.setFontSize(16),o.text("Gantt Chart - Task List",14,20);let n=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],p=s.map(m=>{let i=m.startDate&&m.endDate?fe.calculateDuration(m.startDate,m.endDate):0;return [m.name,m.startDate?fe.formatDate(m.startDate):"N/A",m.endDate?fe.formatDate(m.endDate):"N/A",i>0?`${i} days`:"N/A",`${m.progress}%`,m.status||"N/A"]});r(o,{head:n,body:p,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),o.save(t);}catch(a){throw a}},exportToExcel:async(e,t="gantt-chart.xlsx")=>{let a=await import('xlsx'),o=fe.flattenTasks(e).map(m=>{let i=m.startDate&&m.endDate?fe.calculateDuration(m.startDate,m.endDate):0;return {"Task ID":m.id,"Task Name":m.name,"Start Date":m.startDate?fe.formatDate(m.startDate):"","End Date":m.endDate?fe.formatDate(m.endDate):"","Duration (days)":i>0?i:"","Progress (%)":m.progress,Status:m.status||"",Assignees:m.assignees?.map(u=>u.name).join(", ")||"",Dependencies:m.dependencies?.join(", ")||"","Is Milestone":m.isMilestone?"Yes":"No","Parent ID":m.parentId||"",Level:m.level||0}}),s=a.utils.json_to_sheet(o),n=[{wch:15},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:20},{wch:12},{wch:15},{wch:8}];s["!cols"]=n;let p=a.utils.book_new();a.utils.book_append_sheet(p,s,"Gantt Tasks"),a.writeFile(p,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=fe.flattenTasks(e),o=new Map;r.forEach((g,h)=>{o.set(g.id,h+1);});let s=g=>g.toISOString().replace("Z",""),n=fe.getEarliestStartDate(e)||new Date,p=fe.getLatestEndDate(e)||new Date,m=r.map((g,h)=>{let C=o.get(g.id),T=g.startDate&&g.endDate?fe.calculateDuration(g.startDate,g.endDate):0,c=(g.dependencies||[]).filter(b=>o.has(b)).map(b=>`
113
113
  <PredecessorLink>
114
114
  <PredecessorUID>${o.get(b)}</PredecessorUID>
115
115
  <Type>1</Type>
@@ -339,9 +339,9 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
339
339
  </Calendars>
340
340
  <Tasks>${m}
341
341
  </Tasks>
342
- </Project>`,u=new Blob([i],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(u),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=ue.flattenTasks(e),a=t.filter(i=>i.startDate&&i.endDate);if(a.length===0)return [];let r=new Map,o=i=>{if(r.has(i.id))return;let u=i.startDate&&i.endDate?ue.calculateDuration(i.startDate,i.endDate):0,d=0;if(i.dependencies&&i.dependencies.length>0)for(let h of i.dependencies){let C=t.find(T=>T.id===h);if(C){o(C);let T=r.get(h)?.ef||0;d=Math.max(d,T);}}let g=d+u;r.set(i.id,{es:d,ef:g});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),n=new Map,p=i=>{if(n.has(i.id))return;let u=i.startDate&&i.endDate?ue.calculateDuration(i.startDate,i.endDate):0,d=t.filter(C=>C.dependencies&&C.dependencies.includes(i.id)),g=s;if(d.length>0)for(let C of d){p(C);let T=n.get(C.id)?.ls||0;g=Math.min(g,T);}let h=g-u;n.set(i.id,{ls:h,lf:g});};a.forEach(p);let m=[];for(let i of a){let u=r.get(i.id),d=n.get(i.id);if(u&&d){let g=d.ls-u.es;Math.abs(g)<.01&&m.push(i.id);}}return m},calculateSlack:(e,t)=>{let a=ue.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(ue.calculateCriticalPath(e).includes(t))return 0;let o=ue.getDependentTasks(e,t);if(o.length===0){let p=ue.getLatestEndDate(e);if(!p)return null;let m=ue.calculateDuration(a.endDate,p);return Math.max(0,m)}let s=o.filter(p=>p.startDate).map(p=>p.startDate.getTime()).sort((p,m)=>p-m)[0];if(!s)return null;let n=ue.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>ue.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=ue.findTaskById(e,t);if(!r||!r.endDate)return e;let o=ue.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let n of o){if(!n.startDate||!n.endDate)continue;let p=ue.calculateDuration(n.startDate,n.endDate),m;a!==void 0?(m=new Date(n.startDate),m.setDate(m.getDate()+a)):(m=new Date(r.endDate),m.setDate(m.getDate()+1));let i=ue.calculateEndDate(m,p),u=d=>d.map(g=>g.id===n.id?{...g,startDate:m,endDate:i}:g.subtasks?{...g,subtasks:u(g.subtasks)}:g);s=u(s),s=ue.autoScheduleDependents(s,n.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,n,p)=>{if(a===0)return [];let m=[],i=o.getTime(),u=1e3*60*60*24,d=ue.findTaskById(e,t);if(!d||!d.endDate)return [];let g=(h,C,T=new Set)=>{if(T.has(h))return;T.add(h);let c=ue.getDependentTasks(e,h);for(let b of c){if(!b.startDate||!b.endDate)continue;let y=r.findIndex(D=>D.id===b.id);if(y===-1)continue;let l=b.startDate.getTime(),v=(b.endDate.getTime()-l)/u,k=(l-i)/u*s,w=k+C*s,B=Math.max(v*s,s),M=p+y*n+12;m.push({taskId:b.id,taskName:b.name,originalX:k,previewX:w,width:B,y:M,rowIndex:y,daysDelta:C,color:b.color}),g(b.id,C,T);}};return g(t,a),m},splitTask:(e,t,a,r=3)=>{let o=ue.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let n=new Date(a);n.setDate(n.getDate()+r);let p=new Date(o.endDate);p.setDate(p.getDate()+r);let m=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:p}],i=u=>u.map(d=>d.id===o.id?{...d,endDate:p,segments:m}:d.subtasks?{...d,subtasks:i(d.subtasks)}:d);return i(e)}};function In({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,templates:p,dependencyLineStyle:m="curved",onTaskClick:i,onTaskDblClick:u,onTaskContextMenu:d,onTaskDateChange:g,onDependencyCreate:h,onDependencyDelete:C}){let[c,b]=useState([]),[y,l]=useState(null),x=useCallback(O=>{l(O);},[]),v=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),S=r==="day"?60:r==="week"?20:8,k=v*S*n,w=O=>{let V=new Date(Date.UTC(O.getFullYear(),O.getMonth(),O.getDate())),$=V.getUTCDay()||7;V.setUTCDate(V.getUTCDate()+4-$);let G=new Date(Date.UTC(V.getUTCFullYear(),0,1));return Math.ceil(((V.getTime()-G.getTime())/864e5+1)/7)},B=O=>{let V=O.getDay();return V===0||V===6},M=useCallback(O=>{let V=Math.round(O/(S*n)),$=new Date(o);return $.setDate($.getDate()+V),$},[o,S,n]),D=useCallback((O,V)=>{if(V.startDate&&V.endDate)return;let $=O.currentTarget.ownerSVGElement;if(!$)return;let G=$.createSVGPoint();G.x=O.clientX,G.y=O.clientY;let A=G.matrixTransform($.getScreenCTM()?.inverse()),X=M(A.x),q=new Date(X);q.setDate(q.getDate()+1),g?.(V,X,q);},[M,g]),I=useMemo(()=>{let O=A=>A.map(X=>{if(X.subtasks&&X.subtasks.length>0){let q=O(X.subtasks),U=q.filter(fe=>fe.startDate&&fe.endDate);if(U.length>0){let fe=U.map(Ye=>Ye.startDate.getTime()),Me=U.map(Ye=>Ye.endDate.getTime()),Oe=new Date(Math.min(...fe)),he=new Date(Math.max(...Me));return {...X,subtasks:q,startDate:Oe,endDate:he}}return {...X,subtasks:q}}return X}),V=(A,X=[])=>{for(let q of A)X.push(q),q.subtasks&&q.subtasks.length>0&&(q.isExpanded===void 0||q.isExpanded)&&V(q.subtasks,X);return X},$=O(e);return V($)},[e]),R=useCallback(O=>{if(!O.startDate||!O.endDate)return {x:0,width:0};let V=O.startDate.getTime(),$=O.endDate.getTime(),G=o.getTime(),A=(V-G)/(1e3*60*60*24),X=($-V)/(1e3*60*60*24),q=A*S*n,U=Math.max(S*n,40),fe=Math.max(X*S*n,U);return {x:q,width:fe}},[o,S,n]),Y=useMemo(()=>I.filter(O=>O.startDate&&O.endDate).map(O=>{let{x:V,width:$}=R(O),A=I.findIndex(X=>X.id===O.id)*a+12;return {id:O.id,x:V,y:A,width:$,height:32}}),[I,R]),te=useCallback((O,V,$)=>{if(!$||V===0){b([]);return}let G=ue.calculateCascadePreview(e,O,V,I,o,S*n,a,48);b(G);},[e,I,o,S,n,a,48]),ye=useMemo(()=>{let O=[],V=new Date(o);for(;V<=s;){let A=(V.getTime()-o.getTime())/864e5*S*n;if(r==="day")O.push({date:new Date(V),label:V.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:A}),V.setDate(V.getDate()+1);else if(r==="week"){let X=w(V);O.push({date:new Date(V),label:`Week ${X}`,x:A}),V.setDate(V.getDate()+7);}else O.push({date:new Date(V),label:V.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:A}),V.setMonth(V.getMonth()+1);}return O},[o,s,r,S,n]),De=useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*S*n,[o,S,n]),Se=Math.max(I.length*a,552);return jsxs("div",{className:"w-full h-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary,overflow:"visible"},children:[jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.bgGrid,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:jsxs("svg",{width:Math.max(k,1e3),height:47,style:{display:"block"},children:[jsx("rect",{x:0,y:0,width:Math.max(k,1e3),height:48,fill:t.bgGrid}),ye.map((O,V)=>jsxs("g",{children:[V>0&&jsx("line",{x1:O.x,y1:0,x2:O.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsx("text",{x:O.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:O.label})]},`header-${V}`)),De>=0&&De<=k&&jsx("circle",{cx:De,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxs("svg",{width:Math.max(k,1e3),height:Se,style:{display:"block",flexShrink:0,overflow:"visible"},children:[jsxs("defs",{children:[jsx("filter",{id:"shadow",children:jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})})]}),jsx("rect",{x:0,y:0,width:Math.max(k,1e3),height:Se,fill:t.bgPrimary}),ye.map((O,V)=>{let $=ye[V+1]?.x||k,G=B(O.date);return jsxs("g",{children:[G&&jsx("rect",{x:O.x,y:0,width:$-O.x,height:I.length*a,fill:t.bgWeekend,opacity:1}),V>0&&jsx("line",{x1:O.x,y1:0,x2:O.x,y2:I.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},V)}),I.map((O,V)=>{let $=O.startDate&&O.endDate;return jsxs("g",{children:[jsx("rect",{x:0,y:V*a,width:k,height:a,fill:V%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-${O.id}`),!$&&jsxs(Fragment,{children:[jsx("rect",{x:0,y:V*a,width:k,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:G=>D(G,O),onMouseEnter:G=>{G.currentTarget.setAttribute("fill",t.accentLight),G.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:G=>{G.currentTarget.setAttribute("fill","transparent"),G.currentTarget.setAttribute("opacity","1");}},`clickable-${O.id}`),jsx("text",{x:De>0?De:100,y:V*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:"Click to set dates..."},`placeholder-${O.id}`)]})]},`row-group-${O.id}`)}),I.map((O,V)=>{if(!O.startDate||!O.endDate)return null;let{x:$,width:G}=R(O),A=V*a+12,X=O.subtasks&&O.subtasks.length>0&&!O.isMilestone;return O.isMilestone?jsx(Fn,{task:O,x:$+G/2,y:A+16,theme:t,onClick:i},O.id):X?jsxs("g",{onClick:()=>i?.(O),onContextMenu:q=>{q.preventDefault(),q.stopPropagation(),d?.(O,q);},style:{cursor:"default"},children:[jsx("rect",{x:$,y:A,width:G,height:32,fill:t.primary,opacity:.25,rx:6}),jsx("line",{x1:$,y1:A,x2:$+G,y2:A,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsx("line",{x1:$,y1:A,x2:$,y2:A+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsx("line",{x1:$+G,y1:A,x2:$+G,y2:A+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsx("line",{x1:$,y1:A+32,x2:$+G,y2:A+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),G>60&&jsx("text",{x:$+12,y:A+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:O.name})]},O.id):jsx(Sn,{task:O,x:$,y:A,width:G,theme:t,dayWidth:S*n,startDate:o,templates:p,onClick:i,onDoubleClick:u,onContextMenu:d,onDateChange:g,onDependencyCreate:h,allTaskPositions:Y,onDragMove:te,onHoverChange:x},O.id)}),I.map((O,V)=>!O.dependencies||O.dependencies.length===0||!O.startDate||!O.endDate?null:O.dependencies.map($=>{let G=I.find(he=>he.id===$);if(!G||!G.startDate||!G.endDate)return null;let A=I.findIndex(he=>he.id===$),X=R(G),q=R(O),U=X.x+X.width,fe=A*a+28,Me=q.x,Oe=V*a+28;return jsx(Mn,{x1:U,y1:fe,x2:Me,y2:Oe,theme:t,lineStyle:m,onDelete:()=>C?.(O.id,$)},`dep-${$}-${O.id}`)})),c.map(O=>jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:O.previewX,y:O.y-48,width:O.width,height:32,rx:8,fill:O.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(O.daysDelta)>0&&jsx("text",{x:O.previewX+O.width/2,y:O.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:O.daysDelta>0?`+${O.daysDelta}d`:`${O.daysDelta}d`})]},`cascade-preview-${O.taskId}`)),De>=0&&De<=k&&jsx("line",{x1:De,y1:0,x2:De,y2:Se,stroke:t.today,strokeWidth:1,opacity:1,style:{pointerEvents:"none"}}),y&&jsx(pc,{tooltipData:y,theme:t})]})]})}var m0=['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"'],hc=()=>jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707"}),jsx("circle",{cx:"12",cy:"12",r:"4"})]}),p0=()=>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"})}),u0=()=>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"})}),g0=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M5 12h14"})}),f0=()=>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 Bn({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:p,onDependencyDelete:m}){let[i,u]=useState(false),[d,g]=useState(false),[h,C]=useState([]),[T,c]=useState(""),[b,y]=useState(false),[l,x]=useState(true),v=useRef(null),S=useRef(null),k=useRef(null),{enabled:w=true,placeholder:B='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:M="bottom-right",onCommand:D,suggestions:I=m0,maxHistory:R=50,persistHistory:Y}=a,te=Y?.storageKey||"gantt-ai-history",ye=Y?.maxMessages??5;useEffect(()=>{if(Y?.enabled)try{let G=localStorage.getItem(te);if(G){let X=JSON.parse(G).map(q=>({...q,timestamp:new Date(q.timestamp)}));C(X.slice(-ye));}}catch(G){console.warn("[GanttAIAssistant] Failed to load persisted history:",G);}},[Y?.enabled,te,ye]),useEffect(()=>{if(Y?.enabled&&h.length>0)try{let G=h.filter(A=>!A.isLoading).slice(-ye);localStorage.setItem(te,JSON.stringify(G));}catch(G){console.warn("[GanttAIAssistant] Failed to persist history:",G);}},[h,Y?.enabled,te,ye]),useEffect(()=>{S.current&&S.current.scrollIntoView({behavior:"smooth"});},[h]),useEffect(()=>{i&&!d&&v.current&&setTimeout(()=>v.current?.focus(),100);},[i,d]);let De=useCallback(G=>{if(G.success)switch(G.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":G.taskId&&G.updates&&o?.(G.taskId,G.updates);break;case "create_task":G.newTask&&s?.(G.newTask);break;case "delete_task":G.taskId&&n?.(G.taskId);break;case "link_tasks":G.dependencyFrom&&G.dependencyTo&&p?.(G.dependencyFrom,G.dependencyTo);break;case "unlink_tasks":G.taskId&&G.dependencyFrom&&m?.(G.taskId,G.dependencyFrom);break}},[o,s,n,p,m]),Se=useCallback(async G=>{if(!G.trim()||b)return;let A={id:`user-${Date.now()}`,role:"user",content:G,timestamp:new Date};C(q=>[...q.slice(-(R-1)),A]),c(""),x(false),y(true);let X={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};C(q=>[...q,X]);try{if(D){let q=await D(G,e);C(U=>{let fe=U.filter(Oe=>!Oe.isLoading),Me={id:`assistant-${Date.now()}`,role:"assistant",content:q.message,timestamp:new Date,command:q};return [...fe,Me]}),De(q);}else C(q=>[...q.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(q){C(U=>[...U.filter(Me=>!Me.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${q instanceof Error?q.message:"Unknown error"}`,timestamp:new Date}]);}finally{y(false);}},[b,R,D,e,De]),O=G=>{G.preventDefault(),Se(T);},V=G=>{c(G),v.current?.focus();};if(useEffect(()=>{let G=A=>{(A.metaKey||A.ctrlKey)&&A.key==="k"&&(A.preventDefault(),u(X=>!X),i||g(false)),A.key==="Escape"&&i&&u(false);};return document.addEventListener("keydown",G),()=>document.removeEventListener("keydown",G)},[i]),useEffect(()=>{if(!i)return;let G=X=>{let q=X.target;k.current&&!k.current.contains(q)&&u(false);},A=setTimeout(()=>{document.addEventListener("mousedown",G);},100);return ()=>{clearTimeout(A),document.removeEventListener("mousedown",G);}},[i]),!w)return null;let $={"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(lt,{children:[jsx(AnimatePresence,{children:!i&&jsxs(motion.button,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},className:`fixed ${$[M]} z-[99999] flex items-center gap-2 px-4 py-3 rounded-full shadow-lg transition-colors`,style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"white",boxShadow:"0 4px 20px rgba(59, 130, 246, 0.4)"},onClick:()=>u(true),children:[jsx(hc,{}),jsx("span",{className:"text-sm font-medium",children:"AI Assistant"}),jsx("kbd",{className:"hidden sm:inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] font-mono rounded bg-white/20",children:"\u2318K"})]})}),jsx(AnimatePresence,{children:i&&jsxs(motion.div,{ref:k,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:d?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${$[M]} z-[99999] w-96 rounded-2xl overflow-hidden shadow-2xl flex flex-col`,style:{background:t.bgPrimary,border:`1px solid ${t.border}`,boxShadow:`0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px ${t.border}`},children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)"},children:[jsxs("div",{className:"flex items-center gap-2 text-white",children:[jsx(hc,{}),jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>g(G=>!G),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsx(g0,{})}),jsx("button",{onClick:()=>u(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsx(u0,{})})]})]}),jsx(AnimatePresence,{children:!d&&jsxs(motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[h.length===0&&l&&jsxs("div",{className:"space-y-3",children:[jsx("p",{className:"text-sm text-center",style:{color:t.textSecondary},children:"Try asking me to edit your Gantt chart:"}),jsx("div",{className:"flex flex-wrap gap-2",children:I.slice(0,4).map((G,A)=>jsx("button",{onClick:()=>V(G),className:"text-xs px-3 py-1.5 rounded-full transition-colors",style:{background:t.bgSecondary,color:t.textSecondary,border:`1px solid ${t.border}`},children:G.length>30?G.slice(0,30)+"...":G},A))})]}),h.map(G=>jsx(motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${G.role==="user"?"justify-end":"justify-start"}`,children:jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${G.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:G.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:G.role==="user"?"white":t.textPrimary},children:[G.isLoading?jsx(f0,{}):jsx("p",{className:"text-sm whitespace-pre-wrap",children:G.content}),G.command&&jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:G.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:G.command.success?"#10B981":"#EF4444"},children:[G.command.success?"\u2713":"\u2717",jsx("span",{className:"capitalize",children:G.command.type.replace(/_/g," ")})]})]})},G.id)),jsx("div",{ref:S})]}),jsxs("form",{onSubmit:O,className:"p-3 border-t",style:{borderColor:t.border},children:[jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:t.bgSecondary,border:`1px solid ${t.border}`},children:[jsx("input",{ref:v,type:"text",value:T,onChange:G=>c(G.target.value),placeholder:B,disabled:b,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsx("button",{type:"submit",disabled:!T.trim()||b,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:T.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:T.trim()?"white":t.textSecondary},children:jsx(p0,{})})]}),jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function bc(e,t=50){let[a,r]=useState({past:[],present:e,future:[]}),o=useRef(false),s=useCallback((i,u=true)=>{r(d=>{let g=typeof i=="function"?i(d.present):i;if(o.current)return {...d,present:g};if(!u)return {...d,present:g};let h=[...d.past,d.present];return h.length>t&&h.shift(),{past:h,present:g,future:[]}});},[t]),n=useCallback(()=>{r(i=>{if(i.past.length===0)return i;let u=i.past[i.past.length-1],d=i.past.slice(0,i.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:u,future:[i.present,...i.future]}});},[]),p=useCallback(()=>{r(i=>{if(i.future.length===0)return i;let u=i.future[0],d=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:u,future:d}});},[]),m=useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:p,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:m}}function yc({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){useEffect(()=>{if(!o)return;let s=n=>{let p=navigator.platform.toUpperCase().indexOf("MAC")>=0,m=p?n.metaKey:n.ctrlKey;if(m&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!p&&m&&n.key==="y"){n.preventDefault(),t();return}if(p&&m&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var v0={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${ue.formatDate(e.startDate)} - ${ue.formatDate(e.endDate)}`);let a=ue.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=>ue.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function vc(e){return {...v0,...e}}var D0=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},wc=forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:p="comfortable",showThemeSelector:m=true,showExportButton:i=true,availableUsers:u=[],templates:d,enableAutoCriticalPath:g=true,persistExpandedState:h,aiAssistant:C,locale:T="en",customTranslations:c,showCreateTaskButton:b=false,createTaskLabel:y,onCreateTask:l,taskFilter:x,onTaskFilterChange:v,onThemeChange:S,onTaskClick:k,onTaskDblClick:w,onTaskContextMenu:B,onTaskUpdate:M,onProgressChange:D,onTaskEdit:I,onTaskAddSubtask:R,onTaskMarkIncomplete:Y,onTaskSetInProgress:te,onDependencyCreate:ye,onDependencyDelete:De,onBeforeTaskAdd:Se,onAfterTaskAdd:O,onBeforeTaskUpdate:V,onAfterTaskUpdate:$,onBeforeTaskDelete:G,onAfterTaskDelete:A}=a,q=useContext(vn)?.theme,[U,fe]=useState(q||s||"dark"),[Me,Oe]=useState(n),[he,Ye]=useState(p),[We,et]=useState(1),[vt,Mt]=useState("all"),mt=x??vt,z=v??Mt,[ie,ve]=useState(0),[Pe,ze]=useState(false),[at,Et]=useState(null),[Fe,Xt]=useState({isOpen:false,x:0,y:0,task:null}),[Ot,Nt]=useState(null),[ct,Jt]=useState(null);useEffect(()=>{q&&q!==U&&fe(q);},[q]),useEffect(()=>{s&&s!==U&&fe(s);},[s]);let Ea=useCallback(F=>{fe(F),S?.(F);},[S]),{state:oe,setState:me,undo:pa,redo:ya,canUndo:N,canRedo:ee,clearHistory:se}=bc(t,50),Te=useCallback(()=>h?typeof h=="string"?h:"gantt-expanded-tasks":null,[h]),$e=useRef(new Map),tt=useRef(false);if(!tt.current&&h){tt.current=true;let F=typeof h=="string"?h:"gantt-expanded-tasks";try{let L=localStorage.getItem(F);if(L){let j=JSON.parse(L);Array.isArray(j)&&($e.current=new Map(j));}}catch(L){console.warn("[GanttBoard] Error loading expanded state from localStorage:",L);}}let Ge=useCallback(()=>{let F=Te();if(F)try{let L=Array.from($e.current.entries());localStorage.setItem(F,JSON.stringify(L));}catch(L){console.warn("[GanttBoard] Error saving expanded state to localStorage:",L);}},[Te]);useEffect(()=>{let F=L=>L.map(j=>{let re=$e.current.get(j.id),pe=re!==void 0?{...j,isExpanded:re}:j;return pe.subtasks?.length?{...pe,subtasks:F(pe.subtasks)}:pe});$e.current.size>0?me(F(t)):me(t);},[t,me]);let Be=useRef(t),rt=useRef(true);useEffect(()=>{if(rt.current){rt.current=false,Be.current=oe;return}if(!r)return;let F=JSON.stringify(Be.current),L=JSON.stringify(oe);F!==L&&(Be.current=oe,r(oe));},[oe,r]);let _=useMemo(()=>ti(T,c),[T,c]),ae=useCallback(F=>[{id:"name",label:F.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:F.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:F.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:F.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:F.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:F.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:F.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:F.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[Ee,Ue]=useState(()=>ae(_));useEffect(()=>{Ue(F=>F.map(L=>({...L,label:_.columns[L.id==="name"?"taskName":L.id]||L.label})));},[_]);let He=useMemo(()=>Ee.filter(L=>L.visible).reduce((L,j)=>L+j.width,0),[Ee]),W=useRef(Ee.filter(F=>F.visible).map(F=>F.id).join(","));useEffect(()=>{let F=Ee.filter(re=>re.visible),L=F.map(re=>re.id).join(","),j=W.current;if(L!==j){let re=F.some(Ce=>Ce.id!=="name"),pe=j.includes(",");re?!pe&&re&&Et(null):Et(null),W.current=L;}},[Ee]);let le=60,Ie=.6,Dt=useMemo(()=>{let L=He+le,j=typeof window<"u"?window.innerWidth*Ie:800,re=Math.max(L,j);return at!==null?Math.max(200,Math.min(at,re)):Math.max(200,L)},[at,He]),Je=useRef(null),va=useRef(null),ua=useRef(null),E=useMemo(()=>Ud(U),[U]),be=useMemo(()=>({theme:E,themeName:U}),[E,U]),Q=useMemo(()=>vc(d),[d]),Ae=useMemo(()=>{if(!g)return oe;let F=ue.calculateCriticalPath(oe),L=j=>j.map(re=>({...re,isCriticalPath:F.includes(re.id),subtasks:re.subtasks?L(re.subtasks):void 0}));return L(oe)},[oe,g]),ot=useMemo(()=>{if(mt==="all")return Ae;let F=L=>{let j=[];for(let re of L){let pe=re.subtasks?.length?F(re.subtasks):void 0,Ce=false;switch(mt){case "incomplete":Ce=re.progress<100;break;case "in_progress":Ce=re.progress>0&&re.progress<100;break;case "completed":Ce=re.progress===100;break}(Ce||pe&&pe.length>0)&&j.push({...re,subtasks:pe});}return j};return F(Ae)},[Ae,mt]),ne=D0(he);yc({undo:pa,redo:ya,canUndo:N,canRedo:ee,enabled:true}),useImperativeHandle(o,()=>({getTask:F=>ue.findTaskById(oe,F),addTask:(F,L)=>{me(j=>{if(!L)return [...j,{...F,level:0}];let re=pe=>pe.map(Ce=>Ce.id===L?{...Ce,subtasks:[...Ce.subtasks||[],{...F,parentId:L,level:(Ce.level||0)+1}],isExpanded:true}:Ce.subtasks?{...Ce,subtasks:re(Ce.subtasks)}:Ce);return re(j)});},updateTask:(F,L)=>{me(j=>{let re=pe=>pe.map(Ce=>Ce.id===F?{...Ce,...L}:Ce.subtasks?{...Ce,subtasks:re(Ce.subtasks)}:Ce);return re(j)});},deleteTask:F=>{me(L=>{let j=re=>re.filter(pe=>pe.id===F?false:(pe.subtasks&&(pe.subtasks=j(pe.subtasks)),true));return j(L)});},deleteTasks:F=>{me(L=>mi(L,F));},duplicateTask:F=>{me(L=>pi(L,[F]));},splitTask:(F,L,j=3)=>{me(re=>ue.splitTask(re,F,L,j));},calculateEndDate:ue.calculateEndDate,calculateDuration:ue.calculateDuration,validateDependency:(F,L)=>!ue.validateDependencies(oe,F,L),getAllTasks:()=>ue.flattenTasks(oe),getTasksByStatus:F=>ue.flattenTasks(oe).filter(L=>L.status===F),getTasksByParent:F=>F?ue.findTaskById(oe,F)?.subtasks||[]:oe.filter(j=>!j.parentId),getCriticalPath:()=>ue.flattenTasks(oe).filter(F=>F.isCriticalPath),indentTask:F=>{me(L=>li(L,[F]));},outdentTask:F=>{me(L=>di(L,[F]));},moveTask:(F,L)=>{me(j=>ci(j,[F],L));},createSubtask:async F=>{let{tasks:L,newTask:j}=fi(oe,F);if(Se){let re=Se({...j,parentId:F});if((re instanceof Promise?await re:re)===false)return}me(L),O&&O({...j,parentId:F});},scrollToTask:F=>{let j=ue.flattenTasks(oe).findIndex(re=>re.id===F);if(j!==-1&&Je.current){let re=j*ne;Je.current.scrollTo({top:re,behavior:"smooth"}),va.current&&va.current.scrollTo({top:re,behavior:"smooth"});}},highlightTask:(F,L=2e3)=>{},expandTask:F=>{me(L=>{let j=re=>re.map(pe=>pe.id===F?{...pe,isExpanded:true}:pe.subtasks?{...pe,subtasks:j(pe.subtasks)}:pe);return j(L)});},collapseTask:F=>{me(L=>{let j=re=>re.map(pe=>pe.id===F?{...pe,isExpanded:false}:pe.subtasks?{...pe,subtasks:j(pe.subtasks)}:pe);return j(L)});},expandAll:()=>{me(F=>{let L=j=>j.map(re=>({...re,isExpanded:true,subtasks:re.subtasks?L(re.subtasks):void 0}));return L(F)});},collapseAll:()=>{me(F=>{let L=j=>j.map(re=>({...re,isExpanded:false,subtasks:re.subtasks?L(re.subtasks):void 0}));return L(F)});},undo:pa,redo:ya,canUndo:()=>N,canRedo:()=>ee,clearHistory:se,exportToPNG:async()=>{if(!ua.current||!Je.current||!va.current)throw new Error("Gantt container not found");let F=ua.current,L=Je.current.querySelector(".gantt-grid-scroll"),j=va.current,re=L?.scrollTop||0,pe=j.scrollTop,Ce=F.style.overflow,ft=F.style.height;try{let Qt=L?.querySelector(".gantt-taskgrid-content"),xa=j.querySelector("svg"),ka=Qt?.scrollHeight||L?.scrollHeight||600,Fa=xa?.getBoundingClientRect().height||j.scrollHeight,Rr=(F.querySelector('[class*="h-12"]')?.offsetHeight||48)+Math.max(ka,Fa)+20;L&&(L.scrollTop=0),j.scrollTop=0,F.style.overflow="visible",F.style.height=`${Rr}px`,await new Promise(wr=>setTimeout(wr,100));let kr=await kc(F,{backgroundColor:E.bgPrimary,scale:2,logging:!1,useCORS:!0,ignoreElements:wr=>{let ro=window.getComputedStyle(wr),$r=parseInt(ro.zIndex,10);return !isNaN($r)&&$r>=50||ro.position==="fixed"}});return new Promise((wr,ro)=>{kr.toBlob($r=>{$r?wr($r):ro(new Error("Failed to create blob from canvas"));},"image/png");})}finally{F.style.overflow=Ce,F.style.height=ft,L&&(L.scrollTop=re),j.scrollTop=pe;}},exportToPDF:async F=>{await ue.exportToPDF(oe,F);},exportToExcel:async F=>{await ue.exportToExcel(oe,F);},exportToJSON:()=>ue.exportToJSON(oe),exportToCSV:()=>ue.exportToCSV(oe),importFromJSON:F=>{let L=ue.importFromJSON(F);me(L);},getTasks:()=>oe,refresh:()=>{me(F=>[...F]);},clearAll:()=>{me([]);}}),[oe,pa,ya,N,ee,se,E,ne]);let Re=useCallback(F=>{Ue(L=>L.map(j=>j.id===F?{...j,visible:!j.visible}:j));},[]),xt=useCallback((F,L)=>{Ue(j=>j.map(re=>{if(re.id!==F)return re;let pe=re.minWidth??100,Ce=re.maxWidth??800,ft=Math.max(pe,Math.min(Ce,L));return {...re,width:ft}}));},[]),Le=useCallback(F=>{me(L=>{let j=gi(L,F),re=pe=>{for(let Ce of pe){if(Ce.id===F){$e.current.set(F,Ce.isExpanded??true);return}Ce.subtasks?.length&&re(Ce.subtasks);}};return re(j),Ge(),j}),a.onTaskToggleExpand?.(F);},[a,Ge]),At=useCallback((F,L)=>{if(V&&V(F,L)===false)return;let re=ue.findTaskById(oe,F)?.progress,pe=ft=>ft.map(Qt=>Qt.id===F?{...Qt,...L}:Qt.subtasks?{...Qt,subtasks:pe(Qt.subtasks)}:Qt);me(pe(oe));let Ce=ue.findTaskById(pe(oe),F);Ce&&(M?.(Ce),$?.(Ce),L.progress!==void 0&&re!==void 0&&L.progress!==re&&D?.(F,re,L.progress));},[oe,M,V,$,D]),st=useCallback(F=>{F.length!==0&&(me(L=>li(L,F)),a.onTaskIndent?.(F[0]));},[a]),ga=useCallback(F=>{F.length!==0&&(me(L=>di(L,F)),a.onTaskOutdent?.(F[0]));},[a]),zt=useCallback((F,L,j)=>{me(re=>oc(re,F,L,j)),a.onTaskReparent?.(F,L,j);},[a]),je=useCallback((F,L)=>{F.length!==0&&(me(j=>ci(j,F,L)),a.onTaskMove?.(F[0],L));},[a]),kt=useCallback(async F=>{let L=[];for(let j of F)G&&await Promise.resolve(G(j))===false||L.push(j);L.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(L):(me(j=>mi(j,L)),L.forEach(j=>a.onTaskDelete?.(j))),A&&L.forEach(j=>A(j)));},[a,G,A]),ia=useCallback(F=>{me(L=>pi(L,F)),F.forEach(L=>a.onTaskDuplicate?.(L));},[a]),vr=useCallback((F,L)=>{me(j=>{let{tasks:re,newTask:pe}=rc(j,F,L);return Se&&Se(pe)===false?j:(a.onTaskCreate?.(pe.parentId,pe.position||0),O?.(pe),re)});},[a,Se,O]),Hm=useCallback((F,L)=>{me(j=>ui(j,F,L)),a.onTaskRename?.(F,L);},[a]),Zn=useCallback(F=>{me(L=>{let{tasks:j}=fi(L,F);return a.onTaskCreate?.(F,0),j});},[a]),Wm=useCallback((F,L,j)=>{let re=F.startDate?Math.round((L.getTime()-F.startDate.getTime())/864e5):0,pe=Qt=>Qt.map(xa=>xa.id===F.id?{...xa,startDate:L,endDate:j,...F.segments&&{segments:F.segments}}:xa.subtasks?{...xa,subtasks:pe(xa.subtasks)}:xa),Ce=pe(oe);Ce=ue.autoScheduleDependents(Ce,F.id,re),me(Ce);let ft={...F,startDate:L,endDate:j};M?.(ft);},[oe,M]),Gm=useCallback((F,L)=>{B?.(F,L),Xt({isOpen:true,x:L.clientX,y:L.clientY,task:F});},[B]),_m=useCallback((F,L)=>{let j=ue.splitTask(oe,F.id,L);me(j),Xt({isOpen:false,x:0,y:0,task:null});},[oe]),hl=useCallback(F=>{let L=ue.findTaskById(oe,F.id)||F;w?.(L),I||Nt(L);},[oe,w,I]),bl=useCallback((F,L,j)=>{let re=new Map,pe=ka=>{ka.forEach(Fa=>{Fa.dependencies&&re.set(Fa.id,Fa.dependencies),Fa.subtasks&&pe(Fa.subtasks);});};pe(j);let Ce=re.get(L)||[];re.set(L,[...Ce,F]);let ft=new Set,Qt=new Set,xa=ka=>{if(!ft.has(ka)){ft.add(ka),Qt.add(ka);let Fa=re.get(ka)||[];for(let xr of Fa){if(!ft.has(xr)&&xa(xr))return true;if(Qt.has(xr))return true}}return Qt.delete(ka),false};return xa(L)},[]),yl=useCallback((F,L)=>{if(bl(F.id,L,oe)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
342
+ </Project>`,u=new Blob([i],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(u),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=fe.flattenTasks(e),a=t.filter(i=>i.startDate&&i.endDate);if(a.length===0)return [];let r=new Map,o=i=>{if(r.has(i.id))return;let u=i.startDate&&i.endDate?fe.calculateDuration(i.startDate,i.endDate):0,d=0;if(i.dependencies&&i.dependencies.length>0)for(let h of i.dependencies){let C=t.find(T=>T.id===h);if(C){o(C);let T=r.get(h)?.ef||0;d=Math.max(d,T);}}let g=d+u;r.set(i.id,{es:d,ef:g});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),n=new Map,p=i=>{if(n.has(i.id))return;let u=i.startDate&&i.endDate?fe.calculateDuration(i.startDate,i.endDate):0,d=t.filter(C=>C.dependencies&&C.dependencies.includes(i.id)),g=s;if(d.length>0)for(let C of d){p(C);let T=n.get(C.id)?.ls||0;g=Math.min(g,T);}let h=g-u;n.set(i.id,{ls:h,lf:g});};a.forEach(p);let m=[];for(let i of a){let u=r.get(i.id),d=n.get(i.id);if(u&&d){let g=d.ls-u.es;Math.abs(g)<.01&&m.push(i.id);}}return m},calculateSlack:(e,t)=>{let a=fe.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(fe.calculateCriticalPath(e).includes(t))return 0;let o=fe.getDependentTasks(e,t);if(o.length===0){let p=fe.getLatestEndDate(e);if(!p)return null;let m=fe.calculateDuration(a.endDate,p);return Math.max(0,m)}let s=o.filter(p=>p.startDate).map(p=>p.startDate.getTime()).sort((p,m)=>p-m)[0];if(!s)return null;let n=fe.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>fe.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=fe.findTaskById(e,t);if(!r||!r.endDate)return e;let o=fe.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let n of o){if(!n.startDate||!n.endDate)continue;let p=fe.calculateDuration(n.startDate,n.endDate),m;a!==void 0?(m=new Date(n.startDate),m.setDate(m.getDate()+a)):(m=new Date(r.endDate),m.setDate(m.getDate()+1));let i=fe.calculateEndDate(m,p),u=d=>d.map(g=>g.id===n.id?{...g,startDate:m,endDate:i}:g.subtasks?{...g,subtasks:u(g.subtasks)}:g);s=u(s),s=fe.autoScheduleDependents(s,n.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,n,p)=>{if(a===0)return [];let m=[],i=o.getTime(),u=1e3*60*60*24,d=fe.findTaskById(e,t);if(!d||!d.endDate)return [];let g=(h,C,T=new Set)=>{if(T.has(h))return;T.add(h);let c=fe.getDependentTasks(e,h);for(let b of c){if(!b.startDate||!b.endDate)continue;let y=r.findIndex(D=>D.id===b.id);if(y===-1)continue;let l=b.startDate.getTime(),v=(b.endDate.getTime()-l)/u,k=(l-i)/u*s,w=k+C*s,R=Math.max(v*s,s),M=p+y*n+12;m.push({taskId:b.id,taskName:b.name,originalX:k,previewX:w,width:R,y:M,rowIndex:y,daysDelta:C,color:b.color}),g(b.id,C,T);}};return g(t,a),m},splitTask:(e,t,a,r=3)=>{let o=fe.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let n=new Date(a);n.setDate(n.getDate()+r);let p=new Date(o.endDate);p.setDate(p.getDate()+r);let m=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:p}],i=u=>u.map(d=>d.id===o.id?{...d,endDate:p,segments:m}:d.subtasks?{...d,subtasks:i(d.subtasks)}:d);return i(e)}};function In({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,templates:p,dependencyLineStyle:m="curved",onTaskClick:i,onTaskDblClick:u,onTaskContextMenu:d,onTaskDateChange:g,onDependencyCreate:h,onDependencyDelete:C}){let[c,b]=useState([]),[y,l]=useState(null),x=useCallback($=>{l($);},[]),v=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),S=r==="day"?60:r==="week"?20:8,k=v*S*n,w=$=>{let J=new Date(Date.UTC($.getFullYear(),$.getMonth(),$.getDate())),U=J.getUTCDay()||7;J.setUTCDate(J.getUTCDate()+4-U);let G=new Date(Date.UTC(J.getUTCFullYear(),0,1));return Math.ceil(((J.getTime()-G.getTime())/864e5+1)/7)},R=$=>{let J=$.getDay();return J===0||J===6},M=useCallback($=>{let J=Math.round($/(S*n)),U=new Date(o);return U.setDate(U.getDate()+J),U},[o,S,n]),D=useCallback(($,J)=>{if(J.startDate&&J.endDate)return;let U=$.currentTarget.ownerSVGElement;if(!U)return;let G=U.createSVGPoint();G.x=$.clientX,G.y=$.clientY;let A=G.matrixTransform(U.getScreenCTM()?.inverse()),Q=M(A.x),X=new Date(Q);X.setDate(X.getDate()+1),g?.(J,Q,X);},[M,g]),I=useMemo(()=>{let $=A=>A.map(Q=>{if(Q.subtasks&&Q.subtasks.length>0){let X=$(Q.subtasks),H=X.filter(Ce=>Ce.startDate&&Ce.endDate);if(H.length>0){let Ce=H.map(Ye=>Ye.startDate.getTime()),Me=H.map(Ye=>Ye.endDate.getTime()),Oe=new Date(Math.min(...Ce)),ye=new Date(Math.max(...Me));return {...Q,subtasks:X,startDate:Oe,endDate:ye}}return {...Q,subtasks:X}}return Q}),J=(A,Q=[])=>{for(let X of A)Q.push(X),X.subtasks&&X.subtasks.length>0&&(X.isExpanded===void 0||X.isExpanded)&&J(X.subtasks,Q);return Q},U=$(e);return J(U)},[e]),B=useCallback($=>{if(!$.startDate||!$.endDate)return {x:0,width:0};let J=$.startDate.getTime(),U=$.endDate.getTime(),G=o.getTime(),A=(J-G)/(1e3*60*60*24),Q=(U-J)/(1e3*60*60*24),X=A*S*n,H=Math.max(S*n,40),Ce=Math.max(Q*S*n,H);return {x:X,width:Ce}},[o,S,n]),K=useMemo(()=>I.filter($=>$.startDate&&$.endDate).map($=>{let{x:J,width:U}=B($),A=I.findIndex(Q=>Q.id===$.id)*a+12;return {id:$.id,x:J,y:A,width:U,height:32}}),[I,B]),te=useCallback(($,J,U)=>{if(!U||J===0){b([]);return}let G=fe.calculateCascadePreview(e,$,J,I,o,S*n,a,48);b(G);},[e,I,o,S,n,a,48]),ie=useMemo(()=>{let $=[],J=new Date(o);for(;J<=s;){let A=(J.getTime()-o.getTime())/864e5*S*n;if(r==="day")$.push({date:new Date(J),label:J.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:A}),J.setDate(J.getDate()+1);else if(r==="week"){let Q=w(J);$.push({date:new Date(J),label:`Week ${Q}`,x:A}),J.setDate(J.getDate()+7);}else $.push({date:new Date(J),label:J.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:A}),J.setMonth(J.getMonth()+1);}return $},[o,s,r,S,n]),de=useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*S*n,[o,S,n]),be=Math.max(I.length*a,552);return jsxs("div",{className:"w-full h-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary,overflow:"visible"},children:[jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.bgGrid,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:jsxs("svg",{width:Math.max(k,1e3),height:47,style:{display:"block"},children:[jsx("rect",{x:0,y:0,width:Math.max(k,1e3),height:48,fill:t.bgGrid}),ie.map(($,J)=>jsxs("g",{children:[J>0&&jsx("line",{x1:$.x,y1:0,x2:$.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsx("text",{x:$.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:$.label})]},`header-${J}`)),de>=0&&de<=k&&jsx("circle",{cx:de,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxs("svg",{width:Math.max(k,1e3),height:be,style:{display:"block",flexShrink:0,overflow:"visible"},children:[jsxs("defs",{children:[jsx("filter",{id:"shadow",children:jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})})]}),jsx("rect",{x:0,y:0,width:Math.max(k,1e3),height:be,fill:t.bgPrimary}),ie.map(($,J)=>{let U=ie[J+1]?.x||k,G=R($.date);return jsxs("g",{children:[G&&jsx("rect",{x:$.x,y:0,width:U-$.x,height:I.length*a,fill:t.bgWeekend,opacity:1}),J>0&&jsx("line",{x1:$.x,y1:0,x2:$.x,y2:I.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},J)}),I.map(($,J)=>{let U=$.startDate&&$.endDate;return jsxs("g",{children:[jsx("rect",{x:0,y:J*a,width:k,height:a,fill:J%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-${$.id}`),!U&&jsxs(Fragment,{children:[jsx("rect",{x:0,y:J*a,width:k,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:G=>D(G,$),onMouseEnter:G=>{G.currentTarget.setAttribute("fill",t.accentLight),G.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:G=>{G.currentTarget.setAttribute("fill","transparent"),G.currentTarget.setAttribute("opacity","1");}},`clickable-${$.id}`),jsx("text",{x:de>0?de: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:"Click to set dates..."},`placeholder-${$.id}`)]})]},`row-group-${$.id}`)}),I.map(($,J)=>{if(!$.startDate||!$.endDate)return null;let{x:U,width:G}=B($),A=J*a+12,Q=$.subtasks&&$.subtasks.length>0&&!$.isMilestone;return $.isMilestone?jsx(Fn,{task:$,x:U+G/2,y:A+16,theme:t,onClick:i},$.id):Q?jsxs("g",{onClick:()=>i?.($),onContextMenu:X=>{X.preventDefault(),X.stopPropagation(),d?.($,X);},style:{cursor:"default"},children:[jsx("rect",{x:U,y:A,width:G,height:32,fill:t.primary,opacity:.25,rx:6}),jsx("line",{x1:U,y1:A,x2:U+G,y2:A,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsx("line",{x1:U,y1:A,x2:U,y2:A+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsx("line",{x1:U+G,y1:A,x2:U+G,y2:A+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsx("line",{x1:U,y1:A+32,x2:U+G,y2:A+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),G>60&&jsx("text",{x:U+12,y:A+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:$.name})]},$.id):jsx(Sn,{task:$,x:U,y:A,width:G,theme:t,dayWidth:S*n,startDate:o,templates:p,onClick:i,onDoubleClick:u,onContextMenu:d,onDateChange:g,onDependencyCreate:h,allTaskPositions:K,onDragMove:te,onHoverChange:x},$.id)}),I.map(($,J)=>!$.dependencies||$.dependencies.length===0||!$.startDate||!$.endDate?null:$.dependencies.map(U=>{let G=I.find(ye=>ye.id===U);if(!G||!G.startDate||!G.endDate)return null;let A=I.findIndex(ye=>ye.id===U),Q=B(G),X=B($),H=Q.x+Q.width,Ce=A*a+28,Me=X.x,Oe=J*a+28;return jsx(Mn,{x1:H,y1:Ce,x2:Me,y2:Oe,theme:t,lineStyle:m,onDelete:()=>C?.($.id,U)},`dep-${U}-${$.id}`)})),c.map($=>jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:$.previewX,y:$.y-48,width:$.width,height:32,rx:8,fill:$.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs($.daysDelta)>0&&jsx("text",{x:$.previewX+$.width/2,y:$.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:$.daysDelta>0?`+${$.daysDelta}d`:`${$.daysDelta}d`})]},`cascade-preview-${$.taskId}`)),de>=0&&de<=k&&jsx("line",{x1:de,y1:0,x2:de,y2:be,stroke:t.today,strokeWidth:1,opacity:1,style:{pointerEvents:"none"}}),y&&jsx(pc,{tooltipData:y,theme:t})]})]})}var m0=['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"'],hc=()=>jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707"}),jsx("circle",{cx:"12",cy:"12",r:"4"})]}),p0=()=>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"})}),u0=()=>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"})}),g0=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M5 12h14"})}),f0=()=>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 Bn({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:p,onDependencyDelete:m}){let[i,u]=useState(false),[d,g]=useState(false),[h,C]=useState([]),[T,c]=useState(""),[b,y]=useState(false),[l,x]=useState(true),v=useRef(null),S=useRef(null),k=useRef(null),{enabled:w=true,placeholder:R='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:M="bottom-right",onCommand:D,suggestions:I=m0,maxHistory:B=50,persistHistory:K}=a,te=K?.storageKey||"gantt-ai-history",ie=K?.maxMessages??5;useEffect(()=>{if(K?.enabled)try{let G=localStorage.getItem(te);if(G){let Q=JSON.parse(G).map(X=>({...X,timestamp:new Date(X.timestamp)}));C(Q.slice(-ie));}}catch(G){console.warn("[GanttAIAssistant] Failed to load persisted history:",G);}},[K?.enabled,te,ie]),useEffect(()=>{if(K?.enabled&&h.length>0)try{let G=h.filter(A=>!A.isLoading).slice(-ie);localStorage.setItem(te,JSON.stringify(G));}catch(G){console.warn("[GanttAIAssistant] Failed to persist history:",G);}},[h,K?.enabled,te,ie]),useEffect(()=>{S.current&&S.current.scrollIntoView({behavior:"smooth"});},[h]),useEffect(()=>{i&&!d&&v.current&&setTimeout(()=>v.current?.focus(),100);},[i,d]);let de=useCallback(G=>{if(G.success)switch(G.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":G.taskId&&G.updates&&o?.(G.taskId,G.updates);break;case "create_task":G.newTask&&s?.(G.newTask);break;case "delete_task":G.taskId&&n?.(G.taskId);break;case "link_tasks":G.dependencyFrom&&G.dependencyTo&&p?.(G.dependencyFrom,G.dependencyTo);break;case "unlink_tasks":G.taskId&&G.dependencyFrom&&m?.(G.taskId,G.dependencyFrom);break}},[o,s,n,p,m]),be=useCallback(async G=>{if(!G.trim()||b)return;let A={id:`user-${Date.now()}`,role:"user",content:G,timestamp:new Date};C(X=>[...X.slice(-(B-1)),A]),c(""),x(false),y(true);let Q={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};C(X=>[...X,Q]);try{if(D){let X=await D(G,e);C(H=>{let Ce=H.filter(Oe=>!Oe.isLoading),Me={id:`assistant-${Date.now()}`,role:"assistant",content:X.message,timestamp:new Date,command:X};return [...Ce,Me]}),de(X);}else C(X=>[...X.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(X){C(H=>[...H.filter(Me=>!Me.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${X instanceof Error?X.message:"Unknown error"}`,timestamp:new Date}]);}finally{y(false);}},[b,B,D,e,de]),$=G=>{G.preventDefault(),be(T);},J=G=>{c(G),v.current?.focus();};if(useEffect(()=>{let G=A=>{(A.metaKey||A.ctrlKey)&&A.key==="k"&&(A.preventDefault(),u(Q=>!Q),i||g(false)),A.key==="Escape"&&i&&u(false);};return document.addEventListener("keydown",G),()=>document.removeEventListener("keydown",G)},[i]),useEffect(()=>{if(!i)return;let G=Q=>{let X=Q.target;k.current&&!k.current.contains(X)&&u(false);},A=setTimeout(()=>{document.addEventListener("mousedown",G);},100);return ()=>{clearTimeout(A),document.removeEventListener("mousedown",G);}},[i]),!w)return null;let U={"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(lt,{children:[jsx(AnimatePresence,{children:!i&&jsxs(motion.button,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},className:`fixed ${U[M]} z-[99999] flex items-center gap-2 px-4 py-3 rounded-full shadow-lg transition-colors`,style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"white",boxShadow:"0 4px 20px rgba(59, 130, 246, 0.4)"},onClick:()=>u(true),children:[jsx(hc,{}),jsx("span",{className:"text-sm font-medium",children:"AI Assistant"}),jsx("kbd",{className:"hidden sm:inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] font-mono rounded bg-white/20",children:"\u2318K"})]})}),jsx(AnimatePresence,{children:i&&jsxs(motion.div,{ref:k,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:d?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${U[M]} z-[99999] w-96 rounded-2xl overflow-hidden shadow-2xl flex flex-col`,style:{background:t.bgPrimary,border:`1px solid ${t.border}`,boxShadow:`0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px ${t.border}`},children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)"},children:[jsxs("div",{className:"flex items-center gap-2 text-white",children:[jsx(hc,{}),jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>g(G=>!G),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsx(g0,{})}),jsx("button",{onClick:()=>u(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsx(u0,{})})]})]}),jsx(AnimatePresence,{children:!d&&jsxs(motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[h.length===0&&l&&jsxs("div",{className:"space-y-3",children:[jsx("p",{className:"text-sm text-center",style:{color:t.textSecondary},children:"Try asking me to edit your Gantt chart:"}),jsx("div",{className:"flex flex-wrap gap-2",children:I.slice(0,4).map((G,A)=>jsx("button",{onClick:()=>J(G),className:"text-xs px-3 py-1.5 rounded-full transition-colors",style:{background:t.bgSecondary,color:t.textSecondary,border:`1px solid ${t.border}`},children:G.length>30?G.slice(0,30)+"...":G},A))})]}),h.map(G=>jsx(motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${G.role==="user"?"justify-end":"justify-start"}`,children:jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${G.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:G.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:G.role==="user"?"white":t.textPrimary},children:[G.isLoading?jsx(f0,{}):jsx("p",{className:"text-sm whitespace-pre-wrap",children:G.content}),G.command&&jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:G.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:G.command.success?"#10B981":"#EF4444"},children:[G.command.success?"\u2713":"\u2717",jsx("span",{className:"capitalize",children:G.command.type.replace(/_/g," ")})]})]})},G.id)),jsx("div",{ref:S})]}),jsxs("form",{onSubmit:$,className:"p-3 border-t",style:{borderColor:t.border},children:[jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:t.bgSecondary,border:`1px solid ${t.border}`},children:[jsx("input",{ref:v,type:"text",value:T,onChange:G=>c(G.target.value),placeholder:R,disabled:b,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsx("button",{type:"submit",disabled:!T.trim()||b,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:T.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:T.trim()?"white":t.textSecondary},children:jsx(p0,{})})]}),jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function bc(e,t=50){let[a,r]=useState({past:[],present:e,future:[]}),o=useRef(false),s=useCallback((i,u=true)=>{r(d=>{let g=typeof i=="function"?i(d.present):i;if(o.current)return {...d,present:g};if(!u)return {...d,present:g};let h=[...d.past,d.present];return h.length>t&&h.shift(),{past:h,present:g,future:[]}});},[t]),n=useCallback(()=>{r(i=>{if(i.past.length===0)return i;let u=i.past[i.past.length-1],d=i.past.slice(0,i.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:u,future:[i.present,...i.future]}});},[]),p=useCallback(()=>{r(i=>{if(i.future.length===0)return i;let u=i.future[0],d=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:u,future:d}});},[]),m=useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:p,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:m}}function yc({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){useEffect(()=>{if(!o)return;let s=n=>{let p=navigator.platform.toUpperCase().indexOf("MAC")>=0,m=p?n.metaKey:n.ctrlKey;if(m&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!p&&m&&n.key==="y"){n.preventDefault(),t();return}if(p&&m&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var v0={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${fe.formatDate(e.startDate)} - ${fe.formatDate(e.endDate)}`);let a=fe.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=>fe.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function vc(e){return {...v0,...e}}var D0=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},wc=forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:p="comfortable",showThemeSelector:m=true,showExportButton:i=true,availableUsers:u=[],templates:d,enableAutoCriticalPath:g=true,persistExpandedState:h,aiAssistant:C,locale:T="en",customTranslations:c,showCreateTaskButton:b=false,createTaskLabel:y,onCreateTask:l,taskFilter:x,onTaskFilterChange:v,onThemeChange:S,onTaskClick:k,onTaskDblClick:w,onTaskContextMenu:R,onTaskUpdate:M,onProgressChange:D,onTaskEdit:I,onTaskAddSubtask:B,onTaskMarkIncomplete:K,onTaskSetInProgress:te,onDependencyCreate:ie,onDependencyDelete:de,onBeforeTaskAdd:be,onAfterTaskAdd:$,onBeforeTaskUpdate:J,onAfterTaskUpdate:U,onBeforeTaskDelete:G,onAfterTaskDelete:A}=a,X=useContext(vn)?.theme,[H,Ce]=useState(X||s||"dark"),[Me,Oe]=useState(n),[ye,Ye]=useState(p),[We,et]=useState(1),[vt,Mt]=useState("all"),mt=x??vt,O=v??Mt,[le,xe]=useState(0),[Pe,ze]=useState(false),[at,Et]=useState(null),[Fe,Xt]=useState({isOpen:false,x:0,y:0,task:null}),[Ot,Nt]=useState(null),[ct,Jt]=useState(null);useEffect(()=>{X&&X!==H&&Ce(X);},[X]),useEffect(()=>{s&&s!==H&&Ce(s);},[s]);let Ea=useCallback(F=>{Ce(F),S?.(F);},[S]),{state:oe,setState:ue,undo:pa,redo:ya,canUndo:N,canRedo:ee,clearHistory:se}=bc(t,50),De=useCallback(()=>h?typeof h=="string"?h:"gantt-expanded-tasks":null,[h]),$e=useRef(new Map),tt=useRef(false);if(!tt.current&&h){tt.current=true;let F=typeof h=="string"?h:"gantt-expanded-tasks";try{let L=localStorage.getItem(F);if(L){let V=JSON.parse(L);Array.isArray(V)&&($e.current=new Map(V));}}catch(L){console.warn("[GanttBoard] Error loading expanded state from localStorage:",L);}}let Ge=useCallback(()=>{let F=De();if(F)try{let L=Array.from($e.current.entries());localStorage.setItem(F,JSON.stringify(L));}catch(L){console.warn("[GanttBoard] Error saving expanded state to localStorage:",L);}},[De]);useEffect(()=>{let F=L=>L.map(V=>{let re=$e.current.get(V.id),ge=re!==void 0?{...V,isExpanded:re}:V;return ge.subtasks?.length?{...ge,subtasks:F(ge.subtasks)}:ge});$e.current.size>0?ue(F(t)):ue(t);},[t,ue]);let Be=useRef(t),rt=useRef(true);useEffect(()=>{if(rt.current){rt.current=false,Be.current=oe;return}if(!r)return;let F=JSON.stringify(Be.current),L=JSON.stringify(oe);F!==L&&(Be.current=oe,r(oe));},[oe,r]);let _=useMemo(()=>ti(T,c),[T,c]),ae=useCallback(F=>[{id:"name",label:F.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:F.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:F.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:F.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:F.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:F.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:F.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:F.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[Ee,Ue]=useState(()=>ae(_));useEffect(()=>{Ue(F=>F.map(L=>({...L,label:_.columns[L.id==="name"?"taskName":L.id]||L.label})));},[_]);let He=useMemo(()=>Ee.filter(L=>L.visible).reduce((L,V)=>L+V.width,0),[Ee]),W=useRef(Ee.filter(F=>F.visible).map(F=>F.id).join(","));useEffect(()=>{let F=Ee.filter(re=>re.visible),L=F.map(re=>re.id).join(","),V=W.current;if(L!==V){let re=F.some(Ne=>Ne.id!=="name"),ge=V.includes(",");re?!ge&&re&&Et(null):Et(null),W.current=L;}},[Ee]);let ce=60,Ie=.6,Dt=useMemo(()=>{let L=He+ce,V=typeof window<"u"?window.innerWidth*Ie:800,re=Math.max(L,V);return at!==null?Math.max(200,Math.min(at,re)):Math.max(200,L)},[at,He]),Je=useRef(null),va=useRef(null),ua=useRef(null),E=useMemo(()=>Ud(H),[H]),ve=useMemo(()=>({theme:E,themeName:H}),[E,H]),q=useMemo(()=>vc(d),[d]),Ae=useMemo(()=>{if(!g)return oe;let F=fe.calculateCriticalPath(oe),L=V=>V.map(re=>({...re,isCriticalPath:F.includes(re.id),subtasks:re.subtasks?L(re.subtasks):void 0}));return L(oe)},[oe,g]),ot=useMemo(()=>{if(mt==="all")return Ae;let F=L=>{let V=[];for(let re of L){let ge=re.subtasks?.length?F(re.subtasks):void 0,Ne=false;switch(mt){case "incomplete":Ne=re.progress<100;break;case "in_progress":Ne=re.progress>0&&re.progress<100;break;case "completed":Ne=re.progress===100;break}(Ne||ge&&ge.length>0)&&V.push({...re,subtasks:ge});}return V};return F(Ae)},[Ae,mt]),ne=D0(ye);yc({undo:pa,redo:ya,canUndo:N,canRedo:ee,enabled:true}),useImperativeHandle(o,()=>({getTask:F=>fe.findTaskById(oe,F),addTask:(F,L)=>{ue(V=>{if(!L)return [...V,{...F,level:0}];let re=ge=>ge.map(Ne=>Ne.id===L?{...Ne,subtasks:[...Ne.subtasks||[],{...F,parentId:L,level:(Ne.level||0)+1}],isExpanded:true}:Ne.subtasks?{...Ne,subtasks:re(Ne.subtasks)}:Ne);return re(V)});},updateTask:(F,L)=>{ue(V=>{let re=ge=>ge.map(Ne=>Ne.id===F?{...Ne,...L}:Ne.subtasks?{...Ne,subtasks:re(Ne.subtasks)}:Ne);return re(V)});},deleteTask:F=>{ue(L=>{let V=re=>re.filter(ge=>ge.id===F?false:(ge.subtasks&&(ge.subtasks=V(ge.subtasks)),true));return V(L)});},deleteTasks:F=>{ue(L=>mi(L,F));},duplicateTask:F=>{ue(L=>pi(L,[F]));},splitTask:(F,L,V=3)=>{ue(re=>fe.splitTask(re,F,L,V));},calculateEndDate:fe.calculateEndDate,calculateDuration:fe.calculateDuration,validateDependency:(F,L)=>!fe.validateDependencies(oe,F,L),getAllTasks:()=>fe.flattenTasks(oe),getTasksByStatus:F=>fe.flattenTasks(oe).filter(L=>L.status===F),getTasksByParent:F=>F?fe.findTaskById(oe,F)?.subtasks||[]:oe.filter(V=>!V.parentId),getCriticalPath:()=>fe.flattenTasks(oe).filter(F=>F.isCriticalPath),indentTask:F=>{ue(L=>li(L,[F]));},outdentTask:F=>{ue(L=>di(L,[F]));},moveTask:(F,L)=>{ue(V=>ci(V,[F],L));},createSubtask:async F=>{let{tasks:L,newTask:V}=fi(oe,F);if(be){let re=be({...V,parentId:F});if((re instanceof Promise?await re:re)===false)return}ue(L),$&&$({...V,parentId:F});},scrollToTask:F=>{let V=fe.flattenTasks(oe).findIndex(re=>re.id===F);if(V!==-1&&Je.current){let re=V*ne;Je.current.scrollTo({top:re,behavior:"smooth"}),va.current&&va.current.scrollTo({top:re,behavior:"smooth"});}},highlightTask:(F,L=2e3)=>{},expandTask:F=>{ue(L=>{let V=re=>re.map(ge=>ge.id===F?{...ge,isExpanded:true}:ge.subtasks?{...ge,subtasks:V(ge.subtasks)}:ge);return V(L)});},collapseTask:F=>{ue(L=>{let V=re=>re.map(ge=>ge.id===F?{...ge,isExpanded:false}:ge.subtasks?{...ge,subtasks:V(ge.subtasks)}:ge);return V(L)});},expandAll:()=>{ue(F=>{let L=V=>V.map(re=>({...re,isExpanded:true,subtasks:re.subtasks?L(re.subtasks):void 0}));return L(F)});},collapseAll:()=>{ue(F=>{let L=V=>V.map(re=>({...re,isExpanded:false,subtasks:re.subtasks?L(re.subtasks):void 0}));return L(F)});},undo:pa,redo:ya,canUndo:()=>N,canRedo:()=>ee,clearHistory:se,exportToPNG:async()=>{if(!ua.current||!Je.current||!va.current)throw new Error("Gantt container not found");let F=ua.current,L=Je.current.querySelector(".gantt-grid-scroll"),V=va.current,re=L?.scrollTop||0,ge=V.scrollTop,Ne=F.style.overflow,ft=F.style.height;try{let Qt=L?.querySelector(".gantt-taskgrid-content"),xa=V.querySelector("svg"),ka=Qt?.scrollHeight||L?.scrollHeight||600,Fa=xa?.getBoundingClientRect().height||V.scrollHeight,Rr=(F.querySelector('[class*="h-12"]')?.offsetHeight||48)+Math.max(ka,Fa)+20;L&&(L.scrollTop=0),V.scrollTop=0,F.style.overflow="visible",F.style.height=`${Rr}px`,await new Promise(wr=>setTimeout(wr,100));let kr=await kc(F,{backgroundColor:E.bgPrimary,scale:2,logging:!1,useCORS:!0,ignoreElements:wr=>{let ro=window.getComputedStyle(wr),$r=parseInt(ro.zIndex,10);return !isNaN($r)&&$r>=50||ro.position==="fixed"}});return new Promise((wr,ro)=>{kr.toBlob($r=>{$r?wr($r):ro(new Error("Failed to create blob from canvas"));},"image/png");})}finally{F.style.overflow=Ne,F.style.height=ft,L&&(L.scrollTop=re),V.scrollTop=ge;}},exportToPDF:async F=>{await fe.exportToPDF(oe,F);},exportToExcel:async F=>{await fe.exportToExcel(oe,F);},exportToJSON:()=>fe.exportToJSON(oe),exportToCSV:()=>fe.exportToCSV(oe),importFromJSON:F=>{let L=fe.importFromJSON(F);ue(L);},getTasks:()=>oe,refresh:()=>{ue(F=>[...F]);},clearAll:()=>{ue([]);}}),[oe,pa,ya,N,ee,se,E,ne]);let Re=useCallback(F=>{Ue(L=>L.map(V=>V.id===F?{...V,visible:!V.visible}:V));},[]),xt=useCallback((F,L)=>{Ue(V=>V.map(re=>{if(re.id!==F)return re;let ge=re.minWidth??100,Ne=re.maxWidth??800,ft=Math.max(ge,Math.min(Ne,L));return {...re,width:ft}}));},[]),Le=useCallback(F=>{ue(L=>{let V=gi(L,F),re=ge=>{for(let Ne of ge){if(Ne.id===F){$e.current.set(F,Ne.isExpanded??true);return}Ne.subtasks?.length&&re(Ne.subtasks);}};return re(V),Ge(),V}),a.onTaskToggleExpand?.(F);},[a,Ge]),At=useCallback((F,L)=>{if(J&&J(F,L)===false)return;let re=fe.findTaskById(oe,F)?.progress,ge=ft=>ft.map(Qt=>Qt.id===F?{...Qt,...L}:Qt.subtasks?{...Qt,subtasks:ge(Qt.subtasks)}:Qt);ue(ge(oe));let Ne=fe.findTaskById(ge(oe),F);Ne&&(M?.(Ne),U?.(Ne),L.progress!==void 0&&re!==void 0&&L.progress!==re&&D?.(F,re,L.progress));},[oe,M,J,U,D]),st=useCallback(F=>{F.length!==0&&(ue(L=>li(L,F)),a.onTaskIndent?.(F[0]));},[a]),ga=useCallback(F=>{F.length!==0&&(ue(L=>di(L,F)),a.onTaskOutdent?.(F[0]));},[a]),zt=useCallback((F,L,V)=>{ue(re=>oc(re,F,L,V)),a.onTaskReparent?.(F,L,V);},[a]),je=useCallback((F,L)=>{F.length!==0&&(ue(V=>ci(V,F,L)),a.onTaskMove?.(F[0],L));},[a]),kt=useCallback(async F=>{let L=[];for(let V of F)G&&await Promise.resolve(G(V))===false||L.push(V);L.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(L):(ue(V=>mi(V,L)),L.forEach(V=>a.onTaskDelete?.(V))),A&&L.forEach(V=>A(V)));},[a,G,A]),ia=useCallback(F=>{ue(L=>pi(L,F)),F.forEach(L=>a.onTaskDuplicate?.(L));},[a]),vr=useCallback((F,L)=>{ue(V=>{let{tasks:re,newTask:ge}=rc(V,F,L);return be&&be(ge)===false?V:(a.onTaskCreate?.(ge.parentId,ge.position||0),$?.(ge),re)});},[a,be,$]),Hm=useCallback((F,L)=>{ue(V=>ui(V,F,L)),a.onTaskRename?.(F,L);},[a]),Zn=useCallback(F=>{ue(L=>{let{tasks:V}=fi(L,F);return a.onTaskCreate?.(F,0),V});},[a]),Wm=useCallback((F,L,V)=>{let re=F.startDate?Math.round((L.getTime()-F.startDate.getTime())/864e5):0,ge=Qt=>Qt.map(xa=>xa.id===F.id?{...xa,startDate:L,endDate:V,...F.segments&&{segments:F.segments}}:xa.subtasks?{...xa,subtasks:ge(xa.subtasks)}:xa),Ne=ge(oe);Ne=fe.autoScheduleDependents(Ne,F.id,re),ue(Ne);let ft={...F,startDate:L,endDate:V};M?.(ft);},[oe,M]),Gm=useCallback((F,L)=>{R?.(F,L),Xt({isOpen:true,x:L.clientX,y:L.clientY,task:F});},[R]),_m=useCallback((F,L)=>{let V=fe.splitTask(oe,F.id,L);ue(V),Xt({isOpen:false,x:0,y:0,task:null});},[oe]),hl=useCallback(F=>{let L=fe.findTaskById(oe,F.id)||F;w?.(L),I||Nt(L);},[oe,w,I]),bl=useCallback((F,L,V)=>{let re=new Map,ge=ka=>{ka.forEach(Fa=>{Fa.dependencies&&re.set(Fa.id,Fa.dependencies),Fa.subtasks&&ge(Fa.subtasks);});};ge(V);let Ne=re.get(L)||[];re.set(L,[...Ne,F]);let ft=new Set,Qt=new Set,xa=ka=>{if(!ft.has(ka)){ft.add(ka),Qt.add(ka);let Fa=re.get(ka)||[];for(let xr of Fa){if(!ft.has(xr)&&xa(xr))return true;if(Qt.has(xr))return true}}return Qt.delete(ka),false};return xa(L)},[]),yl=useCallback((F,L)=>{if(bl(F.id,L,oe)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
343
343
 
344
- Task dependencies must flow in one direction only.`);return}let j=re=>re.map(pe=>{if(pe.id===L){let Ce=pe.dependencies||[];if(!Ce.includes(F.id))return {...pe,dependencies:[...Ce,F.id]}}return pe.subtasks?{...pe,subtasks:j(pe.subtasks)}:pe});me(j(oe)),ye?.(F.id,L);},[oe,ye,bl]),vl=useCallback((F,L)=>{let j=re=>re.map(pe=>{if(pe.id===F&&pe.dependencies){let Ce=pe.dependencies.filter(ft=>ft!==L);return {...pe,dependencies:Ce}}return pe.subtasks?{...pe,subtasks:j(pe.subtasks)}:pe});me(j(oe)),De?.(F,L);},[oe,De]),{startDate:Vm,endDate:jm}=useMemo(()=>{let F=oe.filter(Ce=>Ce.startDate&&Ce.endDate);if(F.length===0){let Ce=new Date,ft=new Date(Ce);ft.setDate(ft.getDate()-30);let Qt=new Date(Ce);return Qt.setDate(Qt.getDate()+60),{startDate:ft,endDate:Qt}}let L=F.flatMap(Ce=>[Ce.startDate,Ce.endDate]).filter(Ce=>Ce!==void 0),j=new Date(Math.min(...L.map(Ce=>Ce.getTime()))),re=new Date(Math.max(...L.map(Ce=>Ce.getTime()))),pe=Me==="day"?7:Me==="week"?14:30;return j.setDate(j.getDate()-pe),re.setDate(re.getDate()+pe),{startDate:j,endDate:re}},[oe,Me]),Km=useCallback(async()=>{if(!ua.current||!Je.current||!va.current)return;await new Promise(Rr=>setTimeout(Rr,200));let F=ua.current,L=Je.current.querySelector(".gantt-grid-scroll"),j=va.current,re=L?.scrollTop||0,pe=L?.scrollLeft||0,Ce=j.scrollTop,ft=j.scrollLeft,Qt=F.style.overflow,xa=F.style.height,ka=L?.style.overflow||"",Fa=j.style.overflow,xr=F.style.width,Qo=j.style.width;try{let Rr=L?.querySelector(".gantt-taskgrid-content"),kr=j.querySelector("svg"),wr=kr?.getAttribute("height")?parseInt(kr.getAttribute("height"),10):kr?.getBoundingClientRect().height||0,ro=Rr?.scrollHeight||L?.scrollHeight||600,$r=Math.max(wr,j.scrollHeight),xl=kr?.getAttribute("width")?parseInt(kr.getAttribute("width"),10):kr?.getBoundingClientRect().width||j.scrollWidth,ep=F.querySelector('[class*="h-12"]')?.offsetHeight||48,es=Math.max(ro,$r,wr),ts=ep+es+50,as=(L?.offsetWidth||300)+xl+10;L&&(L.scrollTop=0,L.scrollLeft=0),j.scrollTop=0,j.scrollLeft=0,F.style.overflow="visible",F.style.height=`${ts}px`,F.style.width=`${as}px`,L&&(L.style.overflow="visible",L.style.height=`${es+50}px`),j.style.overflow="visible",j.style.height=`${es+50}px`,j.style.width=`${xl+10}px`,await new Promise(os=>setTimeout(os,150));let tp=await kc(F,{backgroundColor:E.bgPrimary,scale:2,logging:!1,useCORS:!0,allowTaint:!0,width:as,height:ts,windowWidth:as+100,windowHeight:ts+100,scrollX:0,scrollY:0,ignoreElements:os=>{let kl=window.getComputedStyle(os),wl=parseInt(kl.zIndex,10);return !isNaN(wl)&&wl>=50||kl.position==="fixed"}}),rs=document.createElement("a");rs.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,rs.href=tp.toDataURL("image/png"),rs.click();}finally{F.style.overflow=Qt,F.style.height=xa,F.style.width=xr,L&&(L.style.overflow=ka,L.style.height="",L.scrollTop=re,L.scrollLeft=pe),j.style.overflow=Fa,j.style.height="",j.style.width=Qo,j.scrollTop=Ce,j.scrollLeft=ft;}},[E]),Ym=useCallback(async()=>{await ue.exportToPDF(oe);},[oe]),qm=useCallback(async()=>{await ue.exportToExcel(oe);},[oe]),Xm=useCallback(()=>{let F=ue.exportToCSV(oe),L=new Blob([F],{type:"text/csv;charset=utf-8;"}),j=document.createElement("a");j.href=URL.createObjectURL(L),j.download="gantt-chart.csv",j.click(),URL.revokeObjectURL(j.href);},[oe]),Jm=useCallback(()=>{let F=ue.exportToJSON(oe),L=new Blob([F],{type:"application/json;charset=utf-8;"}),j=document.createElement("a");j.href=URL.createObjectURL(L),j.download="gantt-chart.json",j.click(),URL.revokeObjectURL(j.href);},[oe]),Qm=useCallback(()=>{ue.exportToMSProject(oe,"Gantt Project","project.xml");},[oe]),Zm=F=>{F.preventDefault(),ze(true);},ao=useRef(false);return useEffect(()=>{let F=va.current,L=Je.current?.querySelector(".gantt-grid-scroll");if(!F||!L)return;let j=()=>{if(ao.current)return;ao.current=true;let ft=F.scrollTop;ve(ft),L.scrollTop=ft,requestAnimationFrame(()=>{ao.current=false;});},re=()=>{if(ao.current)return;ao.current=true;let ft=L.scrollTop;ve(ft),F.scrollTop=ft,requestAnimationFrame(()=>{ao.current=false;});},pe=ft=>{if(Pe&&L){let xa=L.parentElement?.getBoundingClientRect()?.left||0,ka=ft.clientX-xa,Fa=200,xr=He+le,Qo=window.innerWidth*Ie,Rr=Math.max(xr,Qo);ka>=Fa&&ka<=Rr&&Et(ka);}},Ce=()=>{ze(false);};return F.addEventListener("scroll",j),L.addEventListener("scroll",re),document.addEventListener("mousemove",pe),document.addEventListener("mouseup",Ce),()=>{F.removeEventListener("scroll",j),L.removeEventListener("scroll",re),document.removeEventListener("mousemove",pe),document.removeEventListener("mouseup",Ce);}},[Pe,He]),jsx(ho.Provider,{value:_,children:jsx(ds.Provider,{value:be,children:jsxs("div",{ref:ua,className:"flex flex-col h-full w-full",style:{backgroundColor:E.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsx(wn,{theme:E,timeScale:Me,onTimeScaleChange:Oe,zoom:We,onZoomChange:et,currentTheme:U,onThemeChange:Ea,rowDensity:he,onRowDensityChange:Ye,showThemeSelector:m,showCreateTaskButton:b,createTaskLabel:y,onCreateTask:l,taskFilter:mt,onTaskFilterChange:z,onExportPNG:i?Km:void 0,onExportPDF:i?Ym:void 0,onExportExcel:i?qm:void 0,onExportCSV:i?Xm:void 0,onExportJSON:i?Jm:void 0,onExportMSProject:i?Qm:void 0}),jsxs("div",{ref:Je,className:"flex-1 flex min-h-0",style:{overflow:"clip",overflowClipMargin:"100px"},children:[jsx("div",{className:"gantt-grid-scroll flex-shrink-0",style:{width:Dt,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsx(Dn,{tasks:ot,theme:E,rowHeight:ne,availableUsers:u,templates:Q,onTaskClick:k,onTaskDblClick:hl,onTaskContextMenu:B,onTaskToggle:Le,scrollTop:ie,columns:Ee,onToggleColumn:Re,onColumnResize:xt,onTaskUpdate:At,onTaskIndent:st,onTaskOutdent:ga,onTaskMove:je,onMultiTaskDelete:kt,onTaskDuplicate:ia,onTaskCreate:vr,onTaskRename:Hm,onCreateSubtask:Zn,onOpenTaskModal:k?F=>k(F):void 0,onDeleteRequest:(F,L)=>Jt({taskId:F,taskName:L}),onTaskReparent:zt})}),jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:E.border,zIndex:15},onMouseDown:Zm}),jsx("div",{ref:va,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsx(In,{tasks:ot,theme:E,rowHeight:ne,timeScale:Me,startDate:Vm,endDate:jm,zoom:We,templates:Q,dependencyLineStyle:a?.dependencyLineStyle,onTaskClick:k,onTaskDblClick:hl,onTaskContextMenu:Gm,onTaskDateChange:Wm,onDependencyCreate:yl,onDependencyDelete:vl})})]}),Fe.task&&jsx(yo,{isOpen:Fe.isOpen,x:Fe.x,y:Fe.y,theme:E,onClose:()=>Xt({isOpen:false,x:0,y:0,task:null}),items:(()=>{let F=Fe.task;if(!F)return [];let L=ue.findTaskById(oe,F.id)||F;return L.subtasks&&L.subtasks.length>0?[{id:"addSubtask",label:_.contextMenu?.addSubtask||"Add Subtask",icon:Rt.Add,onClick:()=>{R?R(L):Zn(L.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:_.contextMenu?.deleteTask||"Delete Task",icon:Rt.Delete,onClick:()=>{Jt({taskId:L.id,taskName:L.name});}}]:[{id:"edit",label:_.contextMenu?.editTask||"Edit Task",icon:Rt.Pencil,onClick:()=>{I?I(L):Nt(L);}},{id:"addSubtask",label:_.contextMenu?.addSubtask||"Add Subtask",icon:Rt.Add,onClick:()=>{R?R(L):Zn(L.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:_.contextMenu?.markIncomplete||"Mark Incomplete",icon:Rt.MarkIncomplete,onClick:()=>{Y?Y(L):At(L.id,{status:"todo",progress:0});},disabled:L.status==="todo"},{id:"setInProgress",label:_.contextMenu?.setInProgress||"Set In Progress",icon:Rt.SetInProgress,onClick:()=>{te?te(L):At(L.id,{status:"in-progress"});},disabled:L.status==="in-progress"},{id:"markComplete",label:_.contextMenu?.markComplete||"Mark Complete",icon:Rt.MarkComplete,onClick:()=>{At(L.id,{status:"completed",progress:100});},disabled:L.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:_.contextMenu?.splitTask||"Split Task",icon:Rt.Split,onClick:()=>{if(!L.startDate||!L.endDate){console.warn("Cannot split task without dates");return}let re=L.startDate.getTime(),pe=L.endDate.getTime(),Ce=re+(pe-re)/2,ft=new Date(Ce);_m(L,ft);},disabled:!L.startDate||!L.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:_.contextMenu?.deleteTask||"Delete Task",icon:Rt.Delete,onClick:()=>{Jt({taskId:L.id,taskName:L.name});}}]})()}),jsx(_r,{task:Ot,isOpen:!!Ot,onClose:()=>Nt(null),onTaskUpdate:F=>{Ot&&(At(Ot.id,F),Nt(null));},theme:U==="light"?"light":"dark",locale:T==="es"?"es":"en",availableUsers:u,availableTasks:t}),jsx(AnimatePresence,{children:ct&&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:()=>Jt(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:F=>F.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:E.bgSecondary,border:`1px solid ${E.border}`},children:[jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${E.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:E.textPrimary,fontFamily:"Inter, sans-serif"},children:[_.contextMenu?.deleteTask||"Delete Task","?"]}),jsx("p",{className:"text-sm mt-1",style:{color:E.textSecondary,fontFamily:"Inter, sans-serif"},children:T==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsx("div",{className:"px-6 py-4",children:jsxs("p",{className:"text-sm leading-relaxed",style:{color:E.textSecondary,fontFamily:"Inter, sans-serif"},children:[T==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxs("span",{className:"font-semibold",style:{color:E.textPrimary},children:['"',ct.taskName,'"']}),"."]})}),jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:E.bgPrimary,borderTop:`1px solid ${E.border}`},children:[jsx("button",{onClick:()=>Jt(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:E.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:F=>{F.currentTarget.style.backgroundColor=E.hoverBg;},onMouseLeave:F=>{F.currentTarget.style.backgroundColor="transparent";},children:T==="es"?"Cancelar":"Cancel"}),jsxs("button",{onClick:()=>{kt([ct.taskId]),Jt(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:F=>{F.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:F=>{F.currentTarget.style.backgroundColor="#EF4444";},children:[jsx(Trash2,{className:"w-4 h-4"}),T==="es"?"Eliminar":"Delete"]})]})]})})}),C?.enabled&&jsx(Bn,{tasks:oe,theme:E,config:C,onTasksUpdate:me,onTaskUpdate:At,onTaskCreate:F=>{me(L=>[...L,F]);},onTaskDelete:F=>{kt([F]);},onDependencyCreate:(F,L)=>{let j=ue.findTaskById(oe,F);j&&yl(j,L);},onDependencyDelete:vl})]})})})});var ki=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],wi=[{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 Nc({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:p=a?"edit":"create",theme:m="dark",customStatuses:i=[],availableTags:u=[],onCreateTag:d,attachments:g=[],onUploadAttachments:h,onDeleteAttachment:C}){let T=[...ki,...i.filter(z=>!ki.some(ie=>ie.id===z.id))],c=qe[m]||qe.dark,[b,y]=useState(false),[l,x]=useState(false),[v,S]=useState(false),[k,w]=useState(false),[B,M]=useState({top:0,left:0}),[D,I]=useState(null),[R,Y]=useState(new Date),[te,ye]=useState({top:0,left:0}),[De,Se]=useState(false),[O,V]=useState([]),$=useRef(null),G=useRef(null),A=useRef(null),X$1=useRef(null),q=useRef(null),[U,fe]=useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[Me,Oe]=useState({});useEffect(()=>{a?(fe({name:a.name,description:a.description||"",startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",priority:a.priority||"medium",isMilestone:a.isMilestone||false,color:a.color||"#6366F1",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&Se(true)):(fe({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),Se(false),V([]));},[a,e]),useEffect(()=>{let z=ie=>{$.current&&!$.current.contains(ie.target)&&y(false),G.current&&!G.current.contains(ie.target)&&x(false),A.current&&!A.current.contains(ie.target)&&S(false),X$1.current&&!X$1.current.contains(ie.target)&&w(false);};return document.addEventListener("mousedown",z),()=>document.removeEventListener("mousedown",z)},[]);let he=()=>{let z={};return U.name.trim()||(z.name="El nombre es requerido"),U.startDate&&U.endDate&&U.startDate>U.endDate&&(z.endDate="La fecha de fin debe ser posterior a la de inicio"),Oe(z),Object.keys(z).length===0},Ye=async z=>{if(z.preventDefault(),!!he())try{let ie=p==="create"&&O.length>0?{...U,pendingFiles:O}:U;await s(ie),V([]),t();}catch(ie){console.error("Error submitting task:",ie);}},We=(z,ie)=>{fe(ve=>{let Pe={...ve,[z]:ie};if(z==="status"){let ze=ie;ze==="todo"?Pe.progress=0:ze==="in-progress"?(ve.progress===0||ve.progress===100)&&(Pe.progress=50):ze==="completed"||ze==="closed"?Pe.progress=100:(ze==="in-review"||ze==="review")&&(Pe.progress=75);}if(z==="progress"){let ze=typeof ie=="number"?ie:parseInt(ie,10);ze===100&&ve.status!=="completed"?Pe.status="completed":ze>0&&ze<100&&ve.status==="todo"?Pe.status="in-progress":ze===0&&ve.status!=="todo"&&(Pe.status="todo");}return Pe}),Me[z]&&Oe(ve=>{let Pe={...ve};return delete Pe[z],Pe});},et=T.find(z=>z.id===U.status)??ki[0],vt=wi.find(z=>z.id===U.priority)??wi[1],Mt=sr.find(z=>z.value===U.color)??sr[0],mt={backgroundColor:c.bgSecondary,border:`1px solid ${c.borderLight}`,color:c.textPrimary};return jsx(AnimatePresence,{children:e&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/60 z-50",onClick:t}),jsx(motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none",children:jsxs("div",{className:"w-full max-w-xl rounded-xl shadow-2xl pointer-events-auto overflow-hidden","data-theme":m,style:{backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`},onClick:z=>z.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${c.border}`},children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:et.color||c.accent}}),jsx("span",{className:"text-sm font-medium",style:{color:c.textSecondary},children:p==="create"?"Nueva tarea":"Editar tarea"})]}),jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:c.textTertiary},onMouseEnter:z=>{z.currentTarget.style.backgroundColor=c.hoverBg,z.currentTarget.style.color=c.textPrimary;},onMouseLeave:z=>{z.currentTarget.style.backgroundColor="transparent",z.currentTarget.style.color=c.textTertiary;},disabled:n,children:jsx(X,{className:"w-4 h-4"})})]}),jsxs("form",{onSubmit:Ye,className:"max-h-[calc(100vh-200px)] overflow-y-auto",children:[jsxs("div",{className:"p-5 space-y-4",children:[jsxs("div",{children:[jsx("input",{type:"text",value:U.name,onChange:z=>We("name",z.target.value),className:"w-full text-lg font-medium bg-transparent border-none focus:outline-none focus:ring-0 placeholder:opacity-50",style:{color:c.textPrimary},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),Me.name&&jsxs("p",{className:"mt-1 text-xs text-red-400 flex items-center gap-1",children:[jsx(AlertCircle,{className:"w-3 h-3"}),Me.name]})]}),jsx("div",{children:jsx("textarea",{value:U.description||"",onChange:z=>We("description",z.target.value),className:"w-full text-sm bg-transparent border-none focus:outline-none focus:ring-0 resize-none placeholder:opacity-40",style:{color:c.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})}),jsx("div",{style:{borderTop:`1px solid ${c.borderLight}`}}),jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxs("div",{ref:$,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&y(!b),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...mt,borderColor:et.color,backgroundColor:`${et.color}15`},disabled:n,children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:et.color}}),jsx("span",{style:{color:et.color},children:et.title}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:et.color}})]}),jsx(AnimatePresence,{children:b&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`},children:T.map(z=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:c.textPrimary},onMouseEnter:ie=>ie.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:ie=>ie.currentTarget.style.backgroundColor="transparent",onClick:()=>{We("status",z.id),y(false);},children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:z.color}}),z.title,U.status===z.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:c.accent}})]},z.id))})})]}),jsxs("div",{ref:G,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&x(!l),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:mt,disabled:n,children:[jsx(Flag,{className:"w-3.5 h-3.5",style:{color:vt.color}}),jsx("span",{children:vt.label}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:c.textTertiary}})]}),jsx(AnimatePresence,{children:l&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`},children:wi.map(z=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:c.textPrimary},onMouseEnter:ie=>ie.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:ie=>ie.currentTarget.style.backgroundColor="transparent",onClick:()=>{We("priority",z.id),x(false);},children:[jsx("span",{children:z.icon}),z.label,U.priority===z.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:c.accent}})]},z.id))})})]}),o.length>0&&jsxs("div",{ref:A,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&S(!v),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:mt,disabled:n,children:[U.assignees&&U.assignees.length>0?jsxs(Fragment,{children:[jsx("div",{className:"flex -space-x-1",children:U.assignees.slice(0,3).map((z,ie)=>jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:z.color||c.accent,borderColor:c.bgSecondary},children:z.initials},ie))}),U.assignees.length>3&&jsxs("span",{style:{color:c.textTertiary},children:["+",U.assignees.length-3]})]}):jsxs(Fragment,{children:[jsx(Users,{className:"w-3.5 h-3.5",style:{color:c.textTertiary}}),jsx("span",{style:{color:c.textTertiary},children:"Asignar"})]}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:c.textTertiary}})]}),jsx(AnimatePresence,{children:v&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg shadow-xl",style:{backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`},children:o.map(z=>{let ie=U.assignees?.some(ve=>ve.name===z.name);return jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:c.textPrimary},onMouseEnter:ve=>ve.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:ve=>ve.currentTarget.style.backgroundColor="transparent",onClick:()=>{let ve=ie?(U.assignees||[]).filter(Pe=>Pe.name!==z.name):[...U.assignees||[],{name:z.name,avatar:z.avatar,initials:z.name.split(" ").map(Pe=>Pe[0]).join("").toUpperCase().slice(0,2),color:c.accent}];We("assignees",ve);},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:c.accent},children:z.name.charAt(0).toUpperCase()}),jsx("span",{className:"truncate flex-1 text-left",children:z.name}),jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:ie&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:c.accent}})})]},z.id)})})})]}),jsxs("div",{ref:X$1,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>{if(!n)if(k)w(false);else {if(X$1.current){let z=X$1.current.getBoundingClientRect(),ie=window.innerHeight,ve=120,ze=ie-z.bottom<ve?z.top-ve-8:z.bottom+8;M({top:ze,left:z.left});}w(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:mt,disabled:n,children:[jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:U.color}}),jsx("span",{children:Mt.name}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:c.textTertiary}})]}),jsx(AnimatePresence,{children:k&&jsxs(lt,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>w(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:`${B.top}px`,left:`${B.left}px`,zIndex:99999,backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:z=>z.stopPropagation(),children:jsx("div",{style:{padding:"6px 8px"},children:jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:sr.slice(0,18).map(z=>{let ie=U.color===z.value;return jsx("button",{type:"button",onClick:ve=>{ve.preventDefault(),ve.stopPropagation(),We("color",z.value),w(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:z.name,children:jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:z.value,outline:ie?`2px solid ${z.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},z.value)})})})})]})})]}),u.length>0||d?jsx(nr,{selectedTags:U.tags||[],availableTags:u,onChange:z=>We("tags",z),onCreateTag:d,theme:c,disabled:n}):null]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Calendar,{className:"w-4 h-4",style:{color:c.textTertiary}}),jsxs("div",{ref:q,className:"flex items-center gap-2 flex-1 relative",children:[jsx("button",{type:"button",onClick:()=>{if(!n&&!U.isMilestone)if(D==="start")I(null);else {if(q.current){let z=q.current.getBoundingClientRect(),ie=window.innerHeight,ve=320,ze=ie-z.bottom<ve?z.top-ve-8:z.bottom+8;ye({top:ze,left:z.left});}I("start"),Y(U.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...mt,opacity:U.isMilestone?.5:1,cursor:U.isMilestone?"not-allowed":"pointer"},disabled:n||U.isMilestone,children:U.startDate?U.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsx("span",{style:{color:c.textTertiary},children:"\u2192"}),jsx("button",{type:"button",onClick:()=>{if(!n&&!U.isMilestone)if(D==="end")I(null);else {if(q.current){let z=q.current.getBoundingClientRect(),ie=window.innerHeight,ve=320,ze=ie-z.bottom<ve?z.top-ve-8:z.bottom+8;ye({top:ze,left:z.left});}I("end"),Y(U.endDate||U.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...mt,opacity:U.isMilestone?.5:1,cursor:U.isMilestone?"not-allowed":"pointer"},disabled:n||U.isMilestone,children:U.endDate?U.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsx(AnimatePresence,{children:D&&jsxs(lt,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>I(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:`${te.top}px`,left:`${te.left}px`,zIndex:99999,backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`},onClick:z=>z.stopPropagation(),children:[jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${c.border}`},children:[(()=>{let z=new Date,ie=new Date(z);ie.setDate(z.getDate()+1);let ve=new Date(z);ve.setDate(z.getDate()+7);let Pe=new Date(z);return Pe.setDate(z.getDate()+14),[{label:"Hoy",date:z},{label:"Ma\xF1ana",date:ie},{label:"Pr\xF3xima semana",date:ve},{label:"2 semanas",date:Pe}].map((at,Et)=>jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:c.textPrimary},onMouseEnter:Fe=>Fe.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:Fe=>Fe.currentTarget.style.backgroundColor="transparent",onClick:()=>{D==="start"?(We("startDate",at.date),(!U.endDate||at.date>U.endDate)&&We("endDate",at.date),I("end")):(We("endDate",at.date),(!U.startDate||at.date<U.startDate)&&We("startDate",at.date),I(null));},children:at.label},Et))})(),jsx("div",{style:{borderTop:`1px solid ${c.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:z=>z.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:z=>z.currentTarget.style.backgroundColor="transparent",onClick:()=>{We("startDate",void 0),We("endDate",void 0),I(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:()=>Y(new Date(R.getFullYear(),R.getMonth()-1)),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronLeft,{className:"w-4 h-4",style:{color:c.textSecondary}})}),jsx("span",{className:"text-sm font-medium",style:{color:c.textPrimary},children:R.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>Y(new Date(R.getFullYear(),R.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronRight,{className:"w-4 h-4",style:{color:c.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((z,ie)=>jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:c.textTertiary},children:z},ie))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let z=R.getFullYear(),ie=R.getMonth(),ve=new Date(z,ie,1).getDay(),Pe=new Date(z,ie+1,0).getDate(),ze=new Date,at=[];for(let Fe=ve-1;Fe>=0;Fe--)at.push({day:new Date(z,ie,-Fe).getDate(),date:new Date(z,ie-1,new Date(z,ie,-Fe).getDate()),isCurrentMonth:false});for(let Fe=1;Fe<=Pe;Fe++)at.push({day:Fe,date:new Date(z,ie,Fe),isCurrentMonth:true});let Et=42-at.length;for(let Fe=1;Fe<=Et;Fe++)at.push({day:Fe,date:new Date(z,ie+1,Fe),isCurrentMonth:false});return at.map((Fe,Xt)=>{let Ot=Fe.date.toDateString()===ze.toDateString(),Nt=U.startDate?.toDateString()===Fe.date.toDateString(),ct=U.endDate?.toDateString()===Fe.date.toDateString(),Jt=U.startDate&&U.endDate&&Fe.date>=U.startDate&&Fe.date<=U.endDate;return jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:Fe.isCurrentMonth?Nt||ct?"#FFF":c.textPrimary:c.textTertiary,backgroundColor:Nt?"#3B82F6":ct?"#7C3AED":Jt?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Ot&&!Nt&&!ct?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{D==="start"?(We("startDate",Fe.date),U.endDate&&Fe.date>U.endDate&&We("endDate",Fe.date),I("end")):(We("endDate",Fe.date),U.startDate&&Fe.date<U.startDate&&We("startDate",Fe.date),I(null));},children:Fe.day},Xt)})})()})]})]})]})})]}),Me.endDate&&jsx("span",{className:"text-xs text-red-400",children:Me.endDate})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:"w-4 h-4",style:{color:c.textTertiary}}),jsxs("div",{className:"flex items-center gap-3 flex-1",children:[jsx("input",{type:"range",min:"0",max:"100",step:"5",value:U.progress,onChange:z=>We("progress",parseInt(z.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:c.bgSecondary,accentColor:U.progress<30?"#EF4444":U.progress<70?"#F59E0B":"#10B981"},disabled:n}),jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${U.progress<30?"#EF4444":U.progress<70?"#F59E0B":"#10B981"}20`,color:U.progress<30?"#EF4444":U.progress<70?"#F59E0B":"#10B981"},children:[U.progress,"%"]})]})]}),jsxs("div",{children:[jsxs("button",{type:"button",onClick:()=>Se(!De),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:c.textTertiary},children:[jsx(ChevronDown,{className:`w-3 h-3 transition-transform ${De?"rotate-180":""}`}),"Opciones avanzadas"]}),jsx(AnimatePresence,{children:De&&jsx(motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxs("div",{className:"pt-3 space-y-3",children:[(h||g.length>0||p==="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:c.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:c.textTertiary},children:["Adjuntos ",p==="create"?O.length>0&&`(${O.length})`:g.length>0&&`(${g.length})`]})]}),p==="create"?jsx(dr,{cardId:"pending",attachments:O.map((z,ie)=>({id:`pending-${ie}`,cardId:"pending",name:z.name,size:z.size,type:z.type,url:URL.createObjectURL(z),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:z=>V(ie=>[...ie,...z]),onDelete:z=>{let ie=parseInt(z.replace("pending-",""),10);V(ve=>ve.filter((Pe,ze)=>ze!==ie));},maxSizeMB:10,maxFiles:20}):jsx(dr,{cardId:a?.id||"new",attachments:g,onUpload:h&&a?.id?z=>h(a.id,z):void 0,onDelete:C,maxSizeMB:10,maxFiles:20}),p==="create"&&O.length>0&&jsxs("p",{className:"text-xs mt-1",style:{color:c.textTertiary},children:[O.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors hover:bg-white/5",children:[jsx("input",{type:"checkbox",checked:U.isMilestone,onChange:z=>We("isMilestone",z.target.checked),className:"w-4 h-4 rounded",style:{accentColor:c.accent},disabled:n}),jsx(Milestone,{className:"w-4 h-4 text-yellow-500"}),jsx("span",{className:"text-sm",style:{color:c.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxs("div",{children:[jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:c.textTertiary},children:[jsx(Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),jsx("div",{className:"flex flex-wrap gap-1.5 max-h-24 overflow-y-auto p-2 rounded-lg",style:{backgroundColor:c.bgSecondary},children:r.filter(z=>z.id!==a?.id).map(z=>{let ie=U.dependencies?.includes(z.id);return jsx("button",{type:"button",onClick:()=>{let ve=ie?(U.dependencies||[]).filter(Pe=>Pe!==z.id):[...U.dependencies||[],z.id];We("dependencies",ve);},className:"px-2 py-1 rounded-full text-xs transition-colors",style:{backgroundColor:ie?`${c.accent}30`:c.bgPrimary,color:ie?c.accent:c.textSecondary,border:`1px solid ${ie?c.accent:c.borderLight}`},disabled:n,children:z.name},z.id)})})]})]})})})]})]}),jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${c.border}`},children:[jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:c.textSecondary},onMouseEnter:z=>z.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:z=>z.currentTarget.style.backgroundColor="transparent",disabled:n,children:"Cancelar"}),jsx("button",{type:"submit",disabled:n,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:c.accent,color:"#FFF"},onMouseEnter:z=>!n&&(z.currentTarget.style.opacity="0.9"),onMouseLeave:z=>!n&&(z.currentTarget.style.opacity="1"),children:n?jsxs(Fragment,{children:[jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsx(Fragment,{children:p==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var Dc=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
344
+ Task dependencies must flow in one direction only.`);return}let V=re=>re.map(ge=>{if(ge.id===L){let Ne=ge.dependencies||[];if(!Ne.includes(F.id))return {...ge,dependencies:[...Ne,F.id]}}return ge.subtasks?{...ge,subtasks:V(ge.subtasks)}:ge});ue(V(oe)),ie?.(F.id,L);},[oe,ie,bl]),vl=useCallback((F,L)=>{let V=re=>re.map(ge=>{if(ge.id===F&&ge.dependencies){let Ne=ge.dependencies.filter(ft=>ft!==L);return {...ge,dependencies:Ne}}return ge.subtasks?{...ge,subtasks:V(ge.subtasks)}:ge});ue(V(oe)),de?.(F,L);},[oe,de]),{startDate:Vm,endDate:jm}=useMemo(()=>{let F=oe.filter(Ne=>Ne.startDate&&Ne.endDate);if(F.length===0){let Ne=new Date,ft=new Date(Ne);ft.setDate(ft.getDate()-30);let Qt=new Date(Ne);return Qt.setDate(Qt.getDate()+60),{startDate:ft,endDate:Qt}}let L=F.flatMap(Ne=>[Ne.startDate,Ne.endDate]).filter(Ne=>Ne!==void 0),V=new Date(Math.min(...L.map(Ne=>Ne.getTime()))),re=new Date(Math.max(...L.map(Ne=>Ne.getTime()))),ge=Me==="day"?7:Me==="week"?14:30;return V.setDate(V.getDate()-ge),re.setDate(re.getDate()+ge),{startDate:V,endDate:re}},[oe,Me]),Km=useCallback(async()=>{if(!ua.current||!Je.current||!va.current)return;await new Promise(Rr=>setTimeout(Rr,200));let F=ua.current,L=Je.current.querySelector(".gantt-grid-scroll"),V=va.current,re=L?.scrollTop||0,ge=L?.scrollLeft||0,Ne=V.scrollTop,ft=V.scrollLeft,Qt=F.style.overflow,xa=F.style.height,ka=L?.style.overflow||"",Fa=V.style.overflow,xr=F.style.width,Qo=V.style.width;try{let Rr=L?.querySelector(".gantt-taskgrid-content"),kr=V.querySelector("svg"),wr=kr?.getAttribute("height")?parseInt(kr.getAttribute("height"),10):kr?.getBoundingClientRect().height||0,ro=Rr?.scrollHeight||L?.scrollHeight||600,$r=Math.max(wr,V.scrollHeight),xl=kr?.getAttribute("width")?parseInt(kr.getAttribute("width"),10):kr?.getBoundingClientRect().width||V.scrollWidth,ep=F.querySelector('[class*="h-12"]')?.offsetHeight||48,es=Math.max(ro,$r,wr),ts=ep+es+50,as=(L?.offsetWidth||300)+xl+10;L&&(L.scrollTop=0,L.scrollLeft=0),V.scrollTop=0,V.scrollLeft=0,F.style.overflow="visible",F.style.height=`${ts}px`,F.style.width=`${as}px`,L&&(L.style.overflow="visible",L.style.height=`${es+50}px`),V.style.overflow="visible",V.style.height=`${es+50}px`,V.style.width=`${xl+10}px`,await new Promise(os=>setTimeout(os,150));let tp=await kc(F,{backgroundColor:E.bgPrimary,scale:2,logging:!1,useCORS:!0,allowTaint:!0,width:as,height:ts,windowWidth:as+100,windowHeight:ts+100,scrollX:0,scrollY:0,ignoreElements:os=>{let kl=window.getComputedStyle(os),wl=parseInt(kl.zIndex,10);return !isNaN(wl)&&wl>=50||kl.position==="fixed"}}),rs=document.createElement("a");rs.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,rs.href=tp.toDataURL("image/png"),rs.click();}finally{F.style.overflow=Qt,F.style.height=xa,F.style.width=xr,L&&(L.style.overflow=ka,L.style.height="",L.scrollTop=re,L.scrollLeft=ge),V.style.overflow=Fa,V.style.height="",V.style.width=Qo,V.scrollTop=Ne,V.scrollLeft=ft;}},[E]),Ym=useCallback(async()=>{await fe.exportToPDF(oe);},[oe]),qm=useCallback(async()=>{await fe.exportToExcel(oe);},[oe]),Xm=useCallback(()=>{let F=fe.exportToCSV(oe),L=new Blob([F],{type:"text/csv;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(L),V.download="gantt-chart.csv",V.click(),URL.revokeObjectURL(V.href);},[oe]),Jm=useCallback(()=>{let F=fe.exportToJSON(oe),L=new Blob([F],{type:"application/json;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(L),V.download="gantt-chart.json",V.click(),URL.revokeObjectURL(V.href);},[oe]),Qm=useCallback(()=>{fe.exportToMSProject(oe,"Gantt Project","project.xml");},[oe]),Zm=F=>{F.preventDefault(),ze(true);},ao=useRef(false);return useEffect(()=>{let F=va.current,L=Je.current?.querySelector(".gantt-grid-scroll");if(!F||!L)return;let V=()=>{if(ao.current)return;ao.current=true;let ft=F.scrollTop;xe(ft),L.scrollTop=ft,requestAnimationFrame(()=>{ao.current=false;});},re=()=>{if(ao.current)return;ao.current=true;let ft=L.scrollTop;xe(ft),F.scrollTop=ft,requestAnimationFrame(()=>{ao.current=false;});},ge=ft=>{if(Pe&&L){let xa=L.parentElement?.getBoundingClientRect()?.left||0,ka=ft.clientX-xa,Fa=200,xr=He+ce,Qo=window.innerWidth*Ie,Rr=Math.max(xr,Qo);ka>=Fa&&ka<=Rr&&Et(ka);}},Ne=()=>{ze(false);};return F.addEventListener("scroll",V),L.addEventListener("scroll",re),document.addEventListener("mousemove",ge),document.addEventListener("mouseup",Ne),()=>{F.removeEventListener("scroll",V),L.removeEventListener("scroll",re),document.removeEventListener("mousemove",ge),document.removeEventListener("mouseup",Ne);}},[Pe,He]),jsx(ho.Provider,{value:_,children:jsx(ds.Provider,{value:ve,children:jsxs("div",{ref:ua,className:"flex flex-col h-full w-full",style:{backgroundColor:E.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsx(wn,{theme:E,timeScale:Me,onTimeScaleChange:Oe,zoom:We,onZoomChange:et,currentTheme:H,onThemeChange:Ea,rowDensity:ye,onRowDensityChange:Ye,showThemeSelector:m,showCreateTaskButton:b,createTaskLabel:y,onCreateTask:l,taskFilter:mt,onTaskFilterChange:O,onExportPNG:i?Km:void 0,onExportPDF:i?Ym:void 0,onExportExcel:i?qm:void 0,onExportCSV:i?Xm:void 0,onExportJSON:i?Jm:void 0,onExportMSProject:i?Qm:void 0}),jsxs("div",{ref:Je,className:"flex-1 flex min-h-0",style:{overflow:"clip",overflowClipMargin:"100px"},children:[jsx("div",{className:"gantt-grid-scroll flex-shrink-0",style:{width:Dt,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsx(Dn,{tasks:ot,theme:E,rowHeight:ne,availableUsers:u,templates:q,onTaskClick:k,onTaskDblClick:hl,onTaskContextMenu:R,onTaskToggle:Le,scrollTop:le,columns:Ee,onToggleColumn:Re,onColumnResize:xt,onTaskUpdate:At,onTaskIndent:st,onTaskOutdent:ga,onTaskMove:je,onMultiTaskDelete:kt,onTaskDuplicate:ia,onTaskCreate:vr,onTaskRename:Hm,onCreateSubtask:Zn,onOpenTaskModal:k?F=>k(F):void 0,onDeleteRequest:(F,L)=>Jt({taskId:F,taskName:L}),onTaskReparent:zt})}),jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:E.border,zIndex:15},onMouseDown:Zm}),jsx("div",{ref:va,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsx(In,{tasks:ot,theme:E,rowHeight:ne,timeScale:Me,startDate:Vm,endDate:jm,zoom:We,templates:q,dependencyLineStyle:a?.dependencyLineStyle,onTaskClick:k,onTaskDblClick:hl,onTaskContextMenu:Gm,onTaskDateChange:Wm,onDependencyCreate:yl,onDependencyDelete:vl})})]}),Fe.task&&jsx(yo,{isOpen:Fe.isOpen,x:Fe.x,y:Fe.y,theme:E,onClose:()=>Xt({isOpen:false,x:0,y:0,task:null}),items:(()=>{let F=Fe.task;if(!F)return [];let L=fe.findTaskById(oe,F.id)||F;return L.subtasks&&L.subtasks.length>0?[{id:"addSubtask",label:_.contextMenu?.addSubtask||"Add Subtask",icon:Rt.Add,onClick:()=>{B?B(L):Zn(L.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:_.contextMenu?.deleteTask||"Delete Task",icon:Rt.Delete,onClick:()=>{Jt({taskId:L.id,taskName:L.name});}}]:[{id:"edit",label:_.contextMenu?.editTask||"Edit Task",icon:Rt.Pencil,onClick:()=>{I?I(L):Nt(L);}},{id:"addSubtask",label:_.contextMenu?.addSubtask||"Add Subtask",icon:Rt.Add,onClick:()=>{B?B(L):Zn(L.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:_.contextMenu?.markIncomplete||"Mark Incomplete",icon:Rt.MarkIncomplete,onClick:()=>{K?K(L):At(L.id,{status:"todo",progress:0});},disabled:L.status==="todo"},{id:"setInProgress",label:_.contextMenu?.setInProgress||"Set In Progress",icon:Rt.SetInProgress,onClick:()=>{te?te(L):At(L.id,{status:"in-progress"});},disabled:L.status==="in-progress"},{id:"markComplete",label:_.contextMenu?.markComplete||"Mark Complete",icon:Rt.MarkComplete,onClick:()=>{At(L.id,{status:"completed",progress:100});},disabled:L.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:_.contextMenu?.splitTask||"Split Task",icon:Rt.Split,onClick:()=>{if(!L.startDate||!L.endDate){console.warn("Cannot split task without dates");return}let re=L.startDate.getTime(),ge=L.endDate.getTime(),Ne=re+(ge-re)/2,ft=new Date(Ne);_m(L,ft);},disabled:!L.startDate||!L.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:_.contextMenu?.deleteTask||"Delete Task",icon:Rt.Delete,onClick:()=>{Jt({taskId:L.id,taskName:L.name});}}]})()}),jsx(_r,{task:Ot,isOpen:!!Ot,onClose:()=>Nt(null),onTaskUpdate:F=>{Ot&&(At(Ot.id,F),Nt(null));},theme:H==="light"?"light":"dark",locale:T==="es"?"es":"en",availableUsers:u,availableTasks:t}),jsx(AnimatePresence,{children:ct&&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:()=>Jt(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:F=>F.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:E.bgSecondary,border:`1px solid ${E.border}`},children:[jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${E.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:E.textPrimary,fontFamily:"Inter, sans-serif"},children:[_.contextMenu?.deleteTask||"Delete Task","?"]}),jsx("p",{className:"text-sm mt-1",style:{color:E.textSecondary,fontFamily:"Inter, sans-serif"},children:T==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsx("div",{className:"px-6 py-4",children:jsxs("p",{className:"text-sm leading-relaxed",style:{color:E.textSecondary,fontFamily:"Inter, sans-serif"},children:[T==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxs("span",{className:"font-semibold",style:{color:E.textPrimary},children:['"',ct.taskName,'"']}),"."]})}),jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:E.bgPrimary,borderTop:`1px solid ${E.border}`},children:[jsx("button",{onClick:()=>Jt(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:E.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:F=>{F.currentTarget.style.backgroundColor=E.hoverBg;},onMouseLeave:F=>{F.currentTarget.style.backgroundColor="transparent";},children:T==="es"?"Cancelar":"Cancel"}),jsxs("button",{onClick:()=>{kt([ct.taskId]),Jt(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:F=>{F.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:F=>{F.currentTarget.style.backgroundColor="#EF4444";},children:[jsx(Trash2,{className:"w-4 h-4"}),T==="es"?"Eliminar":"Delete"]})]})]})})}),C?.enabled&&jsx(Bn,{tasks:oe,theme:E,config:C,onTasksUpdate:ue,onTaskUpdate:At,onTaskCreate:F=>{ue(L=>[...L,F]);},onTaskDelete:F=>{kt([F]);},onDependencyCreate:(F,L)=>{let V=fe.findTaskById(oe,F);V&&yl(V,L);},onDependencyDelete:vl})]})})})});var ki=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],wi=[{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 Nc({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:p=a?"edit":"create",theme:m="dark",customStatuses:i=[],availableTags:u=[],onCreateTag:d,attachments:g=[],onUploadAttachments:h,onDeleteAttachment:C}){let T=[...ki,...i.filter(O=>!ki.some(le=>le.id===O.id))],c=qe[m]||qe.dark,[b,y]=useState(false),[l,x]=useState(false),[v,S]=useState(false),[k,w]=useState(false),[R,M]=useState({top:0,left:0}),[D,I]=useState(null),[B,K]=useState(new Date),[te,ie]=useState({top:0,left:0}),[de,be]=useState(false),[$,J]=useState([]),U=useRef(null),G=useRef(null),A=useRef(null),Q=useRef(null),X$1=useRef(null),[H,Ce]=useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[Me,Oe]=useState({});useEffect(()=>{a?(Ce({name:a.name,description:a.description||"",startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",priority:a.priority||"medium",isMilestone:a.isMilestone||false,color:a.color||"#6366F1",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&be(true)):(Ce({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),be(false),J([]));},[a,e]),useEffect(()=>{let O=le=>{U.current&&!U.current.contains(le.target)&&y(false),G.current&&!G.current.contains(le.target)&&x(false),A.current&&!A.current.contains(le.target)&&S(false),Q.current&&!Q.current.contains(le.target)&&w(false);};return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[]);let ye=()=>{let O={};return H.name.trim()||(O.name="El nombre es requerido"),H.startDate&&H.endDate&&H.startDate>H.endDate&&(O.endDate="La fecha de fin debe ser posterior a la de inicio"),Oe(O),Object.keys(O).length===0},Ye=async O=>{if(O.preventDefault(),!!ye())try{let le=p==="create"&&$.length>0?{...H,pendingFiles:$}:H;await s(le),J([]),t();}catch(le){console.error("Error submitting task:",le);}},We=(O,le)=>{Ce(xe=>{let Pe={...xe,[O]:le};if(O==="status"){let ze=le;ze==="todo"?Pe.progress=0:ze==="in-progress"?(xe.progress===0||xe.progress===100)&&(Pe.progress=50):ze==="completed"||ze==="closed"?Pe.progress=100:(ze==="in-review"||ze==="review")&&(Pe.progress=75);}if(O==="progress"){let ze=typeof le=="number"?le:parseInt(le,10);ze===100&&xe.status!=="completed"?Pe.status="completed":ze>0&&ze<100&&xe.status==="todo"?Pe.status="in-progress":ze===0&&xe.status!=="todo"&&(Pe.status="todo");}return Pe}),Me[O]&&Oe(xe=>{let Pe={...xe};return delete Pe[O],Pe});},et=T.find(O=>O.id===H.status)??ki[0],vt=wi.find(O=>O.id===H.priority)??wi[1],Mt=sr.find(O=>O.value===H.color)??sr[0],mt={backgroundColor:c.bgSecondary,border:`1px solid ${c.borderLight}`,color:c.textPrimary};return jsx(AnimatePresence,{children:e&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/60 z-50",onClick:t}),jsx(motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none",children:jsxs("div",{className:"w-full max-w-xl rounded-xl shadow-2xl pointer-events-auto overflow-hidden","data-theme":m,style:{backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`},onClick:O=>O.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${c.border}`},children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:et.color||c.accent}}),jsx("span",{className:"text-sm font-medium",style:{color:c.textSecondary},children:p==="create"?"Nueva tarea":"Editar tarea"})]}),jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:c.textTertiary},onMouseEnter:O=>{O.currentTarget.style.backgroundColor=c.hoverBg,O.currentTarget.style.color=c.textPrimary;},onMouseLeave:O=>{O.currentTarget.style.backgroundColor="transparent",O.currentTarget.style.color=c.textTertiary;},disabled:n,children:jsx(X,{className:"w-4 h-4"})})]}),jsxs("form",{onSubmit:Ye,className:"max-h-[calc(100vh-200px)] overflow-y-auto",children:[jsxs("div",{className:"p-5 space-y-4",children:[jsxs("div",{children:[jsx("input",{type:"text",value:H.name,onChange:O=>We("name",O.target.value),className:"w-full text-lg font-medium bg-transparent border-none focus:outline-none focus:ring-0 placeholder:opacity-50",style:{color:c.textPrimary},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),Me.name&&jsxs("p",{className:"mt-1 text-xs text-red-400 flex items-center gap-1",children:[jsx(AlertCircle,{className:"w-3 h-3"}),Me.name]})]}),jsx("div",{children:jsx("textarea",{value:H.description||"",onChange:O=>We("description",O.target.value),className:"w-full text-sm bg-transparent border-none focus:outline-none focus:ring-0 resize-none placeholder:opacity-40",style:{color:c.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})}),jsx("div",{style:{borderTop:`1px solid ${c.borderLight}`}}),jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxs("div",{ref:U,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&y(!b),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...mt,borderColor:et.color,backgroundColor:`${et.color}15`},disabled:n,children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:et.color}}),jsx("span",{style:{color:et.color},children:et.title}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:et.color}})]}),jsx(AnimatePresence,{children:b&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`},children:T.map(O=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:c.textPrimary},onMouseEnter:le=>le.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:le=>le.currentTarget.style.backgroundColor="transparent",onClick:()=>{We("status",O.id),y(false);},children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:O.color}}),O.title,H.status===O.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:c.accent}})]},O.id))})})]}),jsxs("div",{ref:G,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&x(!l),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:mt,disabled:n,children:[jsx(Flag,{className:"w-3.5 h-3.5",style:{color:vt.color}}),jsx("span",{children:vt.label}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:c.textTertiary}})]}),jsx(AnimatePresence,{children:l&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`},children:wi.map(O=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:c.textPrimary},onMouseEnter:le=>le.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:le=>le.currentTarget.style.backgroundColor="transparent",onClick:()=>{We("priority",O.id),x(false);},children:[jsx("span",{children:O.icon}),O.label,H.priority===O.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:c.accent}})]},O.id))})})]}),o.length>0&&jsxs("div",{ref:A,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&S(!v),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:mt,disabled:n,children:[H.assignees&&H.assignees.length>0?jsxs(Fragment,{children:[jsx("div",{className:"flex -space-x-1",children:H.assignees.slice(0,3).map((O,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:O.color||c.accent,borderColor:c.bgSecondary},children:O.initials},le))}),H.assignees.length>3&&jsxs("span",{style:{color:c.textTertiary},children:["+",H.assignees.length-3]})]}):jsxs(Fragment,{children:[jsx(Users,{className:"w-3.5 h-3.5",style:{color:c.textTertiary}}),jsx("span",{style:{color:c.textTertiary},children:"Asignar"})]}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:c.textTertiary}})]}),jsx(AnimatePresence,{children:v&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg shadow-xl",style:{backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`},children:o.map(O=>{let le=H.assignees?.some(xe=>xe.name===O.name);return jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:c.textPrimary},onMouseEnter:xe=>xe.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:xe=>xe.currentTarget.style.backgroundColor="transparent",onClick:()=>{let xe=le?(H.assignees||[]).filter(Pe=>Pe.name!==O.name):[...H.assignees||[],{name:O.name,avatar:O.avatar,initials:O.name.split(" ").map(Pe=>Pe[0]).join("").toUpperCase().slice(0,2),color:c.accent}];We("assignees",xe);},children:[jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:c.accent},children:O.name.charAt(0).toUpperCase()}),jsx("span",{className:"truncate flex-1 text-left",children:O.name}),jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:le&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:c.accent}})})]},O.id)})})})]}),jsxs("div",{ref:Q,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>{if(!n)if(k)w(false);else {if(Q.current){let O=Q.current.getBoundingClientRect(),le=window.innerHeight,xe=120,ze=le-O.bottom<xe?O.top-xe-8:O.bottom+8;M({top:ze,left:O.left});}w(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:mt,disabled:n,children:[jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:H.color}}),jsx("span",{children:Mt.name}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:c.textTertiary}})]}),jsx(AnimatePresence,{children:k&&jsxs(lt,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>w(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${R.top}px`,left:`${R.left}px`,zIndex:99999,backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:O=>O.stopPropagation(),children:jsx("div",{style:{padding:"6px 8px"},children:jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:sr.slice(0,18).map(O=>{let le=H.color===O.value;return jsx("button",{type:"button",onClick:xe=>{xe.preventDefault(),xe.stopPropagation(),We("color",O.value),w(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:O.name,children:jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:O.value,outline:le?`2px solid ${O.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},O.value)})})})})]})})]}),u.length>0||d?jsx(nr,{selectedTags:H.tags||[],availableTags:u,onChange:O=>We("tags",O),onCreateTag:d,theme:c,disabled:n}):null]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Calendar,{className:"w-4 h-4",style:{color:c.textTertiary}}),jsxs("div",{ref:X$1,className:"flex items-center gap-2 flex-1 relative",children:[jsx("button",{type:"button",onClick:()=>{if(!n&&!H.isMilestone)if(D==="start")I(null);else {if(X$1.current){let O=X$1.current.getBoundingClientRect(),le=window.innerHeight,xe=320,ze=le-O.bottom<xe?O.top-xe-8:O.bottom+8;ie({top:ze,left:O.left});}I("start"),K(H.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...mt,opacity:H.isMilestone?.5:1,cursor:H.isMilestone?"not-allowed":"pointer"},disabled:n||H.isMilestone,children:H.startDate?H.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsx("span",{style:{color:c.textTertiary},children:"\u2192"}),jsx("button",{type:"button",onClick:()=>{if(!n&&!H.isMilestone)if(D==="end")I(null);else {if(X$1.current){let O=X$1.current.getBoundingClientRect(),le=window.innerHeight,xe=320,ze=le-O.bottom<xe?O.top-xe-8:O.bottom+8;ie({top:ze,left:O.left});}I("end"),K(H.endDate||H.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...mt,opacity:H.isMilestone?.5:1,cursor:H.isMilestone?"not-allowed":"pointer"},disabled:n||H.isMilestone,children:H.endDate?H.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsx(AnimatePresence,{children:D&&jsxs(lt,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>I(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:`${te.top}px`,left:`${te.left}px`,zIndex:99999,backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`},onClick:O=>O.stopPropagation(),children:[jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${c.border}`},children:[(()=>{let O=new Date,le=new Date(O);le.setDate(O.getDate()+1);let xe=new Date(O);xe.setDate(O.getDate()+7);let Pe=new Date(O);return Pe.setDate(O.getDate()+14),[{label:"Hoy",date:O},{label:"Ma\xF1ana",date:le},{label:"Pr\xF3xima semana",date:xe},{label:"2 semanas",date:Pe}].map((at,Et)=>jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:c.textPrimary},onMouseEnter:Fe=>Fe.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:Fe=>Fe.currentTarget.style.backgroundColor="transparent",onClick:()=>{D==="start"?(We("startDate",at.date),(!H.endDate||at.date>H.endDate)&&We("endDate",at.date),I("end")):(We("endDate",at.date),(!H.startDate||at.date<H.startDate)&&We("startDate",at.date),I(null));},children:at.label},Et))})(),jsx("div",{style:{borderTop:`1px solid ${c.border}`,margin:"0.5rem 0"}}),jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:O=>O.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:O=>O.currentTarget.style.backgroundColor="transparent",onClick:()=>{We("startDate",void 0),We("endDate",void 0),I(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:()=>K(new Date(B.getFullYear(),B.getMonth()-1)),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronLeft,{className:"w-4 h-4",style:{color:c.textSecondary}})}),jsx("span",{className:"text-sm font-medium",style:{color:c.textPrimary},children:B.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>K(new Date(B.getFullYear(),B.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronRight,{className:"w-4 h-4",style:{color:c.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((O,le)=>jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:c.textTertiary},children:O},le))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let O=B.getFullYear(),le=B.getMonth(),xe=new Date(O,le,1).getDay(),Pe=new Date(O,le+1,0).getDate(),ze=new Date,at=[];for(let Fe=xe-1;Fe>=0;Fe--)at.push({day:new Date(O,le,-Fe).getDate(),date:new Date(O,le-1,new Date(O,le,-Fe).getDate()),isCurrentMonth:false});for(let Fe=1;Fe<=Pe;Fe++)at.push({day:Fe,date:new Date(O,le,Fe),isCurrentMonth:true});let Et=42-at.length;for(let Fe=1;Fe<=Et;Fe++)at.push({day:Fe,date:new Date(O,le+1,Fe),isCurrentMonth:false});return at.map((Fe,Xt)=>{let Ot=Fe.date.toDateString()===ze.toDateString(),Nt=H.startDate?.toDateString()===Fe.date.toDateString(),ct=H.endDate?.toDateString()===Fe.date.toDateString(),Jt=H.startDate&&H.endDate&&Fe.date>=H.startDate&&Fe.date<=H.endDate;return jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:Fe.isCurrentMonth?Nt||ct?"#FFF":c.textPrimary:c.textTertiary,backgroundColor:Nt?"#3B82F6":ct?"#7C3AED":Jt?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Ot&&!Nt&&!ct?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{D==="start"?(We("startDate",Fe.date),H.endDate&&Fe.date>H.endDate&&We("endDate",Fe.date),I("end")):(We("endDate",Fe.date),H.startDate&&Fe.date<H.startDate&&We("startDate",Fe.date),I(null));},children:Fe.day},Xt)})})()})]})]})]})})]}),Me.endDate&&jsx("span",{className:"text-xs text-red-400",children:Me.endDate})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:"w-4 h-4",style:{color:c.textTertiary}}),jsxs("div",{className:"flex items-center gap-3 flex-1",children:[jsx("input",{type:"range",min:"0",max:"100",step:"5",value:H.progress,onChange:O=>We("progress",parseInt(O.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:c.bgSecondary,accentColor:H.progress<30?"#EF4444":H.progress<70?"#F59E0B":"#10B981"},disabled:n}),jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${H.progress<30?"#EF4444":H.progress<70?"#F59E0B":"#10B981"}20`,color:H.progress<30?"#EF4444":H.progress<70?"#F59E0B":"#10B981"},children:[H.progress,"%"]})]})]}),jsxs("div",{children:[jsxs("button",{type:"button",onClick:()=>be(!de),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:c.textTertiary},children:[jsx(ChevronDown,{className:`w-3 h-3 transition-transform ${de?"rotate-180":""}`}),"Opciones avanzadas"]}),jsx(AnimatePresence,{children:de&&jsx(motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxs("div",{className:"pt-3 space-y-3",children:[(h||g.length>0||p==="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:c.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:c.textTertiary},children:["Adjuntos ",p==="create"?$.length>0&&`(${$.length})`:g.length>0&&`(${g.length})`]})]}),p==="create"?jsx(dr,{cardId:"pending",attachments:$.map((O,le)=>({id:`pending-${le}`,cardId:"pending",name:O.name,size:O.size,type:O.type,url:URL.createObjectURL(O),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:O=>J(le=>[...le,...O]),onDelete:O=>{let le=parseInt(O.replace("pending-",""),10);J(xe=>xe.filter((Pe,ze)=>ze!==le));},maxSizeMB:10,maxFiles:20}):jsx(dr,{cardId:a?.id||"new",attachments:g,onUpload:h&&a?.id?O=>h(a.id,O):void 0,onDelete:C,maxSizeMB:10,maxFiles:20}),p==="create"&&$.length>0&&jsxs("p",{className:"text-xs mt-1",style:{color:c.textTertiary},children:[$.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors hover:bg-white/5",children:[jsx("input",{type:"checkbox",checked:H.isMilestone,onChange:O=>We("isMilestone",O.target.checked),className:"w-4 h-4 rounded",style:{accentColor:c.accent},disabled:n}),jsx(Milestone,{className:"w-4 h-4 text-yellow-500"}),jsx("span",{className:"text-sm",style:{color:c.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxs("div",{children:[jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:c.textTertiary},children:[jsx(Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),jsx("div",{className:"flex flex-wrap gap-1.5 max-h-24 overflow-y-auto p-2 rounded-lg",style:{backgroundColor:c.bgSecondary},children:r.filter(O=>O.id!==a?.id).map(O=>{let le=H.dependencies?.includes(O.id);return jsx("button",{type:"button",onClick:()=>{let xe=le?(H.dependencies||[]).filter(Pe=>Pe!==O.id):[...H.dependencies||[],O.id];We("dependencies",xe);},className:"px-2 py-1 rounded-full text-xs transition-colors",style:{backgroundColor:le?`${c.accent}30`:c.bgPrimary,color:le?c.accent:c.textSecondary,border:`1px solid ${le?c.accent:c.borderLight}`},disabled:n,children:O.name},O.id)})})]})]})})})]})]}),jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${c.border}`},children:[jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:c.textSecondary},onMouseEnter:O=>O.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:O=>O.currentTarget.style.backgroundColor="transparent",disabled:n,children:"Cancelar"}),jsx("button",{type:"submit",disabled:n,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:c.accent,color:"#FFF"},onMouseEnter:O=>!n&&(O.currentTarget.style.opacity="0.9"),onMouseLeave:O=>!n&&(O.currentTarget.style.opacity="1"),children:n?jsxs(Fragment,{children:[jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsx(Fragment,{children:p==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var Dc=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
345
345
 
346
346
  AVAILABLE COMMANDS:
347
347
  1. move_task - Move a task to a different date
@@ -386,7 +386,7 @@ If ambiguous, ask for clarification in the message field.`;function Sc(e){return
386
386
  ${Ec(e).map(r=>{let o=r.startDate?r.startDate.toISOString().split("T")[0]:"no date",s=r.endDate?r.endDate.toISOString().split("T")[0]:"no date",n=r.dependencies?.length?`deps: [${r.dependencies.join(", ")}]`:"";return `- ${r.id}: "${r.name}" (${o} to ${s}, ${r.progress}%, ${r.status||"todo"}) ${n}`}).join(`
387
387
  `)}
388
388
 
389
- Today's date: ${new Date().toISOString().split("T")[0]}`}function Ec(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function yr(e,t){let a=Ec(e),r=t.toLowerCase().trim(),o=a.find(p=>p.name.toLowerCase()===r);if(o)return o;let s=a.find(p=>p.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(p=>{let m=p.name.toLowerCase();return n.every(i=>m.includes(i))})}function Ci(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 g=new Date(r);return g.setDate(g.getDate()+1),g}if(a==="yesterday"||a==="ayer"){let g=new Date(r);return g.setDate(g.getDate()-1),g}if(a==="next week"||a==="la pr\xF3xima semana"){let g=new Date(r);return g.setDate(g.getDate()+7),g}let o=a.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(o){let h={sunday:0,domingo:0,monday:1,lunes:1,tuesday:2,martes:2,wednesday:3,mi\u00E9rcoles:3,miercoles:3,thursday:4,jueves:4,friday:5,viernes:5,saturday:6,s\u00E1bado:6,sabado:6}[o[1].toLowerCase()];if(h!==void 0){let C=new Date(r),T=C.getDay(),c=h-T;return c<=0&&(c+=7),C.setDate(C.getDate()+c),C}}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 g=parseInt(s[1],10),h=s[2].toLowerCase(),C=new Date(r);return h==="day"||h==="d\xEDa"||h==="dias"?C.setDate(C.getDate()+g):h==="week"||h==="semana"||h==="semanas"?C.setDate(C.getDate()+g*7):(h==="month"||h==="mes"||h==="meses")&&C.setMonth(C.getMonth()+g),C}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let p=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(p&&p[1]&&p[2]&&p[3]){let g=parseInt(p[1],10),h=parseInt(p[2],10)-1,C=parseInt(p[3],10);return new Date(C,h,g)}let m={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},i=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(i&&i[1]&&i[2]){let g=parseInt(i[1],10),h=m[i[2].toLowerCase()],C=i[3]?parseInt(i[3],10):r.getFullYear();if(h!==void 0)return new Date(C,h,g)}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},d=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(d&&d[1]&&d[2]){let g=u[d[1].toLowerCase()],h=parseInt(d[2],10),C=d[3]?parseInt(d[3],10):r.getFullYear();if(g!==void 0)return new Date(C,g,h)}return null}function Ti(e){let a=e.toLowerCase().trim().match(/(\d+)\s*(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(a&&a[1]&&a[2]){let r=parseInt(a[1],10),o=a[2].toLowerCase();if(o==="day"||o==="d\xEDa"||o==="dias")return r;if(o==="week"||o==="semana"||o==="semanas")return r*7;if(o==="month"||o==="mes"||o==="meses")return r*30}return null}function Ni(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 Pc(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 Mc(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(),d=yr(t,i),g=Ci(u);if(!d)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!g)return {type:"move_task",taskId:d.id,taskName:d.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 h=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,C=new Date(g);return C.setDate(C.getDate()+h),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:g,endDate:C},message:`Moved "${d.name}" to ${g.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),u=o[2].trim(),d=yr(t,i),g=Ti(u);if(!d)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!g||!d.endDate)return {type:"resize_task",taskId:d.id,taskName:d.name,message:`Could not parse the duration "${u}".`,success:false,error:"Invalid duration"};let h=new Date(d.endDate);return h.setDate(h.getDate()+g),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:h},message:`Extended "${d.name}" by ${g} days. New end date: ${h.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(),d=yr(t,i),g=Ni(u);return d?g===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${u}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:d.id,taskName:d.name,updates:{progress:g},message:`Set "${d.name}" progress to ${g}%.`,success:true}:{type:"set_progress",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let n=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),u=n[2].trim(),d=yr(t,i);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:u},message:`Renamed "${d.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 p=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(p&&p[1]&&p[2]){let i=p[1].trim(),u=p[2].trim(),d=yr(t,i),g=yr(t,u);return d?g?{type:"link_tasks",taskId:g.id,taskName:g.name,dependencyFrom:d.id,dependencyTo:g.id,message:`Linked "${d.name}" \u2192 "${g.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 m=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(m&&m[1]){let i=m[1].trim(),u=yr(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 Ac(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 $0(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 O0(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function $n(e,t=[],a=[]){let r=e.assignedUserIds?.map(u=>{let d=a.find(g=>g.id===u);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(u=>u!==null),o=t.filter(u=>u.metadata?.parentCardId===e.id).map(u=>$n(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 n=u=>{if(u)return typeof u=="string"?new Date(u):u},p=n(e.startDate),m=n(e.endDate),i=e.metadata?.isMilestone===true||p&&m&&Math.abs(m.getTime()-p.getTime())<=864e5;return {id:e.id,name:e.title,startDate:p,endDate:m,progress:e.progress||0,status:$0(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:i,isCriticalPath:e.metadata?.isCriticalPath===true}}function Fc(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:O0(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function Lc(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>$n(r,e,t))}var Di={columns:{name:"Task Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions"},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"}},Si={columns:{name:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones"},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"}},On={en:Di,es:Si};function Ei(e){return On[e]||On.en}function zn(e,t){let a=Ei(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}function $c(e,t=0){let a=[];for(let r of e)a.push({...r,level:t,hasChildren:(r.subtasks?.length||0)>0,parentPath:[r.id]}),r.subtasks?.length&&r.isExpanded!==false&&a.push(...$c(r.subtasks,t+1));return a}function q0({status:e,progress:t}){return t===100||e==="completed"?jsx(CheckCircle2,{className:"w-5 h-5 text-green-500"}):t&&t>0||e==="in-progress"?jsx(PlayCircle,{className:"w-5 h-5 text-blue-500"}):jsx(Circle,{className:"w-5 h-5 text-gray-400"})}function Oc({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n}){let{theme:p="dark",locale:m="en",customTranslations:i,showSearch:u=true,showHierarchy:d=true}=t,g=zn(m,i),h=p==="dark",[C,T]=useState(new Set),[c,b]=useState("startDate"),[y,l]=useState("asc"),[x,v]=useState("");useMemo(()=>{let M=new Set;function D(I){for(let R of I)R.subtasks?.length&&(M.add(R.id),D(R.subtasks));}D(e),T(M);},[e]);let S=useCallback(M=>{T(D=>{let I=new Set(D);return I.has(M)?I.delete(M):I.add(M),I}),a.onTaskToggleExpand?.(M);},[a]),k=useCallback(M=>{c===M?l(D=>D==="asc"?"desc":"asc"):(b(M),l("asc")),a.onSortChange?.({column:M,direction:y==="asc"?"desc":"asc"});},[c,y,a]),w=useMemo(()=>{let M=$c(e);if(x.trim()){let I=x.toLowerCase();M=M.filter(R=>R.name.toLowerCase().includes(I));}let D=[];for(let I of M){let R=I.level===0;I.level>0&&(R=true),(R||x.trim())&&D.push(I);}return x.trim()&&D.sort((I,R)=>{let Y,te;switch(c){case "name":Y=I.name.toLowerCase(),te=R.name.toLowerCase();break;case "startDate":Y=I.startDate?.getTime()||0,te=R.startDate?.getTime()||0;break;case "endDate":Y=I.endDate?.getTime()||0,te=R.endDate?.getTime()||0;break;case "progress":Y=I.progress||0,te=R.progress||0;break;case "status":Y=I.status||"todo",te=R.status||"todo";break;default:return 0}return Y<te?y==="asc"?-1:1:Y>te?y==="asc"?1:-1:0}),D},[e,x,c,y]),B=M=>M?(M instanceof Date?M:new Date(M)).toLocaleDateString(m==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-";return r?jsx("div",{className:f("flex-1 flex items-center justify-center",h?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxs("p",{className:f("text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:[g.empty.noTasks,"..."]})]})}):o?jsx("div",{className:f("flex-1 flex items-center justify-center",h?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxs("div",{children:[jsx("h3",{className:f("text-lg font-semibold mb-2",h?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:f("text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsx("div",{className:f("flex-1 flex items-center justify-center",h?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsx(List,{className:"w-8 h-8 text-[#3B82F6]"})}),jsx("h3",{className:f("text-lg font-semibold mb-2",h?"text-white":"text-gray-900"),children:g.empty.noTasks}),jsx("p",{className:f("text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:g.empty.addFirstTask})]})}):jsxs("div",{className:f("flex-1 flex flex-col w-full h-full overflow-hidden",h?"bg-[#0F1117]":"bg-white",s),style:n,children:[jsx("div",{className:f("flex-shrink-0 px-6 py-4 border-b",h?"border-white/10":"border-gray-200"),children:jsxs("div",{className:"flex items-center gap-4",children:[u&&jsxs("div",{className:"relative flex-1 max-w-md",children:[jsx(Search,{className:f("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",h?"text-[#9CA3AF]":"text-gray-400")}),jsx("input",{type:"text",value:x,onChange:M=>v(M.target.value),placeholder:g.toolbar.searchPlaceholder,className:f("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",h?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsxs("div",{className:f("text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:[w.length," ",g.pagination.tasks]})]})}),jsxs("div",{className:f("flex-shrink-0 grid grid-cols-12 gap-4 px-6 py-3 border-b text-xs font-medium uppercase tracking-wider",h?"border-white/10 bg-white/5 text-[#9CA3AF]":"border-gray-200 bg-gray-50 text-gray-500"),children:[jsx("div",{className:"col-span-5 flex items-center gap-2",children:jsxs("button",{onClick:()=>k("name"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[g.columns.name,jsx(ArrowUpDown,{className:"w-3 h-3"})]})}),jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxs("button",{onClick:()=>k("status"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[g.columns.status,jsx(ArrowUpDown,{className:"w-3 h-3"})]})}),jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxs("button",{onClick:()=>k("startDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[g.columns.startDate,jsx(ArrowUpDown,{className:"w-3 h-3"})]})}),jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxs("button",{onClick:()=>k("endDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[g.columns.endDate,jsx(ArrowUpDown,{className:"w-3 h-3"})]})}),jsx("div",{className:"col-span-1 flex items-center gap-1",children:jsxs("button",{onClick:()=>k("progress"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:["%",jsx(ArrowUpDown,{className:"w-3 h-3"})]})})]}),jsxs("div",{className:"flex-1 overflow-auto",children:[jsx(AnimatePresence,{children:w.map((M,D)=>{let I=C.has(M.id);return jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:D*.02},className:f("grid grid-cols-12 gap-4 px-6 py-3 border-b transition-colors cursor-pointer",h?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),style:{paddingLeft:d?`${24+M.level*24}px`:void 0},onClick:()=>a.onTaskClick?.(M),onDoubleClick:()=>a.onTaskDoubleClick?.(M),children:[jsxs("div",{className:"col-span-5 flex items-center gap-2 min-w-0",children:[d&&M.hasChildren&&jsx("button",{onClick:R=>{R.stopPropagation(),S(M.id);},className:f("p-0.5 rounded",h?"hover:bg-white/10":"hover:bg-gray-200"),children:I?jsx(ChevronDown,{className:f("w-4 h-4",h?"text-[#9CA3AF]":"text-gray-400")}):jsx(ChevronRight,{className:f("w-4 h-4",h?"text-[#9CA3AF]":"text-gray-400")})}),d&&!M.hasChildren&&jsx("div",{className:"w-5"}),jsx("button",{onClick:R=>{R.stopPropagation(),a.onTaskUpdate?.({...M,progress:M.progress===100?0:100,status:M.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsx(q0,{status:M.status,progress:M.progress})}),jsx("span",{className:f("truncate",h?"text-white":"text-gray-900",M.progress===100&&(h?"line-through text-[#6B7280]":"line-through text-gray-400")),children:M.name})]}),jsx("div",{className:"col-span-2 flex items-center",children:jsx("span",{className:f("px-2 py-1 rounded-full text-xs font-medium",M.progress===100||M.status==="completed"?"bg-green-500/10 text-green-500":M.progress&&M.progress>0||M.status==="in-progress"?"bg-blue-500/10 text-blue-500":h?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:M.progress===100||M.status==="completed"?g.status.completed:M.progress&&M.progress>0||M.status==="in-progress"?g.status.inProgress:g.status.todo})}),jsxs("div",{className:f("col-span-2 flex items-center gap-1 text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:[jsx(Calendar,{className:"w-4 h-4"}),B(M.startDate)]}),jsxs("div",{className:f("col-span-2 flex items-center gap-1 text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:[jsx(Clock,{className:"w-4 h-4"}),B(M.endDate)]}),jsx("div",{className:"col-span-1 flex items-center",children:jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsx("div",{className:f("flex-1 h-1.5 rounded-full overflow-hidden",h?"bg-white/10":"bg-gray-200"),children:jsx("div",{className:f("h-full rounded-full transition-all",M.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${M.progress||0}%`}})}),jsxs("span",{className:f("text-xs w-8",h?"text-[#9CA3AF]":"text-gray-500"),children:[M.progress||0,"%"]})]})})]},M.id)})}),w.length===0&&x&&jsx("div",{className:"flex items-center justify-center py-12",children:jsxs("div",{className:"text-center",children:[jsx(List,{className:f("w-12 h-12 mx-auto mb-4",h?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:f(h?"text-[#9CA3AF]":"text-gray-600"),children:g.empty.noResults})]})})]})]})}var Pi={bgPrimary:"#0d1117",bgSecondary:"#161b22",bgHover:"#21262d",bgSelected:"#1f6feb20",bgAlternate:"#0d111780",border:"#30363d",borderLight:"#21262d",textPrimary:"#c9d1d9",textSecondary:"#8b949e",textMuted:"#6e7681",accent:"#58a6ff",accentHover:"#79b8ff",accentLight:"#58a6ff20",statusTodo:"#8b949e",statusInProgress:"#f0883e",statusCompleted:"#3fb950",focusRing:"#58a6ff",checkboxBg:"#21262d",checkboxChecked:"#58a6ff"},Mi={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"},Ai={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"},Hn={dark:Pi,light:Mi,neutral:Ai};function zc(e){return Hn[e]||Hn.dark}var Fi={navigation:{today:"Today",previous:"Previous",next:"Next",month:"Month",week:"Week",day:"Day"},weekdays:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},weekdaysFull:{sunday:"Sunday",monday:"Monday",tuesday:"Tuesday",wednesday:"Wednesday",thursday:"Thursday",friday:"Friday",saturday:"Saturday"},months:{january:"January",february:"February",march:"March",april:"April",may:"May",june:"June",july:"July",august:"August",september:"September",october:"October",november:"November",december:"December"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{allDay:"All day",moreEvents:"+{count} more",noEvents:"No tasks",newTask:"New Task",viewAll:"View all",week:"Week"},tooltips:{progress:"Progress",status:"Status",assignees:"Assignees",duration:"Duration",days:"days"}},Li={navigation:{today:"Hoy",previous:"Anterior",next:"Siguiente",month:"Mes",week:"Semana",day:"D\xEDa"},weekdays:{sun:"Dom",mon:"Lun",tue:"Mar",wed:"Mi\xE9",thu:"Jue",fri:"Vie",sat:"S\xE1b"},weekdaysFull:{sunday:"Domingo",monday:"Lunes",tuesday:"Martes",wednesday:"Mi\xE9rcoles",thursday:"Jueves",friday:"Viernes",saturday:"S\xE1bado"},months:{january:"Enero",february:"Febrero",march:"Marzo",april:"Abril",may:"Mayo",june:"Junio",july:"Julio",august:"Agosto",september:"Septiembre",october:"Octubre",november:"Noviembre",december:"Diciembre"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{allDay:"Todo el d\xEDa",moreEvents:"+{count} m\xE1s",noEvents:"Sin tareas",newTask:"Nueva Tarea",viewAll:"Ver todo",week:"Semana"},tooltips:{progress:"Progreso",status:"Estado",assignees:"Asignados",duration:"Duraci\xF3n",days:"d\xEDas"}},Wn={en:Fi,es:Li};function Wo(e){return Wn[e]||Wn.en}function Gn(e,t){let a=Wo(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 Uc(e){let t=Wo(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 Hc(e,t=0,a=true){let r=Wo(e),o=a?[r.weekdays.sun,r.weekdays.mon,r.weekdays.tue,r.weekdays.wed,r.weekdays.thu,r.weekdays.fri,r.weekdays.sat]:[r.weekdaysFull.sunday,r.weekdaysFull.monday,r.weekdaysFull.tuesday,r.weekdaysFull.wednesday,r.weekdaysFull.thursday,r.weekdaysFull.friday,r.weekdaysFull.saturday];return [...o.slice(t),...o.slice(0,t)]}function gh(e){let t=[];function a(r){for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);}return a(e),t}function zi(e,t){if(!t.startDate||!t.endDate)return false;let a=new Date(e.getFullYear(),e.getMonth(),e.getDate()),r=new Date(t.startDate.getFullYear(),t.startDate.getMonth(),t.startDate.getDate()),o=new Date(t.endDate.getFullYear(),t.endDate.getMonth(),t.endDate.getDate());return a>=r&&a<=o}function jc({task:e}){return e.progress===100||e.status==="completed"?jsx(CheckCircle2,{className:"w-3 h-3 text-green-500 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsx(PlayCircle,{className:"w-3 h-3 text-blue-500 flex-shrink-0"}):jsx(Circle,{className:"w-3 h-3 text-gray-400 flex-shrink-0"})}function Yc({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:p,availableTags:m=[],onCreateTag:i,attachmentsByTask:u,comments:d,onAddComment:g,currentUser:h,onTaskOpen:C}){let{theme:T="dark",locale:c="en",customTranslations:b}=t,y=Gn(c,b),l=T==="dark",x={textTertiary:l?"#6B7280":"#9CA3AF",textSecondary:l?"#9CA3AF":"#6B7280",textPrimary:l?"#FFFFFF":"#111827",borderLight:l?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:l?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:l?"#1A1D25":"#FFFFFF",bgSecondary:l?"#0F1117":"#F9FAFB",hoverBg:l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},[v,S]=useState(r||new Date),[k,w]=useState(null),[B,M]=useState(null),[D,I]=useState(null),[R,Y]=useState(new Date),[te,ye]=useState({}),De=4,Se=3,[O,V]=useState(false),[$,G]=useState(false),[A,X$1]=useState(false),[q,U]=useState(false),[fe,Me]=useState(null),[Oe,he]=useState(""),[Ye,We]=useState(void 0),[et,vt]=useState(null),[Mt,mt]=useState(false),[z,ie]=useState(false),[ve,Pe]=useState(null),[ze,at]=useState(false),[Et,Fe]=useState(new Date),[Xt,Ot]=useState(false),[Nt,ct]=useState(false),[Jt,Ea]=useState(false),[oe,me]=useState(""),[pa,ya]=useState(false),[N,ee]=useState(""),[se,Te]=useState(false),$e=useCallback(()=>{S(new Date(v.getFullYear(),v.getMonth()-1,1));},[v]),tt=useCallback(()=>{S(new Date(v.getFullYear(),v.getMonth()+1,1));},[v]),Ge=useCallback(()=>{S(new Date);},[]),Be=useMemo(()=>{let E=v.getFullYear(),be=v.getMonth(),Q=new Date(E,be,1),Ae=new Date(E,be+1,0),ot=Q.getDay(),ne=Ae.getDate(),Re=gh(e),xt=new Date;xt.setHours(0,0,0,0);let Le=[],At=ot,st=new Date(E,be,0).getDate();for(let zt=At-1;zt>=0;zt--){let je=new Date(E,be-1,st-zt);Le.push({date:je,isCurrentMonth:false,isToday:false,isWeekend:je.getDay()===0||je.getDay()===6,events:Re.filter(kt=>zi(je,kt)).map(kt=>({id:kt.id,title:kt.name,start:kt.startDate,end:kt.endDate,task:kt}))});}for(let zt=1;zt<=ne;zt++){let je=new Date(E,be,zt),kt=je.getTime()===xt.getTime();Le.push({date:je,isCurrentMonth:true,isToday:kt,isWeekend:je.getDay()===0||je.getDay()===6,events:Re.filter(ia=>zi(je,ia)).map(ia=>({id:ia.id,title:ia.name,start:ia.startDate,end:ia.endDate,task:ia}))});}let ga=42-Le.length;for(let zt=1;zt<=ga;zt++){let je=new Date(E,be+1,zt);Le.push({date:je,isCurrentMonth:false,isToday:false,isWeekend:je.getDay()===0||je.getDay()===6,events:Re.filter(kt=>zi(je,kt)).map(kt=>({id:kt.id,title:kt.name,start:kt.startDate,end:kt.endDate,task:kt}))});}return Le},[v,e]),rt=c==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],_=v.toLocaleDateString(c==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),ae=useCallback((E,be)=>{if(!k)return;let Q={...k,[E]:be};w(Q),a.onTaskUpdate?.(Q);},[k,a]),Ee=useCallback(E=>{if(!k)return;let be=k.progress||0;E==="completed"?be=100:E==="todo"&&(be=0);let Q={...k,status:E,progress:be};w(Q),a.onTaskUpdate?.(Q),V(false);},[k,a]),Ue=useCallback((E,be)=>{if(!k)return;let Q={...k,startDate:E,endDate:be};w(Q),a.onTaskUpdate?.(Q);},[k,a]),He=useCallback(()=>{V(false),G(false),X$1(false),I(null),Ea(false),me(""),ya(false);},[]),W=useCallback(async E=>{if(E.preventDefault(),E.stopPropagation(),Ot(false),!k||!a.onUploadAttachments)return;let be=Array.from(E.dataTransfer.files);if(be.length!==0){ct(true);try{await a.onUploadAttachments(k.id,be);}finally{ct(false);}}},[k,a]),le=useCallback(async E=>{if(!k||!a.onUploadAttachments||!E.target.files)return;let be=Array.from(E.target.files);if(be.length!==0){ct(true);try{await a.onUploadAttachments(k.id,be);}finally{ct(false);}E.target.value="";}},[k,a]),Ie=useCallback(E=>{E.preventDefault(),E.stopPropagation(),Ot(true);},[]),Dt=useCallback(E=>{E.preventDefault(),E.stopPropagation(),Ot(false);},[]),Je=useCallback(E=>E<1024?`${E} B`:E<1024*1024?`${(E/1024).toFixed(1)} KB`:`${(E/(1024*1024)).toFixed(1)} MB`,[]),va=useCallback(E=>E.startsWith("image/")?Image:E.includes("pdf")||E.includes("document")?FileText:File,[]),ua=useMemo(()=>!k||!u?[]:u.get(k.id)||[],[k,u]);return o?jsx("div",{className:f("flex-1 flex items-center justify-center",l?"bg-[#0F1117]":"bg-white",n),style:p,children:jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxs("p",{className:f("text-sm",l?"text-[#9CA3AF]":"text-gray-600"),children:[y.labels.noEvents,"..."]})]})}):s?jsx("div",{className:f("flex-1 flex items-center justify-center",l?"bg-[#0F1117]":"bg-white",n),style:p,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:f("text-lg font-semibold mb-2",l?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:f("text-sm",l?"text-[#9CA3AF]":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsx("div",{className:f("flex-1 flex items-center justify-center",l?"bg-[#0F1117]":"bg-white",n),style:p,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsx(Calendar,{className:"w-8 h-8 text-[#3B82F6]"})}),jsx("h3",{className:f("text-lg font-semibold mb-2",l?"text-white":"text-gray-900"),children:y.labels.noEvents}),jsx("p",{className:f("text-sm",l?"text-[#9CA3AF]":"text-gray-600"),children:y.labels.newTask})]})}):jsxs("div",{className:f("flex-1 flex flex-col w-full h-full overflow-auto",l?"bg-[#0F1117]":"bg-white",n),style:p,children:[jsx("div",{className:f("flex-shrink-0 px-6 py-4 border-b",l?"border-white/10":"border-gray-200"),children:jsxs("div",{className:"flex items-center justify-between",children:[jsxs("div",{className:"flex items-center gap-4",children:[jsx("h2",{className:f("text-xl font-semibold capitalize",l?"text-white":"text-gray-900"),children:_}),jsx("button",{onClick:Ge,className:f("px-3 py-1.5 text-sm rounded-lg transition-colors",l?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:y.navigation.today})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("button",{onClick:$e,className:f("p-2 rounded-lg transition-colors",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:f("w-5 h-5",l?"text-[#9CA3AF]":"text-gray-600")})}),jsx("button",{onClick:tt,className:f("p-2 rounded-lg transition-colors",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:f("w-5 h-5",l?"text-[#9CA3AF]":"text-gray-600")})})]})]})}),jsx("div",{className:"flex-1 p-6 min-h-0",children:jsxs("div",{className:"flex flex-col",children:[jsx("div",{className:"grid grid-cols-7 gap-px mb-2",children:rt.map(E=>jsx("div",{className:f("py-2 text-center text-xs font-medium uppercase",l?"text-[#9CA3AF]":"text-gray-500"),children:E},E))}),jsx("div",{className:f("grid grid-cols-7 auto-rows-min gap-px rounded-lg",l?"bg-[#2D2D2D]":"bg-gray-300"),children:Be.map((E,be)=>{let Q=E.date.getDay()===0||E.date.getDay()===6;return jsxs("div",{className:f("min-h-[120px] p-2 transition-colors flex flex-col relative group",l?Q?"bg-[#1C1F26]":E.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":Q?"bg-gray-100":E.isCurrentMonth?"bg-white":"bg-gray-50",E.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let Ae=te[be]||De,ot=E.events.slice(0,Ae),ne=E.events.length-Ae;return jsxs("div",{className:"space-y-1 flex-1",children:[ot.map(Re=>jsx("div",{className:"relative group",children:jsxs(motion.button,{onClick:()=>{w(Re.task),a.onEventClick?.(Re),C?.(Re.task.id);},whileHover:{scale:1.02},className:f("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",Re.task.progress===100?l?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":l?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsx(jc,{task:Re.task}),jsx("span",{className:"truncate",children:Re.title})]})},Re.id)),ne>0&&jsxs("button",{onClick:Re=>{Re.stopPropagation(),ye(xt=>({...xt,[be]:Ae+Se}));},className:f("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",l?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",ne," ",c==="es"?"M\xC1S":"MORE"]}),Ae>De&&E.events.length>De&&jsx("button",{onClick:Re=>{Re.stopPropagation(),ye(xt=>({...xt,[be]:De}));},className:f("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",l?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:c==="es"?"MENOS":"LESS"})]})})(),jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let Ae=be>=28,ot=be%7>=5;return jsxs("div",{className:"relative",children:[jsx("button",{onClick:ne=>{ne.stopPropagation(),fe===be?Me(null):(Me(be),he(""),We(void 0),vt(null),Pe(null),mt(false),ie(false),at(false),Fe(E.date));},className:f("w-5 h-5 rounded flex items-center justify-center transition-all",fe===be?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",l?"hover:bg-[#7C3AED] text-[#6B7280] hover:text-white":"hover:bg-[#7C3AED] text-gray-400 hover:text-white"),children:jsx(Plus,{className:f("w-3.5 h-3.5 transition-transform",fe===be&&"rotate-45")})}),jsx(AnimatePresence,{children:fe===be&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Me(null),he(""),We(void 0),vt(null),Pe(null),mt(false),ie(false),at(false);}}),jsxs(motion.div,{initial:{opacity:0,y:Ae?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:Ae?-5:5,scale:.95},transition:{duration:.12},className:f("absolute w-[320px] rounded-lg shadow-2xl z-50",Ae?"bottom-full mb-1":"top-full mt-1",ot?"right-0":"left-0",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:ne=>{ne.stopPropagation(),mt(false),ie(false),at(false);},children:[jsx("div",{className:"p-2.5",children:jsx("input",{type:"text",value:Oe,onChange:ne=>he(ne.target.value),placeholder:c==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:f("w-full bg-transparent text-sm outline-none placeholder:opacity-40",l?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:ne=>{if(ne.key==="Enter"&&Oe.trim()){let Re=t.availableUsers?.find(Le=>Le.id===et),xt=ve||E.date;a.onTaskCreate?.({name:Oe.trim(),startDate:xt,endDate:xt,priority:Ye,assignees:Re?[Re]:void 0}),he(""),We(void 0),vt(null),Pe(null),Me(null);}ne.key==="Escape"&&(Me(null),he(""),We(void 0),vt(null),Pe(null));}})}),jsxs("div",{className:f("px-2.5 py-2 flex items-center justify-between border-t",l?"border-white/10":"border-gray-100"),children:[jsxs("div",{className:"flex items-center gap-1",children:[jsxs("div",{className:"relative",children:[jsx("button",{onClick:ne=>{ne.stopPropagation(),mt(!Mt),ie(false);},className:f("p-1 rounded transition-colors",Ye?Ye==="urgent"||Ye==="high"?"text-red-400 bg-red-500/20":Ye==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":l?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsx(Flag,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:Mt&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:ne=>ne.stopPropagation(),children:[{id:"urgent",label:c==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:c==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:c==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:c==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:c==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(ne=>jsxs("button",{onClick:()=>{We(ne.id),mt(false);},className:f("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",Ye===ne.id&&(l?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:f("w-2 h-2 rounded-full",ne.color)}),jsx("span",{className:l?"text-white":"text-gray-900",children:ne.label})]},ne.id||"none"))})})]}),jsxs("div",{className:"relative",children:[jsxs("button",{onClick:ne=>{ne.stopPropagation(),at(!ze),mt(false),ie(false),Fe(ve||E.date);},className:f("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",ve?"bg-[#7C3AED]/20 text-[#7C3AED]":l?"bg-white/5 text-[#9CA3AF] hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsx(CalendarDays,{className:"w-3 h-3"}),(ve||E.date).toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsx(AnimatePresence,{children:ze&&jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:ne=>ne.stopPropagation(),children:[jsx("div",{className:f("w-40 py-2 border-r",l?"border-white/10":"border-gray-200"),children:(()=>{let ne=new Date,Re=new Date(ne);Re.setDate(ne.getDate()+1);let xt=new Date(ne);xt.setDate(ne.getDate()+((6-ne.getDay()+7)%7||7));let Le=new Date(ne);Le.setDate(ne.getDate()+((1-ne.getDay()+7)%7||7));let At=new Date(ne);At.setDate(ne.getDate()+14);let st=new Date(ne);return st.setDate(ne.getDate()+28),[{label:c==="es"?"Hoy":"Today",date:ne,display:ne.toLocaleDateString(c==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:c==="es"?"Ma\xF1ana":"Tomorrow",date:Re,display:Re.toLocaleDateString(c==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:c==="es"?"Este fin de semana":"This weekend",date:xt,display:c==="es"?"s\xE1b.":"sat."},{label:c==="es"?"Pr\xF3xima semana":"Next week",date:Le,display:c==="es"?"lun.":"mon."},{label:c==="es"?"2 semanas":"2 weeks",date:At,display:At.toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:c==="es"?"4 semanas":"4 weeks",date:st,display:st.toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((zt,je)=>jsxs("button",{className:f("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",l?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{Pe(zt.date),at(false);},children:[jsx("span",{children:zt.label}),jsx("span",{className:f("text-[10px]",l?"text-[#6B7280]":"text-gray-400"),children:zt.display})]},je))})()}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("span",{className:f("text-xs font-medium",l?"text-white":"text-gray-900"),children:Et.toLocaleDateString(c==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{onClick:()=>Fe(new Date),className:f("px-1.5 py-0.5 rounded text-[10px] transition-colors",l?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:c==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>Fe(new Date(Et.getFullYear(),Et.getMonth()-1)),className:f("p-0.5 rounded",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-3.5 h-3.5"})}),jsx("button",{onClick:()=>Fe(new Date(Et.getFullYear(),Et.getMonth()+1)),className:f("p-0.5 rounded",l?"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:(c==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(ne=>jsx("div",{className:f("w-6 h-6 flex items-center justify-center text-[10px]",l?"text-[#6B7280]":"text-gray-400"),children:ne},ne))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let ne=Et.getFullYear(),Re=Et.getMonth(),xt=new Date(ne,Re,1).getDay(),Le=new Date(ne,Re+1,0).getDate(),At=new Date(ne,Re,0).getDate(),st=new Date,ga=[];for(let je=xt-1;je>=0;je--)ga.push({dayNum:At-je,isCurrentMonth:false,date:new Date(ne,Re-1,At-je)});for(let je=1;je<=Le;je++)ga.push({dayNum:je,isCurrentMonth:true,date:new Date(ne,Re,je)});let zt=42-ga.length;for(let je=1;je<=zt;je++)ga.push({dayNum:je,isCurrentMonth:false,date:new Date(ne,Re+1,je)});return ga.map((je,kt)=>{let ia=je.date.toDateString()===st.toDateString(),vr=(ve||E.date).toDateString()===je.date.toDateString();return jsx("button",{className:f("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!je.isCurrentMonth&&(l?"text-[#4B5563]":"text-gray-300"),je.isCurrentMonth&&(l?"text-white":"text-gray-900"),ia&&"ring-1 ring-[#3B82F6]",vr&&"bg-[#7C3AED] text-white",!vr&&(l?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{Pe(je.date),at(false);},children:je.dayNum},kt)})})()})]})]})})]}),jsxs("div",{className:"relative",children:[jsx("button",{onClick:ne=>{ne.stopPropagation(),ie(!z),mt(false);},className:f("p-1 rounded transition-colors",et?"text-[#7C3AED] bg-[#7C3AED]/20":l?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:et?jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-medium",style:{backgroundColor:t.availableUsers?.find(ne=>ne.id===et)?.color||"#7C3AED"},children:t.availableUsers?.find(ne=>ne.id===et)?.initials||t.availableUsers?.find(ne=>ne.id===et)?.name?.slice(0,2).toUpperCase()}):jsx(User,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:z&&jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:ne=>ne.stopPropagation(),children:[jsxs("button",{onClick:()=>{vt(null),ie(false);},className:f("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",!et&&(l?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:f("w-5 h-5 rounded-full flex items-center justify-center",l?"bg-white/10":"bg-gray-200"),children:jsx(User,{className:"w-3 h-3 text-gray-400"})}),jsx("span",{className:l?"text-[#9CA3AF]":"text-gray-500",children:c==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(ne=>jsxs("button",{onClick:()=>{vt(ne.id),ie(false);},className:f("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",et===ne.id&&(l?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-white text-[9px] font-medium",style:{backgroundColor:ne.color||"#7C3AED"},children:ne.initials||ne.name?.slice(0,2).toUpperCase()}),jsx("span",{className:l?"text-white":"text-gray-900",children:ne.name})]},ne.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsx("div",{className:f("px-3 py-2 text-xs",l?"text-[#6B7280]":"text-gray-400"),children:c==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsx("button",{onClick:()=>{if(Oe.trim()){let ne=t.availableUsers?.find(xt=>xt.id===et),Re=ve||E.date;a.onTaskCreate?.({name:Oe.trim(),startDate:Re,endDate:Re,priority:Ye,assignees:ne?[ne]:void 0}),he(""),We(void 0),vt(null),Pe(null),Me(null);}},disabled:!Oe.trim(),className:f("px-2.5 py-1 rounded text-xs font-medium transition-colors",Oe.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":l?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:c==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsx("span",{className:f("text-sm font-medium",E.isToday?"text-[#3B82F6]":E.isCurrentMonth?l?"text-white":"text-gray-900":l?"text-[#6B7280]":"text-gray-400"),children:E.date.getDate()})]})]},be)})})]})}),jsx(AnimatePresence,{children:k&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>{w(null),ee("");},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:f("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",l?"bg-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxs("div",{className:f("px-6 py-3 border-b flex items-center gap-3",l?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Circle,{className:f("w-4 h-4",l?"text-[#9CA3AF]":"text-gray-500")}),jsxs("span",{className:f("text-xs px-2 py-0.5 rounded",l?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[c==="es"?"Tarea":"Task"," \u2228"]}),jsx("span",{className:f("text-xs font-mono",l?"text-[#6B7280]":"text-gray-400"),children:k.id.slice(0,8)}),jsxs("button",{className:f("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",l?"bg-purple-500/20 text-purple-400 hover:bg-purple-500/30":"bg-purple-100 text-purple-700 hover:bg-purple-200"),children:[jsx(Sparkles,{className:"w-3 h-3"}),"Ask AI"]})]}),jsx("div",{className:"flex-1"}),jsx("button",{className:f("p-1.5 rounded transition-colors",l?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(Maximize2,{className:"w-4 h-4"})}),jsx("button",{className:f("p-1.5 rounded transition-colors",l?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(MoreHorizontal,{className:"w-5 h-5"})}),jsx("button",{onClick:()=>{w(null),ee("");},className:f("p-1.5 rounded transition-colors",l?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-5 h-5"})})]}),jsx("div",{className:"px-6 py-4",children:jsxs("div",{className:"flex items-start gap-3",children:[jsx("button",{onClick:()=>{let E=k.progress===100?0:100,Q={...k,progress:E,status:E===100?"completed":"todo"};w(Q),a.onTaskUpdate?.(Q);},className:f("mt-1 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors",k.progress===100?"bg-green-500 border-green-500":l?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:k.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("h2",{className:f("text-xl font-semibold flex-1",k.progress===100?"line-through text-[#6B7280]":l?"text-white":"text-gray-900"),children:k.name})]})}),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:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Estado":"Status"}),jsx("button",{onClick:()=>{He(),V(!O);},className:f("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",k.progress===100||k.status==="completed"?"bg-green-500/20 text-green-400":k.progress&&k.progress>0||k.status==="in-progress"?"bg-blue-500/20 text-blue-400":l?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:k.progress===100||k.status==="completed"?c==="es"?"COMPLETADO":"DONE":k.progress&&k.progress>0||k.status==="in-progress"?c==="es"?"EN PROGRESO":"IN PROGRESS":c==="es"?"POR HACER":"TO DO"}),jsx(AnimatePresence,{children:O&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>V(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:c==="es"?"Por hacer":"To Do",color:"bg-white/10 text-white"},{id:"in-progress",label:c==="es"?"En progreso":"In Progress",color:"bg-blue-500/20 text-blue-400"},{id:"completed",label:c==="es"?"Completado":"Done",color:"bg-green-500/20 text-green-400"}].map(E=>jsxs("button",{onClick:()=>Ee(E.id),className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",(k.status===E.id||E.id==="completed"&&k.progress===100||E.id==="in-progress"&&k.progress&&k.progress>0&&k.progress<100||E.id==="todo"&&(!k.progress||k.progress===0)&&k.status!=="in-progress"&&k.status!=="completed")&&(l?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:f("w-2 h-2 rounded-full",E.id==="completed"?"bg-green-500":E.id==="in-progress"?"bg-blue-500":"bg-gray-400")}),jsx("span",{className:l?"text-white":"text-gray-900",children:E.label})]},E.id))})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(User,{className:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Asignados":"Assignees"}),jsxs("button",{onClick:()=>{V(false),G(false),I(null),X$1(!A);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[k.assignees&&k.assignees.length>0?jsxs("div",{className:"flex items-center gap-1",children:[k.assignees.slice(0,3).map((E,be)=>jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:E.color||"#8B5CF6"},title:E.name,children:E.initials||E.name.slice(0,2).toUpperCase()},be)),k.assignees.length>3&&jsxs("span",{className:f("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:["+",k.assignees.length-3]})]}):jsx("span",{className:f("text-sm",l?"text-[#6B7280]":"text-gray-400"),children:c==="es"?"Agregar":"Add"}),jsx(ChevronDown,{className:f("w-3 h-3",l?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:A&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>X$1(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:t.availableUsers&&t.availableUsers.length>0?t.availableUsers.map(E=>{let be=k.assignees?.some(Q=>Q.name===E.name);return jsxs("button",{onClick:()=>{let Q=k.assignees||[],Ae;be?Ae=Q.filter(ot=>ot.name!==E.name):Ae=[...Q,{name:E.name,avatar:E.avatar,initials:E.initials||E.name.slice(0,2).toUpperCase(),color:E.color||"#8B5CF6"}],ae("assignees",Ae);},className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",l?"hover:bg-white/5":"hover:bg-gray-50",be&&(l?"bg-white/5":"bg-gray-50")),children:[E.avatar?jsx("img",{src:E.avatar,alt:E.name,className:"w-6 h-6 rounded-full object-cover"}):jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:E.color||"#8B5CF6"},children:E.initials||E.name.slice(0,2).toUpperCase()}),jsx("span",{className:f("flex-1 text-left",l?"text-white":"text-gray-900"),children:E.name}),be&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},E.id||E.name)}):jsx("div",{className:f("px-3 py-4 text-sm text-center",l?"text-[#6B7280]":"text-gray-400"),children:c==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CalendarDays,{className:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Fechas":"Dates"}),jsxs("button",{onClick:()=>{I(D?null:"start"),Y(k.startDate||new Date);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[k.startDate?.toLocaleDateString(c==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(c==="es"?"Inicio":"Start"),jsx("span",{className:f("mx-1",l?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),k.endDate?.toLocaleDateString(c==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(c==="es"?"Fin":"End"),(k.startDate||k.endDate)&&jsx(X,{className:"w-3.5 h-3.5 ml-1 opacity-50 hover:opacity-100",onClick:E=>{E.stopPropagation();}})]}),jsx(AnimatePresence,{children:D&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>I(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:f("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:E=>E.stopPropagation(),children:[jsxs("div",{className:f("w-44 py-2 border-r",l?"border-white/10":"border-gray-200"),children:[(()=>{let E=new Date,be=new Date(E);be.setDate(E.getDate()+1);let Q=new Date(E);Q.setDate(E.getDate()+((6-E.getDay()+7)%7||7));let Ae=new Date(E);Ae.setDate(E.getDate()+((1-E.getDay()+7)%7||7));let ot=new Date(E);ot.setDate(E.getDate()+(6-E.getDay()+7)%7+7);let ne=new Date(E);ne.setDate(E.getDate()+14);let Re=new Date(E);return Re.setDate(E.getDate()+28),[{label:c==="es"?"Hoy":"Today",date:E,display:E.toLocaleDateString(c==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:c==="es"?"Ma\xF1ana":"Tomorrow",date:be,display:be.toLocaleDateString(c==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:c==="es"?"Este fin de semana":"This weekend",date:Q,display:c==="es"?"s\xE1b.":"sat."},{label:c==="es"?"Pr\xF3xima semana":"Next week",date:Ae,display:c==="es"?"lun.":"mon."},{label:c==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:ot,display:ot.toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:c==="es"?"2 semanas":"2 weeks",date:ne,display:ne.toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:c==="es"?"4 semanas":"4 weeks",date:Re,display:Re.toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Le,At)=>jsxs("button",{className:f("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",l?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(D==="start"){let st=k.endDate&&Le.date>k.endDate?Le.date:k.endDate;Ue(Le.date,st),I("end");}else {let st=k.startDate&&Le.date<k.startDate?Le.date:k.startDate;Ue(st,Le.date),I(null);}},children:[jsx("span",{children:Le.label}),jsx("span",{className:f("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:Le.display})]},At))})(),jsx("div",{className:f("border-t mt-2 pt-2",l?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{Ue(void 0,void 0),I(null);},className:f("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",l?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:c==="es"?"Quitar fechas":"Clear dates"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[jsx("div",{className:f("text-xs mb-3 px-2 py-1 rounded",l?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:D==="start"?c==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":c==="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:f("font-medium",l?"text-white":"text-gray-900"),children:R.toLocaleDateString(c==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>Y(new Date),className:f("p-1 rounded text-sm transition-colors",l?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:c==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>Y(new Date(R.getFullYear(),R.getMonth()-1)),className:f("p-1 rounded",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-4 h-4"})}),jsx("button",{onClick:()=>Y(new Date(R.getFullYear(),R.getMonth()+1)),className:f("p-1 rounded",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:"w-4 h-4"})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(c==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(E=>jsx("div",{className:f("w-8 h-8 flex items-center justify-center text-xs",l?"text-[#6B7280]":"text-gray-400"),children:E},E))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let E=R.getFullYear(),be=R.getMonth(),Q=new Date(E,be,1).getDay(),Ae=new Date(E,be+1,0).getDate(),ot=new Date(E,be,0).getDate(),ne=new Date,Re=[];for(let Le=Q-1;Le>=0;Le--)Re.push({day:ot-Le,isCurrentMonth:false,date:new Date(E,be-1,ot-Le)});for(let Le=1;Le<=Ae;Le++)Re.push({day:Le,isCurrentMonth:true,date:new Date(E,be,Le)});let xt=42-Re.length;for(let Le=1;Le<=xt;Le++)Re.push({day:Le,isCurrentMonth:false,date:new Date(E,be+1,Le)});return Re.map((Le,At)=>{let st=Le.date.toDateString()===ne.toDateString(),ga=k.startDate?.toDateString()===Le.date.toDateString(),zt=k.endDate?.toDateString()===Le.date.toDateString(),je=ga||zt,kt=k.startDate&&k.endDate&&Le.date>=k.startDate&&Le.date<=k.endDate;return jsx("button",{className:f("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!Le.isCurrentMonth&&(l?"text-[#4B5563]":"text-gray-300"),Le.isCurrentMonth&&(l?"text-white":"text-gray-900"),st&&"ring-2 ring-[#3B82F6]",ga&&"bg-[#3B82F6] text-white",zt&&!ga&&"bg-[#7C3AED] text-white",kt&&!je&&(l?"bg-[#7C3AED]/20":"bg-purple-100"),!je&&(l?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{let ia=new Date(Le.date);if(D==="start"){let vr=k.endDate&&ia>k.endDate?ia:k.endDate;Ue(ia,vr),I("end");}else {let vr=k.startDate&&ia<k.startDate?ia:k.startDate;Ue(vr,ia),I(null);}},children:Le.day},At)})})()})]})]})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Flag,{className:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Prioridad":"Priority"}),jsx("button",{onClick:()=>{He(),G(!$);},className:f("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",k.priority==="high"||k.priority==="urgent"?"bg-red-500/20 text-red-400":k.priority==="medium"?"bg-yellow-500/20 text-yellow-400":k.priority==="low"?"bg-green-500/20 text-green-400":l?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:k.priority?k.priority==="high"||k.priority==="urgent"?c==="es"?"Urgente":"Urgent":k.priority==="medium"?c==="es"?"Media":"Medium":c==="es"?"Baja":"Low":c==="es"?"Sin prioridad":"No priority"}),jsx(AnimatePresence,{children:$&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>G(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:c==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:c==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:c==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:c==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:c==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(E=>jsxs("button",{onClick:()=>{ae("priority",E.id),G(false);},className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",k.priority===E.id&&(l?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:f("w-2 h-2 rounded-full",E.color)}),jsx("span",{className:l?"text-white":"text-gray-900",children:E.label})]},E.id||"none"))})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Duraci\xF3n":"Duration"}),jsx("span",{className:f("text-sm",l?"text-white":"text-gray-900"),children:k.startDate&&k.endDate?`${Math.ceil((k.endDate.getTime()-k.startDate.getTime())/(1e3*60*60*24))} ${c==="es"?"d\xEDas":"days"}`:c==="es"?"Sin definir":"Not set"})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:f("w-4 h-4 rounded-full border-2",l?"border-[#6B7280]":"border-gray-400")}),jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Progreso":"Progress"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[q?jsx("input",{type:"range",min:"0",max:"100",step:"5",value:k.progress||0,onChange:E=>{let be=parseInt(E.target.value),Q=k.status;be===100?Q="completed":be>0?Q="in-progress":Q="todo";let Ae={...k,progress:be,status:Q};w(Ae),a.onTaskUpdate?.(Ae);},onBlur:()=>U(false),className:f("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",l?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsx("button",{onClick:()=>U(true),className:f("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",l?"bg-white/10":"bg-gray-200"),children:jsx("div",{className:f("h-full rounded-full transition-all",k.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${k.progress||0}%`}})}),jsxs("span",{className:f("text-sm font-medium min-w-[40px]",l?"text-white":"text-gray-900"),children:[k.progress||0,"%"]})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Tag,{className:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Etiquetas":"Tags"}),jsx(nr,{selectedTags:k.tags||[],availableTags:m,onChange:E=>{ae("tags",E);},onCreateTag:i,theme:x})]}),jsxs("div",{className:"flex items-start gap-3 relative",children:[jsx(Link2,{className:f("w-4 h-4 mt-1.5",l?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-24 mt-1",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Relaciones":"Relations"}),jsxs("div",{className:"flex-1",children:[k.dependencies&&k.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:k.dependencies.map(E=>{let be=e.find(Q=>Q.id===E);return jsxs("span",{className:f("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",l?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[be?.name||E.slice(0,8),jsx("button",{onClick:()=>{let Q=(k.dependencies||[]).filter(Ae=>Ae!==E);ae("dependencies",Q);},className:f("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsx(X,{className:"w-3 h-3"})})]},E)})}),jsxs("button",{onClick:()=>{He(),Ea(!Jt);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{className:f("text-sm",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Agregar dependencia":"Add dependency"})]}),jsx(AnimatePresence,{children:Jt&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Ea(false),me("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsx("div",{className:f("p-2 border-b",l?"border-white/10":"border-gray-200"),children:jsx("input",{type:"text",value:oe,onChange:E=>me(E.target.value),placeholder:c==="es"?"Buscar tarea...":"Search task...",className:f("w-full px-3 py-2 rounded-md text-sm outline-none",l?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsx("div",{className:"max-h-[240px] overflow-y-auto",children:e.length>0?e.filter(E=>E.id!==k.id).filter(E=>oe===""||E.name.toLowerCase().includes(oe.toLowerCase())).map(E=>{let be=k.dependencies?.includes(E.id);return jsxs("button",{onClick:()=>{let Q=k.dependencies||[],Ae;be?Ae=Q.filter(ot=>ot!==E.id):Ae=[...Q,E.id],ae("dependencies",Ae);},className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",be&&(l?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:f("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",be?"bg-blue-500 border-blue-500":l?"border-white/30":"border-gray-300"),children:be&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:f("block truncate",l?"text-white":"text-gray-900"),children:E.name}),jsx("span",{className:f("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:E.id.slice(0,8)})]})]},E.id)}):jsx("div",{className:f("px-3 py-4 text-sm text-center",l?"text-[#6B7280]":"text-gray-500"),children:c==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Palette,{className:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxs("button",{onClick:()=>{He(),ya(!pa);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:k.color||"#6366F1"}}),jsx("span",{className:f("text-sm",l?"text-white":"text-gray-900"),children:sr.find(E=>E.value===k.color)?.name||(c==="es"?"Azul":"Blue")}),jsx(ChevronDown,{className:f("w-3 h-3",l?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:pa&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ya(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-6 gap-1.5",children:sr.map(E=>{let be=k.color===E.value;return jsx("button",{onClick:()=>{ae("color",E.value),ya(false);},className:f("w-7 h-7 rounded-full flex items-center justify-center transition-all",be&&"ring-2 ring-offset-2",l?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:E.value,outlineColor:be?E.value:void 0},title:E.name,children:be&&jsx(Check,{className:"w-3.5 h-3.5 text-white"})},E.value)})})})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Diamond,{className:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Hito":"Milestone"}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",checked:k.isMilestone||false,onChange:E=>ae("isMilestone",E.target.checked),className:f("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",k.isMilestone?"bg-purple-500 border-purple-500":l?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsx("span",{className:f("text-sm",l?"text-white":"text-gray-900"),children:c==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxs("div",{className:f("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsx(FileText,{className:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsx("h3",{className:f("text-sm font-semibold",l?"text-white":"text-gray-900"),children:c==="es"?"Descripci\xF3n":"Description"})]}),jsx("textarea",{value:k.description||"",onChange:E=>ae("description",E.target.value),placeholder:c==="es"?"Agregar descripci\xF3n...":"Add description...",className:f("w-full min-h-[100px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors",l?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")}),jsxs("button",{className:f("flex items-center gap-2 text-sm mt-2 transition-colors",l?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsx(Sparkles,{className:"w-4 h-4"}),c==="es"?"Escribe con IA":"Write with AI"]})]}),jsxs("div",{className:f("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsx("h3",{className:f("text-sm font-semibold mb-3",l?"text-white":"text-gray-900"),children:c==="es"?"Campos personalizados":"Custom fields"}),jsxs("button",{className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsx(Plus,{className:"w-4 h-4"}),c==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxs("div",{className:f("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsx("h3",{className:f("text-sm font-semibold mb-3",l?"text-white":"text-gray-900"),children:c==="es"?"Agregar subtarea":"Add subtask"}),k.subtasks&&k.subtasks.length>0&&jsx("div",{className:"space-y-2 mb-3",children:k.subtasks.map(E=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:f("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",E.progress===100?"bg-green-500 border-green-500":l?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:E.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("span",{className:f("text-sm",E.progress===100?"line-through text-[#6B7280]":l?"text-white":"text-gray-900"),children:E.name})]},E.id))}),jsxs("button",{className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsx(Plus,{className:"w-4 h-4"}),c==="es"?"Add Tarea":"Add Task"]})]}),jsxs("div",{className:f("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("h3",{className:f("text-sm font-semibold",l?"text-white":"text-gray-900"),children:c==="es"?"Listas de control":"Checklists"}),jsx("button",{className:f("p-1 rounded transition-colors",l?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsx(Plus,{className:"w-4 h-4"})})]}),jsxs("button",{className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsx(ListChecks,{className:"w-4 h-4"}),c==="es"?"Crear lista de control":"Create checklist"]})]}),jsxs("div",{className:f("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:f("text-sm font-semibold mb-3",l?"text-white":"text-gray-900"),children:[c==="es"?"Adjuntos":"Attachments",ua.length>0&&jsxs("span",{className:f("ml-2 text-xs font-normal",l?"text-[#6B7280]":"text-gray-400"),children:["(",ua.length,")"]})]}),ua.length>0&&jsx("div",{className:"space-y-2 mb-4",children:ua.map(E=>{let be=va(E.type),Q=E.type.startsWith("image/");return jsxs("div",{className:f("flex items-center gap-3 p-2 rounded-lg group transition-colors",l?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[Q&&E.thumbnailUrl?jsx("img",{src:E.thumbnailUrl,alt:E.name,className:"w-10 h-10 rounded object-cover"}):jsx("div",{className:f("w-10 h-10 rounded flex items-center justify-center",l?"bg-white/10":"bg-gray-200"),children:jsx(be,{className:f("w-5 h-5",l?"text-[#9CA3AF]":"text-gray-500")})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("a",{href:E.url,target:"_blank",rel:"noopener noreferrer",className:f("text-sm font-medium truncate block hover:underline",l?"text-white":"text-gray-900"),children:E.name}),jsx("p",{className:f("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:Je(E.size)})]}),a.onDeleteAttachment&&jsx("button",{onClick:()=>a.onDeleteAttachment?.(E.id),className:f("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",l?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:c==="es"?"Eliminar":"Delete",children:jsx(Trash2,{className:"w-4 h-4"})})]},E.id)})}),jsxs("div",{onDragOver:Ie,onDragLeave:Dt,onDrop:W,className:f("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",Xt?l?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":l?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",Nt&&"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:!a.onUploadAttachments||Nt}),Nt?jsxs(Fragment,{children:[jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),jsx("p",{className:f("text-sm",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Subiendo...":"Uploading..."})]}):jsxs(Fragment,{children:[jsx(Upload,{className:f("w-6 h-6 mx-auto mb-2",Xt?"text-blue-500":l?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:f("text-sm",l?"text-[#9CA3AF]":"text-gray-500"),children:Xt?c==="es"?"Suelta los archivos aqu\xED":"Drop files here":c==="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"})]})}),!a.onUploadAttachments&&jsx("p",{className:f("text-xs mt-1",l?"text-[#6B7280]":"text-gray-400"),children:c==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxs("div",{className:f("w-80 border-l flex flex-col",l?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsx("div",{className:f("px-4 py-3 border-b",l?"border-white/10":"border-gray-200"),children:jsxs("h3",{className:f("text-sm font-semibold",l?"text-white":"text-gray-900"),children:[c==="es"?"Actividad":"Activity",d&&d.length>0&&jsxs("span",{className:f("ml-2 text-xs font-normal",l?"text-[#6B7280]":"text-gray-400"),children:["(",d.length,")"]})]})}),jsx("div",{className:"flex-1 overflow-y-auto p-4",children:d&&d.length>0?jsx("div",{className:"space-y-4",children:d.map(E=>{let be=(()=>{let Q=new Date,Ae=new Date(E.createdAt),ot=Q.getTime()-Ae.getTime(),ne=Math.floor(ot/6e4),Re=Math.floor(ne/60),xt=Math.floor(Re/24);return ne<1?c==="es"?"ahora":"now":ne<60?c==="es"?`hace ${ne}m`:`${ne}m ago`:Re<24?c==="es"?`hace ${Re}h`:`${Re}h ago`:c==="es"?`hace ${xt}d`:`${xt}d ago`})();return jsxs("div",{className:"flex gap-3",children:[jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:"#8B5CF6"},children:E.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:f("text-sm font-medium",l?"text-white":"text-gray-900"),children:E.user?.name||(c==="es"?"Usuario":"User")}),jsx("span",{className:f("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:be})]}),jsx("p",{className:f("text-sm break-words",l?"text-[#9CA3AF]":"text-gray-600"),children:E.content})]})]},E.id)})}):jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsx(MessageSquare,{className:f("w-10 h-10 mb-3",l?"text-[#3B4252]":"text-gray-300")}),jsx("p",{className:f("text-sm",l?"text-[#6B7280]":"text-gray-500"),children:c==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsx("div",{className:f("p-4 border-t",l?"border-white/10":"border-gray-200"),children:jsxs("div",{className:"flex items-start gap-2",children:[h&&jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:h.color||"#8B5CF6"},children:h.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:f("flex-1 flex items-center gap-2 px-3 py-2 rounded-lg",l?"bg-white/5":"bg-white border border-gray-200"),children:[jsx("input",{type:"text",value:N,onChange:E=>ee(E.target.value),onKeyDown:async E=>{if(E.key==="Enter"&&!E.shiftKey&&k&&N.trim()&&g){E.preventDefault(),Te(true);try{await g(k.id,N.trim()),ee("");}finally{Te(false);}}},placeholder:c==="es"?"Escribe un comentario...":"Write a comment...",disabled:se||!g,className:f("flex-1 bg-transparent text-sm outline-none",l?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400",(se||!g)&&"opacity-50")}),jsx("button",{onClick:async()=>{if(k&&N.trim()&&g){Te(true);try{await g(k.id,N.trim()),ee("");}finally{Te(false);}}},disabled:se||!N.trim()||!g,className:f("p-1.5 rounded transition-colors",N.trim()&&g?"bg-blue-500 text-white hover:bg-blue-600":l?"text-[#6B7280]":"text-gray-400",se&&"opacity-50 cursor-not-allowed"),children:se?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&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>M(null),className:"fixed inset-0 bg-black/30 z-40"}),jsxs(motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:f("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",l?"bg-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:f("px-4 py-3 border-b flex items-center justify-between",l?"border-white/10":"border-gray-200"),children:[jsx("span",{className:f("font-medium",l?"text-white":"text-gray-900"),children:B.date.toLocaleDateString(c==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsx("button",{onClick:()=>M(null),className:f("p-1 rounded",l?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-4 h-4"})})]}),jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-2",children:B.events.map(E=>jsxs("button",{onClick:()=>{M(null),w(E.task),C?.(E.task.id);},className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",l?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx(jc,{task:E.task}),jsx("span",{className:f("text-sm truncate flex-1",l?"text-white":"text-gray-900"),children:E.title}),E.task.priority==="high"||E.task.priority==="urgent"?jsx(Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},E.id))})]})]})})]})}var Ui={bgPrimary:"#0d1117",bgSecondary:"#161b22",bgHover:"#21262d",bgToday:"#1f6feb20",bgWeekend:"#161b2280",bgOtherMonth:"#0d111750",border:"#30363d",borderLight:"#21262d",textPrimary:"#c9d1d9",textSecondary:"#8b949e",textMuted:"#6e7681",textToday:"#58a6ff",accent:"#58a6ff",accentHover:"#79b8ff",accentLight:"#58a6ff20",statusTodo:"#8b949e",statusInProgress:"#f0883e",statusCompleted:"#3fb950",focusRing:"#58a6ff"},Hi={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"},Wi={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"},Vn={dark:Ui,light:Hi,neutral:Wi};function qc(e){return Vn[e]||Vn.dark}function hh({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:p}){let[m,i]=useState(false),u=useMemo(()=>t.filter(h=>e.cardIds.includes(h.id)),[t,e.cardIds]),d=useMemo(()=>{let h=u.length,C=new Set(u.flatMap(b=>b.assignedUserIds||[])).size,T=u.map(b=>b.priority).filter(Boolean),c=new Set(u.flatMap(b=>b.labels||[])).size;return {totalCards:h,uniqueAssignees:C,priorities:T,labels:c}},[u]),g=()=>{o?.(e.id);};return jsxs("div",{className:f("card-stack",!e.isExpanded&&"card-stack-collapsed",p),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxs("div",{className:"card-stack-header",onClick:g,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:f("card-stack-chevron",e.isExpanded&&"expanded"),children:jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsx("h3",{className:"card-stack-title",children:e.title}),jsx("div",{className:"card-stack-badge",children:d.totalCards}),jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),m&&jsx("div",{className:"card-stack-actions",children:jsx("button",{className:"card-stack-action",onClick:h=>{h.stopPropagation(),n?.(e.id);},"aria-label":"Delete stack",children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxs("div",{className:"card-stack-summary",children:[jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxs("span",{children:[d.uniqueAssignees," assignees"]})]}),d.labels>0&&jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxs("span",{children:[d.labels," labels"]})]}),e.confidence&&jsx("div",{className:"card-stack-summary-item",children:jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsx("div",{className:"card-stack-content",children: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(h=>jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsx("div",{onClick:()=>r?.(h),children:a(h)}):jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(h),children:[jsx("h4",{children:h.title}),h.description&&jsxs("p",{children:[h.description.substring(0,100),"..."]})]}),jsx("button",{className:"card-stack-unstack-btn",onClick:C=>{C.stopPropagation(),s?.(e.id,h.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"})]})})]},h.id))})})]})}var Jc={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function Vo(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 jo(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 Qc(e){return {created:"#10b981",status_changed:"#3b82f6",assignee_changed:"#8b5cf6",priority_changed:"#f59e0b",moved:"#06b6d4",title_updated:"#6366f1",description_updated:"#6366f1",dates_changed:"#ec4899",labels_changed:"#14b8a6",dependency_added:"#a855f7",dependency_removed:"#ef4444",comment_added:"#84cc16",archived:"#6b7280",restored:"#10b981"}[e]||"#6b7280"}function Zc({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:p}){let m=useMemo(()=>({...Jc,...n}),[n]),[i,u]=useState(new Set),d=useRef(null),g=useMemo(()=>{if(!m.groupByDay)return [{date:null,events:e}];let y=new Map;return e.forEach(l=>{let x=l.timestamp.toISOString().split("T")[0],v=y.get(x);v?v.push(l):y.set(x,[l]);}),Array.from(y.entries()).sort((l,x)=>x[0].localeCompare(l[0])).map(([l,x])=>({date:new Date(l),events:x.sort((v,S)=>S.timestamp.getTime()-v.timestamp.getTime())}))},[e,m.groupByDay]),{uniqueUsers:h,uniqueTypes:C}=useMemo(()=>{let y=new Set,l=new Set;return e.forEach(x=>{y.add(x.userId),l.add(x.type);}),{uniqueUsers:Array.from(y),uniqueTypes:Array.from(l)}},[e]),T=y=>{u(l=>{let x=new Set(l);return x.has(y)?x.delete(y):x.add(y),x});},c=y=>{let x=new Date().getTime()-y.getTime(),v=Math.floor(x/6e4),S=Math.floor(x/36e5),k=Math.floor(x/864e5);return v<1?"just now":v<60?`${v}m ago`:S<24?`${S}h ago`:k<7?`${k}d ago`:y.toLocaleDateString()},b=useMemo(()=>{let y=0;return t.types&&t.types.length>0&&y++,t.users&&t.users.length>0&&y++,t.dateRange&&y++,t.searchTerm&&y++,y},[t]);return useEffect(()=>{if(s&&d.current){let y=d.current.querySelector(`[data-event-id="${s}"]`);y&&y.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxs("div",{className:f("history-timeline-empty",p),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:f("history-timeline",m.compact&&"compact",p),children:[jsxs("div",{className:"history-timeline-filters",children:[jsxs("div",{className:"history-timeline-filter-group",children:[jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:y=>{let l=y.target.value;a({...t,types:l?[l]:void 0});},children:[jsx("option",{value:"",children:"All Events"}),C.map(y=>jsxs("option",{value:y,children:[jo(y)," ",y.replace("_"," ")]},y))]}),h.length>1&&jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:y=>{let l=y.target.value;a({...t,users:l?[l]:void 0});},children:[jsx("option",{value:"",children:"All Users"}),h.map(y=>jsx("option",{value:y,children:y},y))]}),jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:y=>a({...t,searchTerm:y.target.value})})]}),b>0&&jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",b,")"]})]}),jsx("div",{className:"history-timeline-container",ref:d,children:g.map(y=>jsxs("div",{className:"history-timeline-group",children:[m.groupByDay&&y.date&&jsxs("div",{className:"history-timeline-day-header",children:[jsx("span",{className:"history-timeline-day-date",children:y.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxs("span",{className:"history-timeline-day-count",children:[y.events.length," events"]})]}),jsx("div",{className:"history-timeline-events",children:y.events.map((l,x)=>{let v=i.has(l.id),S=s===l.id,k=Qc(l.type);return jsxs("div",{"data-event-id":l.id,className:f("history-timeline-event",v&&"expanded",S&&"selected"),onClick:()=>o?.(l),children:[jsxs("div",{className:"history-timeline-line",children:[jsx("div",{className:"history-timeline-dot",style:{backgroundColor:k},children:m.showIcons&&jsx("span",{className:"history-timeline-dot-icon",children:jo(l.type)})}),x<y.events.length-1&&jsx("div",{className:"history-timeline-connector",style:{borderColor:k}})]}),jsxs("div",{className:"history-timeline-event-content",children:[jsxs("div",{className:"history-timeline-event-header",children:[jsxs("div",{className:"history-timeline-event-header-left",children:[m.showAvatars&&l.userAvatar&&jsx("img",{src:l.userAvatar,alt:l.userName||l.userId,className:"history-timeline-event-avatar"}),jsxs("div",{className:"history-timeline-event-description",children:[jsx("span",{className:"history-timeline-event-user",children:l.userName||l.userId}),jsx("span",{className:"history-timeline-event-action",children:Vo(l)})]})]}),jsx("div",{className:"history-timeline-event-time",children:m.useRelativeTime?c(l.timestamp):l.timestamp.toLocaleString()})]}),Object.keys(l.changes).length>0&&jsxs("button",{className:"history-timeline-event-toggle",onClick:w=>{w.stopPropagation(),T(l.id);},children:[v?"\u25BC":"\u25B6"," Show changes"]}),v&&jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(l.changes).map(([w,B])=>jsxs("div",{className:"history-timeline-event-change",children:[jsxs("span",{className:"history-timeline-event-change-key",children:[w,":"]}),jsxs("div",{className:"history-timeline-event-change-values",children:[jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(B.from)}),jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(B.to)})]})]},w)),l.metadata&&Object.keys(l.metadata).length>0&&jsxs("div",{className:"history-timeline-event-metadata",children:[jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(l.metadata).map(([w,B])=>jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxs("span",{className:"history-timeline-event-metadata-key",children:[w,":"]}),jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(B)})]},w))]})]})]})]},l.id)})})]},y.date?.toISOString()||"all"))})]})}function tm({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:p,onSpeedChange:m,className:i}){let u=[.5,1,1.5,2,3],d=useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),g=useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxs("div",{className:f("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:f("history-replay",i),children:[jsxs("div",{className:"history-replay-current-event",children:[jsx("div",{className:"history-replay-event-icon",children:d&&jo(d.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:d&&Vo(d)}),jsxs("div",{className:"history-replay-event-meta",children:[jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsx("span",{className:"history-replay-event-time",children:d&&d.timestamp.toLocaleString()})]})]})]}),jsxs("div",{className:"history-replay-progress-container",children:[jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:h=>p(parseInt(h.target.value))}),jsx("div",{className:"history-replay-progress-fill",style:{width:`${g}%`}}),jsx("div",{className:"history-replay-progress-markers",children:t.map((h,C)=>jsx("div",{className:f("history-replay-progress-marker",C===e.currentIndex&&"active"),style:{left:`${C/(e.totalEvents-1)*100}%`},onClick:()=>p(C),title:Vo(h)},h.id))})]}),jsxs("div",{className:"history-replay-controls",children:[jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:o,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsx("button",{className:"history-replay-control-btn",onClick:n,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxs("div",{className:"history-replay-speed",children:[jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsx("div",{className:"history-replay-speed-buttons",children:u.map(h=>jsxs("button",{className:f("history-replay-speed-btn",e.speed===h&&"active"),onClick:()=>m(h),children:[h,"x"]},h))})]}),jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxs("div",{className:"history-replay-shortcuts",children:[jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2190"})," Previous"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2192"})," Next"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxs("div",{className:"history-replay-card-preview",children:[jsxs("div",{className:"history-replay-card-preview-header",children:[jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsx("span",{className:"history-replay-card-preview-time",children:d&&d.timestamp.toLocaleDateString()})]}),jsxs("div",{className:"history-replay-card-preview-content",children:[jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(h=>jsx("span",{className:"history-replay-card-preview-label-tag",children:h},h))})]})]})]})]}):jsxs("div",{className:f("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 Gi(e){return {blocks:"#ef4444",blocked_by:"#dc2626",depends_on:"#f59e0b",required_by:"#d97706",relates_to:"#6b7280",duplicates:"#8b5cf6",parent_of:"#3b82f6",child_of:"#2563eb",similar_to:"#10b981"}[e]||"#6b7280"}function _i(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 am(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 rm(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function wh(e,t,a,r,o,s=100){let n=e.map(m=>({...m,x:m.x??a/2+Math.random()*100-50,y:m.y??r/2+Math.random()*100-50,vx:0,vy:0})),p=new Map(n.map(m=>[m.id,m]));for(let m=0;m<s;m++){let i=1-m/s;n.forEach(u=>{let d=a/2,g=r/2;u.vx+=(d-u.x)*o.centerForce*i,u.vy+=(g-u.y)*o.centerForce*i,n.forEach(h=>{if(u.id===h.id)return;let C=u.x-h.x,T=u.y-h.y,c=Math.sqrt(C*C+T*T)||1,b=o.chargeStrength*i/(c*c);u.vx+=C/c*b,u.vy+=T/c*b;});}),t.forEach(u=>{let d=p.get(typeof u.source=="string"?u.source:u.source.id),g=p.get(typeof u.target=="string"?u.target:u.target.id);if(!d||!g)return;let h=g.x-d.x,C=g.y-d.y,T=Math.sqrt(h*h+C*C)||1,c=(T-o.linkDistance)/T*o.forceStrength*i;d.vx+=h*c,d.vy+=C*c,g.vx-=h*c,g.vy-=C*c;}),n.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(o.nodeSize,Math.min(a-o.nodeSize,u.x)),u.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,u.y)),u.vx*=.9,u.vy*=.9;});}return n}function om({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:p,className:m}){let i=useRef(null),[u,d]=useState([]),[g,h]=useState(null),[C,T]=useState(null),[c,b]=useState(null),[y,l]=useState(1),[x,v]=useState({x:0,y:0});useEffect(()=>{if(e.length===0)return;let R=wh(e,t,a.width,a.height,a,150);d(R);},[e,t,a]);let S=useCallback((R,Y)=>{a.enableDragging&&(Y.stopPropagation(),h(R));},[a.enableDragging]),k=useCallback(R=>{if(!g||!i.current)return;let te=i.current.getBoundingClientRect(),ye=(R.clientX-te.left-x.x)/y,De=(R.clientY-te.top-x.y)/y;d(Se=>Se.map(O=>O.id===g?{...O,x:ye,y:De,fx:ye,fy:De}:O));},[g,y,x]),w=useCallback(()=>{h(null);},[]),B=useCallback((R,Y)=>{Y.stopPropagation(),p?.({type:"node-click",node:R,position:{x:Y.clientX,y:Y.clientY}});},[p]),M=useCallback((R,Y)=>{Y.stopPropagation(),p?.({type:"edge-click",edge:R,position:{x:Y.clientX,y:Y.clientY}});},[p]),D=useCallback(R=>{let Y=u.find(te=>te.id===R);return Y?{x:Y.x,y:Y.y}:{x:0,y:0}},[u]),I=useCallback(R=>{if(R.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return R.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let Y=R.card.priority;return Y==="URGENT"?"#ef4444":Y==="HIGH"?"#f59e0b":Y==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return R.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxs("div",{className:f("relationships-graph-empty",m),children:[jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxs("div",{className:f("relationships-graph",m),children:[jsxs("div",{className:"relationships-graph-controls",children:[jsxs("div",{className:"relationships-graph-stats",children:[jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:n.totalNodes}),jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:n.totalEdges}),jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>l(R=>Math.min(R+.2,3)),children:"+"}),jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(y*100),"%"]}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>l(R=>Math.max(R-.2,.5)),children:"\u2212"}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{l(1),v({x:0,y:0});},children:"Reset"})]})]}),jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(R=>R.type))).map(R=>jsxs("div",{className:"relationships-graph-legend-item",children:[jsx("div",{className:"relationships-graph-legend-color",style:{background:Gi(R)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[am(R)," ",_i(R)]})]},R))}),jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:k,onMouseUp:w,onMouseLeave:w,children:[jsxs("g",{transform:`translate(${x.x}, ${x.y}) scale(${y})`,children:[jsx("g",{className:"relationships-graph-edges",children:t.map(R=>{let Y=D(typeof R.source=="string"?R.source:R.source.id),te=D(typeof R.target=="string"?R.target:R.target.id),ye=rm(R.type),De=c===R.id,Se=R.onCriticalPath;return jsxs("g",{className:f("relationships-graph-edge",De&&"hovered",Se&&"critical"),onMouseEnter:()=>b(R.id),onMouseLeave:()=>b(null),onClick:O=>M(R,O),children:[jsx("line",{x1:Y.x,y1:Y.y,x2:te.x,y2:te.y,stroke:Gi(R.type),strokeWidth:Se?a.edgeWidth*2:a.edgeWidth,strokeOpacity:De?1:.6,markerEnd:ye?"url(#arrowhead)":void 0}),a.showEdgeLabels&&De&&jsx("text",{x:(Y.x+te.x)/2,y:(Y.y+te.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:_i(R.type)})]},R.id)})}),jsx("g",{className:"relationships-graph-nodes",children:u.map(R=>{let Y=C===R.id,te=R.onCriticalPath;return jsxs("g",{className:f("relationships-graph-node",Y&&"hovered",te&&"critical"),transform:`translate(${R.x}, ${R.y})`,onMouseDown:ye=>S(R.id,ye),onMouseEnter:()=>T(R.id),onMouseLeave:()=>T(null),onClick:ye=>B(R,ye),children:[jsx("circle",{r:te?a.nodeSize*1.2:a.nodeSize,fill:I(R),stroke:te?"#fbbf24":"#ffffff",strokeWidth:te?3:2,opacity:Y?1:.9}),a.showLabels&&jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:R.card.title.length>20?R.card.title.substring(0,20)+"...":R.card.title})]},R.id)})})]}),jsx("defs",{children:jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function im({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=useState(""),[p,m]=useState(false),[i,u]=useState(null),[d,g]=useState(null),h=useRef(null),C=p||o;useEffect(()=>{e&&h.current&&h.current.focus();},[e]),useEffect(()=>{let y=l=>{l.key==="Escape"&&!C&&T();};if(e)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[e,C]);let T=()=>{C||(n(""),u(null),g(null),t());},c=async()=>{if(!(!s.trim()||C)){m(true),u(null),g(null);try{let y=await r(s.trim());g(y);}catch(y){u(y instanceof Error?y.message:"Failed to generate plan");}finally{m(false);}}},b=()=>{d&&(a(d),T());};return e?jsxs(lt,{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-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:y=>y.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsx("button",{onClick:T,disabled:C,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:d?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),d.explanation&&jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsx("p",{className:"text-sm text-white/90",children:d.explanation})}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",d.columns.length,")"]}),jsx("div",{className:"flex gap-2 flex-wrap",children:d.columns.map((y,l)=>jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:y.title},l))})]}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",d.cards.length,")"]}),jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[d.cards.slice(0,10).map((y,l)=>jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsx("p",{className:"text-sm font-medium text-white/90",children:y.title}),y.description&&jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:y.description})]}),y.priority&&jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${y.priority==="URGENT"?"bg-red-500/20 text-red-400":y.priority==="HIGH"?"bg-orange-500/20 text-orange-400":y.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:y.priority})]})},l)),d.cards.length>10&&jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",d.cards.length-10," more tasks..."]})]})]})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsx("textarea",{ref:h,value:s,onChange:y=>n(y.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:C}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),i&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((y,l)=>jsx("button",{onClick:()=>n(y),disabled:C,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:y},l))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:C&&jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:T,disabled:C,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),d?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:c,disabled:!s.trim()||C,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:C?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Vi={"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 Th={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Nh={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 Dh(e,t,a){let r=Vi[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function Ko(e){return `$${e.toFixed(4)}`}var ji=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=Dh(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(d=>d.timestamp>=t.start&&d.timestamp<=t.end));let r=a.length,o=a.reduce((d,g)=>d+g.cost,0),s=a.reduce((d,g)=>d+g.inputTokens,0),n=a.reduce((d,g)=>d+g.outputTokens,0),p=a.filter(d=>d.success),m=a.reduce((d,g)=>d+g.duration,0),i={},u={};return a.forEach(d=>{i[d.feature]=(i[d.feature]||0)+1,u[d.feature]=(u[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:u,averageDuration:r>0?m/r:0,successRate:r>0?p.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,n=new Date;a==="month"?n.setMonth(s.getMonth()-1):n.setDate(s.getDate()-1);let p=this.operations.filter(u=>u.timestamp>=n).length,m=Math.max(0,o-p),i=p/o*100;return {used:p,limit:o,remaining:m,percentUsed:i,isExceeded:p>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},Qr=new ji;function cm({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=useState(Qr.getStats()),[s,n]=useState(Qr.checkLimit(a));if(useEffect(()=>{if(!e)return;let m=setInterval(()=>{o(Qr.getStats()),n(Qr.checkLimit(a));},1e3);return ()=>clearInterval(m)},[e,a]),useEffect(()=>{let m=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[e,t]),!e)return null;let p=Qr.getRecentOperations(5);return jsxs(lt,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:m=>m.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-blue-500/10 to-purple-500/10 border border-blue-500/30",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:Ko(r.totalCost)})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:r.totalOperations})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([m,i])=>{let u=r.costsByFeature[m]||0,d=r.totalOperations>0?i/r.totalOperations*100:0;return jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:m.replace(/([A-Z])/g," $1").trim()}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[i," ops"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:Ko(u)})]})]}),jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full bg-blue-500",style:{width:`${d}%`}})})]},m)})})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),p.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:p.map(m=>jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:m.feature.replace(/([A-Z])/g," $1").trim()}),jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(m.timestamp).toLocaleTimeString()," \u2022"," ",m.duration,"ms"]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[m.inputTokens+m.outputTokens," tokens"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:Ko(m.cost)}),jsx("div",{className:`w-2 h-2 rounded-full ${m.success?"bg-green-400":"bg-red-400"}`})]})]},m.id))})]})]}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80",children:"Close"})]})]})})]})}function um({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,p]=useState(""),[m,i]=useState(""),[u,d]=useState(""),[g,h]=useState(false),[C,T]=useState(null),[c,b]=useState(null),[y,l]=useState(null),x=useRef(null),v=g||o;useEffect(()=>{e&&x.current&&x.current.focus();},[e]),useEffect(()=>{let M=D=>{D.key==="Escape"&&!v&&S();};if(e)return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[e,v]);let S=()=>{v||(p(""),i(""),d(""),T(null),b(null),l(null),t());},k=async()=>{if(!(!n.trim()||v)){h(true),T(null),b(null),l(null);try{let M=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:m||void 0,endDate:u||void 0});b(M.tasks.tasks),l({from_cache:M.from_cache,tokens_used:M.tokens_used,mock_mode:M.mock_mode,similarity:M.similarity,tokens_saved:M.tokens_saved});}catch(M){T(M instanceof Error?M.message:"Failed to generate tasks");}finally{h(false);}}},w=()=>{c&&(a(c),S());};if(!e)return null;let B=y?.similarity?((y.similarity||0)*100).toFixed(0):"0";return jsxs(lt,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:S}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:M=>M.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsx("button",{onClick:S,disabled:v,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:c?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxs("div",{className:"flex flex-wrap gap-2",children:[y?.mock_mode&&jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),y?.from_cache?jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",B,"% similar)"]}):jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[y?.tokens_used||0," tokens"]}),y?.tokens_saved&&jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-indigo-500/20 text-indigo-400 border border-indigo-500/30",children:[y.tokens_saved," tokens saved"]}),jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[c.length," tasks"]})]}),jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:c.map((M,D)=>jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-colors",children:jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxs("span",{className:"text-xs text-white/50",children:["#",D+1]}),jsx("p",{className:"text-sm font-medium text-white/90",children:M.name})]}),jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[jsxs("span",{className:"flex items-center gap-1",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-white/40",children:[jsx("rect",{x:"1",y:"2",width:"10",height:"8",rx:"1",stroke:"currentColor"}),jsx("path",{d:"M1 4h10",stroke:"currentColor"})]}),M.start," \u2192 ",M.end]}),jsxs("span",{children:[M.duration," days"]}),M.dependencies.length>0&&jsxs("span",{className:"text-blue-400",children:["Depends: ",M.dependencies.join(", ")]})]})]}),jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${M.priority==="high"?"bg-red-500/20 text-red-400":M.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:M.priority})]})},M.id))})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsx("textarea",{ref:x,value:n,onChange:M=>p(M.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:v}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsx("input",{type:"date",value:m,onChange:M=>i(M.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:v})]}),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:M=>d(M.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:v})]})]}),C&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:C}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((M,D)=>jsx("button",{onClick:()=>p(M),disabled:v,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:M},D))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:v&&jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:S,disabled:v,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),c?jsx("button",{onClick:w,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsx("button",{onClick:k,disabled:!n.trim()||v,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:v?"Generating...":"Generate Tasks"})]})]})]})})]})}function Yn({initialBoard:e,onPersist:t}){let[a,r]=useState(e),o=useCallback(c=>{t&&an(()=>Promise.resolve(t(c)),{maxAttempts:3,initialDelay:1e3,onRetry:(b,y,l)=>{console.warn(`Retry attempt ${y} after ${l}ms: ${b.message}`);}}).then(b=>{b.success||console.error(`Failed to persist board after ${b.attempts} attempts:`,b.error);});},[t]),s=useCallback(async(c,b,y)=>{r(l=>{let x=l.cards.find(M=>M.id===c);if(!x)return l;let v=x.columnId,S={...x,columnId:b,position:y},k=l.cards.map(M=>M.id===c?S:M),w=l.columns.map(M=>{if(M.id===v)return {...M,cardIds:M.cardIds.filter(D=>D!==c)};if(M.id===b){let D=k.filter(I=>I.columnId===b).sort((I,R)=>I.position-R.position);return {...M,cardIds:D.map(I=>I.id)}}return M}),B={...l,cards:k,columns:w};return o(B),B});},[o]),n=useCallback(async(c,b)=>{r(y=>{let l=y.cards.map(v=>v.id===c?{...v,...b}:v),x={...y,cards:l};return o(x),x});},[o]),p=useCallback(async c=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(y=>{let l={...c,id:b},x=y.columns.map(S=>S.id===c.columnId?{...S,cardIds:[...S.cardIds,b]}:S),v={...y,cards:[...y.cards,l],columns:x};return o(v),v});},[o]),m=useCallback(async c=>{r(b=>{let y=b.cards.find(S=>S.id===c);if(!y)return b;let l=b.cards.filter(S=>S.id!==c),x=b.columns.map(S=>S.id===y.columnId?{...S,cardIds:S.cardIds.filter(k=>k!==c)}:S),v={...b,cards:l,columns:x};return o(v),v});},[o]),i=useCallback(async c=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(y=>{let l={...c,id:b,cardIds:[]},x={...y,columns:[...y.columns,l]};return o(x),x});},[o]),u=useCallback(async(c,b)=>{r(y=>{let l=y.columns.map(v=>v.id===c?{...v,...b}:v),x={...y,columns:l};return o(x),x});},[o]),d=useCallback(async c=>{r(b=>{let y=b.cards.filter(v=>v.columnId!==c),l=b.columns.filter(v=>v.id!==c),x={...b,cards:y,columns:l};return o(x),x});},[o]),g=useCallback(c=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return p(c),b},[p]),h=useCallback(c=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(c),b},[i]),C=useCallback(()=>{r(c=>{let b={...c,cards:[],columns:[]};return o(b),b});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:p,onCardDelete:m,onColumnCreate:i,onColumnUpdate:u,onColumnDelete:d},setBoard:r,helpers:{addCard:g,addColumn:h,deleteCard:m,deleteColumn:d,clearBoard:C}}}function fm({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=Yn({initialBoard:e,onPersist:a}),n=useMemo(()=>({addCard:(m,i,u={})=>{s.addCard({title:i,columnId:m,position:r.cards.filter(d=>d.columnId===m).length,...u});},addColumn:(m,i)=>{let u=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:m,position:i??u+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:n}}var Yo={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},bm={by:"none",order:"asc"};function ym({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=useState({...Yo,...e}),[s,n]=useState({...bm,...t}),p=useCallback(T=>{o(c=>({...c,...T}));},[]),m=useCallback(T=>{n(c=>({...c,...T}));},[]),i=useCallback(()=>{o(Yo),n(bm);},[]),u=useCallback(()=>{a&&o({...Yo,assignees:[a]});},[a]),d=useCallback(()=>{o({...Yo,dateFilter:"overdue"});},[]),g=useCallback(()=>{o({...Yo,priorities:["HIGH","URGENT"]});},[]),h=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]),C=useCallback(T=>{let c=[...T];if(r.search){let b=r.search.toLowerCase();c=c.filter(y=>y.title.toLowerCase().includes(b)||y.description?.toLowerCase().includes(b));}if(r.dateFilter!=="all"){let b=new Date,y=b.getFullYear(),l=String(b.getMonth()+1).padStart(2,"0"),x=String(b.getDate()).padStart(2,"0"),v=`${y}-${l}-${x}`;c=c.filter(S=>{if(!S.endDate&&!S.dueDate)return false;let k=S.endDate||S.dueDate;if(!k)return false;let w;if(typeof k=="string")w=k.split("T")[0]||k;else {let B=k.getUTCFullYear(),M=String(k.getUTCMonth()+1).padStart(2,"0"),D=String(k.getUTCDate()).padStart(2,"0");w=`${B}-${M}-${D}`;}switch(r.dateFilter){case "overdue":return w<v;case "today":return w===v;case "this-week":let B=new Date(v+"T00:00:00"),M=new Date(w+"T00:00:00"),D=new Date(B);return D.setDate(D.getDate()+7),M>=B&&M<=D;case "custom":if(r.dateRange){let I=typeof k=="string"?new Date(k):k;return I>=r.dateRange.start&&I<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(c=c.filter(b=>b.priority&&r.priorities.includes(b.priority))),r.assignees.length>0&&(c=c.filter(b=>(b.assignedUserIds||(b.assigneeId?[b.assigneeId]:[])).some(l=>r.assignees.includes(l)))),r.labels.length>0&&(c=c.filter(b=>b.labels&&b.labels.some(y=>r.labels.includes(y)))),r.columns.length>0&&(c=c.filter(b=>r.columns.includes(b.columnId))),s.by!=="none"&&c.sort((b,y)=>{let l=0;switch(s.by){case "created":let x=b.createdAt?new Date(b.createdAt).getTime():0,v=y.createdAt?new Date(y.createdAt).getTime():0;l=x-v;break;case "priority":let S={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},k=S[b.priority||"LOW"],w=S[y.priority||"LOW"];l=k-w;break;case "dueDate":let B=b.endDate||b.dueDate,M=y.endDate||y.dueDate;if(!B)return 1;if(!M)return -1;let D=typeof B=="string"?new Date(B).getTime():B.getTime(),I=typeof M=="string"?new Date(M).getTime():M.getTime();l=D-I;break;case "title":l=b.title.localeCompare(y.title);break;case "estimate":let R=b.estimatedTime||0,Y=y.estimatedTime||0;l=R-Y;break;default:l=0;}return s.order==="asc"?l:-l}),c},[r,s]);return {filters:r,sort:s,setFilters:p,setSort:m,resetFilters:i,filterMyTasks:u,filterOverdue:d,filterHighPriority:g,applyFilters:C,hasActiveFilters:h}}var xm,km;if(typeof window<"u")try{let e=Zo("ai");xm=e.generateObject,km=e.generateText;}catch{}function wm(e={}){let[t,a]=useState(false),[r,o]=useState(null),s=!!(xm&&km&&e.apiKey),n=useCallback(async d=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",d),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${d}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(g){let h=g instanceof Error?g:new Error("Failed to generate plan");throw o(h),h}finally{a(false);}},[s]),p=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",d.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(g){let h=g instanceof Error?g:new Error("Failed to suggest assignee");throw o(h),h}finally{a(false);}},[s]),m=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("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(g){let h=g instanceof Error?g:new Error("Failed to predict risks");throw o(h),h}finally{a(false);}},[s]),i=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",d.title),[{title:`Subtask 1 for: ${d.title}`,position:d.position+.1,columnId:d.columnId},{title:`Subtask 2 for: ${d.title}`,position:d.position+.2,columnId:d.columnId}]}catch(g){let h=g instanceof Error?g:new Error("Failed to generate subtasks");throw o(h),h}finally{a(false);}},[s]),u=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",d.title),{hours:8,confidence:.75}}catch(g){let h=g instanceof Error?g:new Error("Failed to estimate effort");throw o(h),h}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:p,onPredictRisks:m,onGenerateSubtasks:i,onEstimateEffort:u,isAvailable:s,isLoading:t,error:r}}function Yi(){let[e,t]=useState(()=>selectionStore.getState());useEffect(()=>selectionStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{selectionStore.setState(r);},[]);return [e,a]}function Cm(e){let{cards:t}=e,[a,r]=Yi(),o=useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=useCallback((d,g)=>{if(!g){r({selectedCardIds:[d],lastSelectedCardId:d});return}let h=g.ctrlKey||g.metaKey,C=g.shiftKey;if(h)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(T=>T!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(C&&a.lastSelectedCardId){let T=t.find(b=>b.id===d),c=t.find(b=>b.id===a.lastSelectedCardId);if(T&&c&&T.columnId===c.columnId){let b=t.filter(w=>w.columnId===T.columnId).sort((w,B)=>w.position-B.position),y=b.findIndex(w=>w.id===a.lastSelectedCardId),l=b.findIndex(w=>w.id===d),[x,v]=y<l?[y,l]:[l,y],S=b.slice(x,v+1).map(w=>w.id),k=Array.from(new Set([...a.selectedCardIds,...S]));r({selectedCardIds:k,lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});},[t,a,r]),n=useCallback(d=>{r({selectedCardIds:a.selectedCardIds.filter(g=>g!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),p=useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),m=useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=useCallback(d=>{a.selectedCardIds.includes(d)?n(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,n,r]),u=useCallback(()=>t.filter(d=>a.selectedCardIds.includes(d.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:p,selectAll:m,toggleCard:i,getSelectedCards:u}}var Tm={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function Nm(e){let{cards:t,config:a,aiService:r}=e,o=useMemo(()=>({...Tm,...a}),[a]),[s,n]=useState([]),p=useCallback((T,c,b,y,l)=>{if(c.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let x={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:T,cardIds:c,columnId:b,strategy:y,color:l,isExpanded:true,position:s.filter(v=>v.columnId===b).length,createdAt:new Date};n(v=>[...v,x]);},[o.minCardsPerStack,s]),m=useCallback(T=>{n(c=>c.filter(b=>b.id!==T));},[]),i=useCallback(T=>{n(c=>c.map(b=>b.id===T?{...b,isExpanded:!b.isExpanded}:b));},[]),u=useCallback((T,c)=>{n(b=>b.map(y=>y.id===T&&!y.cardIds.includes(c)?{...y,cardIds:[...y.cardIds,c]}:y));},[]),d=useCallback((T,c)=>{n(b=>b.map(y=>{if(y.id===T){let l=y.cardIds.filter(x=>x!==c);return l.length<o.minCardsPerStack?null:{...y,cardIds:l}}return y}).filter(y=>y!==null));},[o.minCardsPerStack]),g=useCallback(T=>s.filter(c=>c.columnId===T).sort((c,b)=>c.position-b.position),[s]),h=useCallback(async T=>{let c=t.filter(v=>v.columnId===T);if(c.length<o.minCardsPerStack*2)return [];let b=[],y=new Map;c.forEach(v=>{v.labels&&v.labels.length>0&&v.labels.forEach(S=>{y.has(S)||y.set(S,[]),y.get(S).push(v);});}),y.forEach((v,S)=>{v.length>=o.minCardsPerStack&&b.push({stack:{title:`\u{1F4CC} ${S}`,cardIds:v.map(k=>k.id),columnId:T,strategy:"labels",color:"#3b82f6"},reason:`${v.length} cards with label "${S}"`,confidence:.85});});let l=new Map;c.forEach(v=>{v.assignedUserIds&&v.assignedUserIds.length>0&&v.assignedUserIds.forEach(S=>{l.has(S)||l.set(S,[]),l.get(S).push(v);});}),l.forEach((v,S)=>{v.length>=o.minCardsPerStack&&b.push({stack:{title:`\u{1F464} Assigned to user-${S.slice(-4)}`,cardIds:v.map(k=>k.id),columnId:T,strategy:"assignee",color:"#8b5cf6"},reason:`${v.length} cards assigned to the same user`,confidence:.8});});let x=new Map;if(c.forEach(v=>{v.priority&&(x.has(v.priority)||x.set(v.priority,[]),x.get(v.priority).push(v));}),x.forEach((v,S)=>{if(v.length>=o.minCardsPerStack){let k={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[S.toLowerCase()]||"\u26AA";b.push({stack:{title:`${k} ${S} Priority`,cardIds:v.map(w=>w.id),columnId:T,strategy:"priority",color:S==="high"||S==="urgent"?"#ef4444":"#10b981"},reason:`${v.length} cards with ${S} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let v of c){let k=(await r.findSimilar(v,c)).filter(w=>w.similarity>=o.autoStackConfidenceThreshold);if(k.length>=o.minCardsPerStack-1){let w=[v.id,...k.map(M=>M.card.id)],B=k.reduce((M,D)=>M+D.similarity,0)/k.length;b.push({stack:{title:`\u2728 Similar to "${v.title.substring(0,30)}${v.title.length>30?"...":""}"`,cardIds:w,columnId:T,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${k.length+1} similar tasks`,confidence:B});}}return b.filter(v=>v.confidence>=o.autoStackConfidenceThreshold).sort((v,S)=>S.confidence-v.confidence).slice(0,5)},[t,o,r]),C=useCallback(T=>{p(T.stack.title,T.stack.cardIds,T.stack.columnId,T.stack.strategy,T.stack.color);},[p]);return useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(c=>c.columnId)).forEach(async c=>{let b=await h(c),y=b[0];b.length>0&&y&&y.confidence>=.9&&C(y);});},[]),{stacks:s,createStack:p,deleteStack:m,toggleStack:i,addToStack:u,removeFromStack:d,getStacksForColumn:g,getSuggestions:h,applySuggestion:C,config:o}}var Dm=createContext(null);function Sm({children:e,initialData:t,onStateChange:a}){let r=useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(m=>{let{Column:i}=Zo("@libxai/core");s.set(m.id,new i(m));}),t?.cards?.forEach(m=>{let{Card:i}=Zo("@libxai/core");n.set(m.id,new i(m));});let p=null;if(t?.board){let{Board:m}=Zo("@libxai/core");p=new m(t.board);}r.current=new BoardStore({board:p,columns:s,cards:n});}let o=r.current;return useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsx(Dm.Provider,{value:{store:o},children:e})}function qn(){let e=useContext(Dm);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Xo(){let e=qn(),[t,a]=useState(e.getBoard()),[r,o]=useState(e.getAllColumns()),[s,n]=useState(e.getAllCards());useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),n(e.getAllCards());}),[e]);let p=useCallback(y=>{e.updateBoard(y);},[e]),m=useCallback(y=>{e.addColumn(y);},[e]),i=useCallback((y,l)=>{e.updateColumn(y,l);},[e]),u=useCallback(y=>{e.deleteColumn(y);},[e]),d=useCallback(y=>e.getColumn(y),[e]),g=useCallback(y=>{e.addCard(y);},[e]),h=useCallback((y,l)=>{e.updateCard(y,l);},[e]),C=useCallback(y=>{e.deleteCard(y);},[e]),T=useCallback((y,l,x)=>{e.moveCard(y,l,x);},[e]),c=useCallback(y=>e.getCard(y),[e]),b=useCallback(y=>e.getCardsByColumn(y),[e]);return {board:t,columns:r,cards:s,updateBoard:p,addColumn:m,updateColumn:i,deleteColumn:u,getColumn:d,addCard:g,updateCard:h,deleteCard:C,moveCard:T,getCard:c,getCardsByColumn:b}}function Pm(e){let{cards:t}=Xo();return useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let r=e.searchQuery.toLowerCase(),o=a.title.toLowerCase().includes(r),s=a.description?.toLowerCase().includes(r);if(!o&&!s)return false}return !(e.priorities&&e.priorities.length>0&&(!a.priority||!e.priorities.includes(a.priority))||e.statuses&&e.statuses.length>0&&(!a.status||!e.statuses.includes(a.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(o=>a.isAssignedTo(o))||e.labels&&e.labels.length>0&&!e.labels.some(o=>a.hasLabel(o))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(a.columnId)||e.isOverdue!==void 0&&e.isOverdue!==a.isOverdue())}):t,[t,e])}function Mm(e="position",t="asc"){let{cards:a}=Xo();return useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let p={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},m=o.priority?p[o.priority]:0,i=s.priority?p[s.priority]:0;n=m-i;break}case "createdAt":n=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":n=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":n=o.position-s.position;break}return t==="asc"?n:-n}),[a,e,t])}var Xn=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Nl.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let o=this.config.get(t);o[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let o=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let n=s[t];if(typeof n=="function")try{let p=await Promise.resolve(n.apply(s,a));p!==void 0&&(o=p,a[0]=p);}catch(p){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,p,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(n=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,n,{plugin:o.id,hook:t});}));}await Promise.all(r);}},Gh=new Xn;function Fm({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:p=0,getItemKey:m}){let i=useRef(null),u=useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:p}),d=u.getVirtualItems(),g={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},h=n?{width:`${u.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${u.getTotalSize()}px`,width:"100%",position:"relative"};return jsx("div",{ref:i,style:g,className:o,children:jsx("div",{style:h,children:d.map(C=>{let T=e[C.index];if(!T)return null;let c=m?m(T,C.index):C.index,b={position:"absolute",top:n?0:C.start,left:n?C.start:0,width:n?C.size:"100%",height:n?"100%":C.size};return jsx("div",{style:b,"data-index":C.index,children:r(T,C.index)},c)})})})}function Lm(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 Bm({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:p=16,getItemKey:m,horizontal:i=true}){let u=useRef(null),d=useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>u.current,estimateSize:()=>r,overscan:n,gap:p}),g=d.getVirtualItems(),h={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},C={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsx("div",{ref:u,style:h,className:s,children:jsx("div",{style:C,children:g.map(T=>{let c=e[T.index];if(!c)return null;let b=m?m(c,T.index):T.index,y={position:"absolute",top:0,left:T.start,width:T.size,height:"100%"};return jsx("div",{style:y,"data-index":T.index,children:o(c,T.index)},b)})})})}function Rm(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 $m(e,t=10){return e>t}var Qi={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Zi={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},el={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},tl={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},al={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},rl={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},ol={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},nl={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)"},sl={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)"},il={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},ll={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}},dl={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}},Jn={spacing:Qi,borderRadius:Zi,fontSize:el,fontWeight:tl,lineHeight:al,zIndex:rl,duration:ol,easing:nl,shadows:sl,opacity:il,kanban:ll,gantt:dl};function Om(e,t,a){return e[t]??a}function cl(e,t="",a={}){for(let[r,o]of Object.entries(e)){let s=t?`${t}-${r}`:r;typeof o=="object"&&o!==null&&!Array.isArray(o)?cl(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function jh(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function ml(e="asakaa"){let t=cl(Jn),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=jh(o);a.push(` ${s}: ${n};`);}return `:root {
389
+ Today's date: ${new Date().toISOString().split("T")[0]}`}function Ec(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function yr(e,t){let a=Ec(e),r=t.toLowerCase().trim(),o=a.find(p=>p.name.toLowerCase()===r);if(o)return o;let s=a.find(p=>p.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(p=>{let m=p.name.toLowerCase();return n.every(i=>m.includes(i))})}function Ci(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 g=new Date(r);return g.setDate(g.getDate()+1),g}if(a==="yesterday"||a==="ayer"){let g=new Date(r);return g.setDate(g.getDate()-1),g}if(a==="next week"||a==="la pr\xF3xima semana"){let g=new Date(r);return g.setDate(g.getDate()+7),g}let o=a.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(o){let h={sunday:0,domingo:0,monday:1,lunes:1,tuesday:2,martes:2,wednesday:3,mi\u00E9rcoles:3,miercoles:3,thursday:4,jueves:4,friday:5,viernes:5,saturday:6,s\u00E1bado:6,sabado:6}[o[1].toLowerCase()];if(h!==void 0){let C=new Date(r),T=C.getDay(),c=h-T;return c<=0&&(c+=7),C.setDate(C.getDate()+c),C}}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 g=parseInt(s[1],10),h=s[2].toLowerCase(),C=new Date(r);return h==="day"||h==="d\xEDa"||h==="dias"?C.setDate(C.getDate()+g):h==="week"||h==="semana"||h==="semanas"?C.setDate(C.getDate()+g*7):(h==="month"||h==="mes"||h==="meses")&&C.setMonth(C.getMonth()+g),C}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let p=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(p&&p[1]&&p[2]&&p[3]){let g=parseInt(p[1],10),h=parseInt(p[2],10)-1,C=parseInt(p[3],10);return new Date(C,h,g)}let m={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},i=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(i&&i[1]&&i[2]){let g=parseInt(i[1],10),h=m[i[2].toLowerCase()],C=i[3]?parseInt(i[3],10):r.getFullYear();if(h!==void 0)return new Date(C,h,g)}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},d=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(d&&d[1]&&d[2]){let g=u[d[1].toLowerCase()],h=parseInt(d[2],10),C=d[3]?parseInt(d[3],10):r.getFullYear();if(g!==void 0)return new Date(C,g,h)}return null}function Ti(e){let a=e.toLowerCase().trim().match(/(\d+)\s*(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(a&&a[1]&&a[2]){let r=parseInt(a[1],10),o=a[2].toLowerCase();if(o==="day"||o==="d\xEDa"||o==="dias")return r;if(o==="week"||o==="semana"||o==="semanas")return r*7;if(o==="month"||o==="mes"||o==="meses")return r*30}return null}function Ni(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 Pc(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 Mc(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(),d=yr(t,i),g=Ci(u);if(!d)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!g)return {type:"move_task",taskId:d.id,taskName:d.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 h=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,C=new Date(g);return C.setDate(C.getDate()+h),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:g,endDate:C},message:`Moved "${d.name}" to ${g.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),u=o[2].trim(),d=yr(t,i),g=Ti(u);if(!d)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!g||!d.endDate)return {type:"resize_task",taskId:d.id,taskName:d.name,message:`Could not parse the duration "${u}".`,success:false,error:"Invalid duration"};let h=new Date(d.endDate);return h.setDate(h.getDate()+g),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:h},message:`Extended "${d.name}" by ${g} days. New end date: ${h.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(),d=yr(t,i),g=Ni(u);return d?g===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${u}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:d.id,taskName:d.name,updates:{progress:g},message:`Set "${d.name}" progress to ${g}%.`,success:true}:{type:"set_progress",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let n=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),u=n[2].trim(),d=yr(t,i);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:u},message:`Renamed "${d.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 p=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(p&&p[1]&&p[2]){let i=p[1].trim(),u=p[2].trim(),d=yr(t,i),g=yr(t,u);return d?g?{type:"link_tasks",taskId:g.id,taskName:g.name,dependencyFrom:d.id,dependencyTo:g.id,message:`Linked "${d.name}" \u2192 "${g.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 m=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(m&&m[1]){let i=m[1].trim(),u=yr(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 Ac(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 $0(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 O0(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function $n(e,t=[],a=[]){let r=e.assignedUserIds?.map(u=>{let d=a.find(g=>g.id===u);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(u=>u!==null),o=t.filter(u=>u.metadata?.parentCardId===e.id).map(u=>$n(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 n=u=>{if(u)return typeof u=="string"?new Date(u):u},p=n(e.startDate),m=n(e.endDate),i=e.metadata?.isMilestone===true||p&&m&&Math.abs(m.getTime()-p.getTime())<=864e5;return {id:e.id,name:e.title,startDate:p,endDate:m,progress:e.progress||0,status:$0(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:i,isCriticalPath:e.metadata?.isCriticalPath===true}}function Fc(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:O0(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function Lc(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>$n(r,e,t))}var Di={columns:{name:"Task Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions"},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"}},Si={columns:{name:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones"},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"}},On={en:Di,es:Si};function Ei(e){return On[e]||On.en}function zn(e,t){let a=Ei(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}function $c(e,t=0){let a=[];for(let r of e)a.push({...r,level:t,hasChildren:(r.subtasks?.length||0)>0,parentPath:[r.id]}),r.subtasks?.length&&r.isExpanded!==false&&a.push(...$c(r.subtasks,t+1));return a}function q0({status:e,progress:t}){return t===100||e==="completed"?jsx(CheckCircle2,{className:"w-5 h-5 text-green-500"}):t&&t>0||e==="in-progress"?jsx(PlayCircle,{className:"w-5 h-5 text-blue-500"}):jsx(Circle,{className:"w-5 h-5 text-gray-400"})}function Oc({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n}){let{theme:p="dark",locale:m="en",customTranslations:i,showSearch:u=true,showHierarchy:d=true}=t,g=zn(m,i),h=p==="dark",[C,T]=useState(new Set),[c,b]=useState("startDate"),[y,l]=useState("asc"),[x,v]=useState("");useMemo(()=>{let M=new Set;function D(I){for(let B of I)B.subtasks?.length&&(M.add(B.id),D(B.subtasks));}D(e),T(M);},[e]);let S=useCallback(M=>{T(D=>{let I=new Set(D);return I.has(M)?I.delete(M):I.add(M),I}),a.onTaskToggleExpand?.(M);},[a]),k=useCallback(M=>{c===M?l(D=>D==="asc"?"desc":"asc"):(b(M),l("asc")),a.onSortChange?.({column:M,direction:y==="asc"?"desc":"asc"});},[c,y,a]),w=useMemo(()=>{let M=$c(e);if(x.trim()){let I=x.toLowerCase();M=M.filter(B=>B.name.toLowerCase().includes(I));}let D=[];for(let I of M){let B=I.level===0;I.level>0&&(B=true),(B||x.trim())&&D.push(I);}return x.trim()&&D.sort((I,B)=>{let K,te;switch(c){case "name":K=I.name.toLowerCase(),te=B.name.toLowerCase();break;case "startDate":K=I.startDate?.getTime()||0,te=B.startDate?.getTime()||0;break;case "endDate":K=I.endDate?.getTime()||0,te=B.endDate?.getTime()||0;break;case "progress":K=I.progress||0,te=B.progress||0;break;case "status":K=I.status||"todo",te=B.status||"todo";break;default:return 0}return K<te?y==="asc"?-1:1:K>te?y==="asc"?1:-1:0}),D},[e,x,c,y]),R=M=>M?(M instanceof Date?M:new Date(M)).toLocaleDateString(m==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-";return r?jsx("div",{className:f("flex-1 flex items-center justify-center",h?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxs("p",{className:f("text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:[g.empty.noTasks,"..."]})]})}):o?jsx("div",{className:f("flex-1 flex items-center justify-center",h?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxs("div",{children:[jsx("h3",{className:f("text-lg font-semibold mb-2",h?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:f("text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsx("div",{className:f("flex-1 flex items-center justify-center",h?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsx(List,{className:"w-8 h-8 text-[#3B82F6]"})}),jsx("h3",{className:f("text-lg font-semibold mb-2",h?"text-white":"text-gray-900"),children:g.empty.noTasks}),jsx("p",{className:f("text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:g.empty.addFirstTask})]})}):jsxs("div",{className:f("flex-1 flex flex-col w-full h-full overflow-hidden",h?"bg-[#0F1117]":"bg-white",s),style:n,children:[jsx("div",{className:f("flex-shrink-0 px-6 py-4 border-b",h?"border-white/10":"border-gray-200"),children:jsxs("div",{className:"flex items-center gap-4",children:[u&&jsxs("div",{className:"relative flex-1 max-w-md",children:[jsx(Search,{className:f("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",h?"text-[#9CA3AF]":"text-gray-400")}),jsx("input",{type:"text",value:x,onChange:M=>v(M.target.value),placeholder:g.toolbar.searchPlaceholder,className:f("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",h?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsxs("div",{className:f("text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:[w.length," ",g.pagination.tasks]})]})}),jsxs("div",{className:f("flex-shrink-0 grid grid-cols-12 gap-4 px-6 py-3 border-b text-xs font-medium uppercase tracking-wider",h?"border-white/10 bg-white/5 text-[#9CA3AF]":"border-gray-200 bg-gray-50 text-gray-500"),children:[jsx("div",{className:"col-span-5 flex items-center gap-2",children:jsxs("button",{onClick:()=>k("name"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[g.columns.name,jsx(ArrowUpDown,{className:"w-3 h-3"})]})}),jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxs("button",{onClick:()=>k("status"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[g.columns.status,jsx(ArrowUpDown,{className:"w-3 h-3"})]})}),jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxs("button",{onClick:()=>k("startDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[g.columns.startDate,jsx(ArrowUpDown,{className:"w-3 h-3"})]})}),jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxs("button",{onClick:()=>k("endDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[g.columns.endDate,jsx(ArrowUpDown,{className:"w-3 h-3"})]})}),jsx("div",{className:"col-span-1 flex items-center gap-1",children:jsxs("button",{onClick:()=>k("progress"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:["%",jsx(ArrowUpDown,{className:"w-3 h-3"})]})})]}),jsxs("div",{className:"flex-1 overflow-auto",children:[jsx(AnimatePresence,{children:w.map((M,D)=>{let I=C.has(M.id);return jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:D*.02},className:f("grid grid-cols-12 gap-4 px-6 py-3 border-b transition-colors cursor-pointer",h?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),style:{paddingLeft:d?`${24+M.level*24}px`:void 0},onClick:()=>a.onTaskClick?.(M),onDoubleClick:()=>a.onTaskDoubleClick?.(M),children:[jsxs("div",{className:"col-span-5 flex items-center gap-2 min-w-0",children:[d&&M.hasChildren&&jsx("button",{onClick:B=>{B.stopPropagation(),S(M.id);},className:f("p-0.5 rounded",h?"hover:bg-white/10":"hover:bg-gray-200"),children:I?jsx(ChevronDown,{className:f("w-4 h-4",h?"text-[#9CA3AF]":"text-gray-400")}):jsx(ChevronRight,{className:f("w-4 h-4",h?"text-[#9CA3AF]":"text-gray-400")})}),d&&!M.hasChildren&&jsx("div",{className:"w-5"}),jsx("button",{onClick:B=>{B.stopPropagation(),a.onTaskUpdate?.({...M,progress:M.progress===100?0:100,status:M.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsx(q0,{status:M.status,progress:M.progress})}),jsx("span",{className:f("truncate",h?"text-white":"text-gray-900",M.progress===100&&(h?"line-through text-[#6B7280]":"line-through text-gray-400")),children:M.name})]}),jsx("div",{className:"col-span-2 flex items-center",children:jsx("span",{className:f("px-2 py-1 rounded-full text-xs font-medium",M.progress===100||M.status==="completed"?"bg-green-500/10 text-green-500":M.progress&&M.progress>0||M.status==="in-progress"?"bg-blue-500/10 text-blue-500":h?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:M.progress===100||M.status==="completed"?g.status.completed:M.progress&&M.progress>0||M.status==="in-progress"?g.status.inProgress:g.status.todo})}),jsxs("div",{className:f("col-span-2 flex items-center gap-1 text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:[jsx(Calendar,{className:"w-4 h-4"}),R(M.startDate)]}),jsxs("div",{className:f("col-span-2 flex items-center gap-1 text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:[jsx(Clock,{className:"w-4 h-4"}),R(M.endDate)]}),jsx("div",{className:"col-span-1 flex items-center",children:jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsx("div",{className:f("flex-1 h-1.5 rounded-full overflow-hidden",h?"bg-white/10":"bg-gray-200"),children:jsx("div",{className:f("h-full rounded-full transition-all",M.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${M.progress||0}%`}})}),jsxs("span",{className:f("text-xs w-8",h?"text-[#9CA3AF]":"text-gray-500"),children:[M.progress||0,"%"]})]})})]},M.id)})}),w.length===0&&x&&jsx("div",{className:"flex items-center justify-center py-12",children:jsxs("div",{className:"text-center",children:[jsx(List,{className:f("w-12 h-12 mx-auto mb-4",h?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:f(h?"text-[#9CA3AF]":"text-gray-600"),children:g.empty.noResults})]})})]})]})}var Pi={bgPrimary:"#0d1117",bgSecondary:"#161b22",bgHover:"#21262d",bgSelected:"#1f6feb20",bgAlternate:"#0d111780",border:"#30363d",borderLight:"#21262d",textPrimary:"#c9d1d9",textSecondary:"#8b949e",textMuted:"#6e7681",accent:"#58a6ff",accentHover:"#79b8ff",accentLight:"#58a6ff20",statusTodo:"#8b949e",statusInProgress:"#f0883e",statusCompleted:"#3fb950",focusRing:"#58a6ff",checkboxBg:"#21262d",checkboxChecked:"#58a6ff"},Mi={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"},Ai={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"},Hn={dark:Pi,light:Mi,neutral:Ai};function zc(e){return Hn[e]||Hn.dark}var Fi={navigation:{today:"Today",previous:"Previous",next:"Next",month:"Month",week:"Week",day:"Day"},weekdays:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},weekdaysFull:{sunday:"Sunday",monday:"Monday",tuesday:"Tuesday",wednesday:"Wednesday",thursday:"Thursday",friday:"Friday",saturday:"Saturday"},months:{january:"January",february:"February",march:"March",april:"April",may:"May",june:"June",july:"July",august:"August",september:"September",october:"October",november:"November",december:"December"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{allDay:"All day",moreEvents:"+{count} more",noEvents:"No tasks",newTask:"New Task",viewAll:"View all",week:"Week"},tooltips:{progress:"Progress",status:"Status",assignees:"Assignees",duration:"Duration",days:"days"}},Li={navigation:{today:"Hoy",previous:"Anterior",next:"Siguiente",month:"Mes",week:"Semana",day:"D\xEDa"},weekdays:{sun:"Dom",mon:"Lun",tue:"Mar",wed:"Mi\xE9",thu:"Jue",fri:"Vie",sat:"S\xE1b"},weekdaysFull:{sunday:"Domingo",monday:"Lunes",tuesday:"Martes",wednesday:"Mi\xE9rcoles",thursday:"Jueves",friday:"Viernes",saturday:"S\xE1bado"},months:{january:"Enero",february:"Febrero",march:"Marzo",april:"Abril",may:"Mayo",june:"Junio",july:"Julio",august:"Agosto",september:"Septiembre",october:"Octubre",november:"Noviembre",december:"Diciembre"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{allDay:"Todo el d\xEDa",moreEvents:"+{count} m\xE1s",noEvents:"Sin tareas",newTask:"Nueva Tarea",viewAll:"Ver todo",week:"Semana"},tooltips:{progress:"Progreso",status:"Estado",assignees:"Asignados",duration:"Duraci\xF3n",days:"d\xEDas"}},Wn={en:Fi,es:Li};function Wo(e){return Wn[e]||Wn.en}function Gn(e,t){let a=Wo(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 Uc(e){let t=Wo(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 Hc(e,t=0,a=true){let r=Wo(e),o=a?[r.weekdays.sun,r.weekdays.mon,r.weekdays.tue,r.weekdays.wed,r.weekdays.thu,r.weekdays.fri,r.weekdays.sat]:[r.weekdaysFull.sunday,r.weekdaysFull.monday,r.weekdaysFull.tuesday,r.weekdaysFull.wednesday,r.weekdaysFull.thursday,r.weekdaysFull.friday,r.weekdaysFull.saturday];return [...o.slice(t),...o.slice(0,t)]}function gh(e){let t=[];function a(r){for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);}return a(e),t}function zi(e,t){if(!t.startDate||!t.endDate)return false;let a=new Date(e.getFullYear(),e.getMonth(),e.getDate()),r=new Date(t.startDate.getFullYear(),t.startDate.getMonth(),t.startDate.getDate()),o=new Date(t.endDate.getFullYear(),t.endDate.getMonth(),t.endDate.getDate());return a>=r&&a<=o}function jc({task:e}){return e.progress===100||e.status==="completed"?jsx(CheckCircle2,{className:"w-3 h-3 text-green-500 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsx(PlayCircle,{className:"w-3 h-3 text-blue-500 flex-shrink-0"}):jsx(Circle,{className:"w-3 h-3 text-gray-400 flex-shrink-0"})}function Yc({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:p,availableTags:m=[],onCreateTag:i,attachmentsByTask:u,comments:d,onAddComment:g,currentUser:h,onTaskOpen:C}){let{theme:T="dark",locale:c="en",customTranslations:b}=t,y=Gn(c,b),l=T==="dark",x={textTertiary:l?"#6B7280":"#9CA3AF",textSecondary:l?"#9CA3AF":"#6B7280",textPrimary:l?"#FFFFFF":"#111827",borderLight:l?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:l?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:l?"#1A1D25":"#FFFFFF",bgSecondary:l?"#0F1117":"#F9FAFB",hoverBg:l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},[v,S]=useState(r||new Date),[k,w]=useState(null),[R,M]=useState(null),[D,I]=useState(null),[B,K]=useState(new Date),[te,ie]=useState({}),de=4,be=3,[$,J]=useState(false),[U,G]=useState(false),[A,Q]=useState(false),[X$1,H]=useState(false),[Ce,Me]=useState(null),[Oe,ye]=useState(""),[Ye,We]=useState(void 0),[et,vt]=useState(null),[Mt,mt]=useState(false),[O,le]=useState(false),[xe,Pe]=useState(null),[ze,at]=useState(false),[Et,Fe]=useState(new Date),[Xt,Ot]=useState(false),[Nt,ct]=useState(false),[Jt,Ea]=useState(false),[oe,ue]=useState(""),[pa,ya]=useState(false),[N,ee]=useState(""),[se,De]=useState(false),$e=useCallback(()=>{S(new Date(v.getFullYear(),v.getMonth()-1,1));},[v]),tt=useCallback(()=>{S(new Date(v.getFullYear(),v.getMonth()+1,1));},[v]),Ge=useCallback(()=>{S(new Date);},[]),Be=useMemo(()=>{let E=v.getFullYear(),ve=v.getMonth(),q=new Date(E,ve,1),Ae=new Date(E,ve+1,0),ot=q.getDay(),ne=Ae.getDate(),Re=gh(e),xt=new Date;xt.setHours(0,0,0,0);let Le=[],At=ot,st=new Date(E,ve,0).getDate();for(let zt=At-1;zt>=0;zt--){let je=new Date(E,ve-1,st-zt);Le.push({date:je,isCurrentMonth:false,isToday:false,isWeekend:je.getDay()===0||je.getDay()===6,events:Re.filter(kt=>zi(je,kt)).map(kt=>({id:kt.id,title:kt.name,start:kt.startDate,end:kt.endDate,task:kt}))});}for(let zt=1;zt<=ne;zt++){let je=new Date(E,ve,zt),kt=je.getTime()===xt.getTime();Le.push({date:je,isCurrentMonth:true,isToday:kt,isWeekend:je.getDay()===0||je.getDay()===6,events:Re.filter(ia=>zi(je,ia)).map(ia=>({id:ia.id,title:ia.name,start:ia.startDate,end:ia.endDate,task:ia}))});}let ga=42-Le.length;for(let zt=1;zt<=ga;zt++){let je=new Date(E,ve+1,zt);Le.push({date:je,isCurrentMonth:false,isToday:false,isWeekend:je.getDay()===0||je.getDay()===6,events:Re.filter(kt=>zi(je,kt)).map(kt=>({id:kt.id,title:kt.name,start:kt.startDate,end:kt.endDate,task:kt}))});}return Le},[v,e]),rt=c==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],_=v.toLocaleDateString(c==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),ae=useCallback((E,ve)=>{if(!k)return;let q={...k,[E]:ve};w(q),a.onTaskUpdate?.(q);},[k,a]),Ee=useCallback(E=>{if(!k)return;let ve=k.progress||0;E==="completed"?ve=100:E==="todo"&&(ve=0);let q={...k,status:E,progress:ve};w(q),a.onTaskUpdate?.(q),J(false);},[k,a]),Ue=useCallback((E,ve)=>{if(!k)return;let q={...k,startDate:E,endDate:ve};w(q),a.onTaskUpdate?.(q);},[k,a]),He=useCallback(()=>{J(false),G(false),Q(false),I(null),Ea(false),ue(""),ya(false);},[]),W=useCallback(async E=>{if(E.preventDefault(),E.stopPropagation(),Ot(false),!k||!a.onUploadAttachments)return;let ve=Array.from(E.dataTransfer.files);if(ve.length!==0){ct(true);try{await a.onUploadAttachments(k.id,ve);}finally{ct(false);}}},[k,a]),ce=useCallback(async E=>{if(!k||!a.onUploadAttachments||!E.target.files)return;let ve=Array.from(E.target.files);if(ve.length!==0){ct(true);try{await a.onUploadAttachments(k.id,ve);}finally{ct(false);}E.target.value="";}},[k,a]),Ie=useCallback(E=>{E.preventDefault(),E.stopPropagation(),Ot(true);},[]),Dt=useCallback(E=>{E.preventDefault(),E.stopPropagation(),Ot(false);},[]),Je=useCallback(E=>E<1024?`${E} B`:E<1024*1024?`${(E/1024).toFixed(1)} KB`:`${(E/(1024*1024)).toFixed(1)} MB`,[]),va=useCallback(E=>E.startsWith("image/")?Image:E.includes("pdf")||E.includes("document")?FileText:File,[]),ua=useMemo(()=>!k||!u?[]:u.get(k.id)||[],[k,u]);return o?jsx("div",{className:f("flex-1 flex items-center justify-center",l?"bg-[#0F1117]":"bg-white",n),style:p,children:jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxs("p",{className:f("text-sm",l?"text-[#9CA3AF]":"text-gray-600"),children:[y.labels.noEvents,"..."]})]})}):s?jsx("div",{className:f("flex-1 flex items-center justify-center",l?"bg-[#0F1117]":"bg-white",n),style:p,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:f("text-lg font-semibold mb-2",l?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:f("text-sm",l?"text-[#9CA3AF]":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsx("div",{className:f("flex-1 flex items-center justify-center",l?"bg-[#0F1117]":"bg-white",n),style:p,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsx(Calendar,{className:"w-8 h-8 text-[#3B82F6]"})}),jsx("h3",{className:f("text-lg font-semibold mb-2",l?"text-white":"text-gray-900"),children:y.labels.noEvents}),jsx("p",{className:f("text-sm",l?"text-[#9CA3AF]":"text-gray-600"),children:y.labels.newTask})]})}):jsxs("div",{className:f("flex-1 flex flex-col w-full h-full overflow-auto",l?"bg-[#0F1117]":"bg-white",n),style:p,children:[jsx("div",{className:f("flex-shrink-0 px-6 py-4 border-b",l?"border-white/10":"border-gray-200"),children:jsxs("div",{className:"flex items-center justify-between",children:[jsxs("div",{className:"flex items-center gap-4",children:[jsx("h2",{className:f("text-xl font-semibold capitalize",l?"text-white":"text-gray-900"),children:_}),jsx("button",{onClick:Ge,className:f("px-3 py-1.5 text-sm rounded-lg transition-colors",l?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:y.navigation.today})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("button",{onClick:$e,className:f("p-2 rounded-lg transition-colors",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:f("w-5 h-5",l?"text-[#9CA3AF]":"text-gray-600")})}),jsx("button",{onClick:tt,className:f("p-2 rounded-lg transition-colors",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:f("w-5 h-5",l?"text-[#9CA3AF]":"text-gray-600")})})]})]})}),jsx("div",{className:"flex-1 p-6 min-h-0",children:jsxs("div",{className:"flex flex-col",children:[jsx("div",{className:"grid grid-cols-7 gap-px mb-2",children:rt.map(E=>jsx("div",{className:f("py-2 text-center text-xs font-medium uppercase",l?"text-[#9CA3AF]":"text-gray-500"),children:E},E))}),jsx("div",{className:f("grid grid-cols-7 auto-rows-min gap-px rounded-lg",l?"bg-[#2D2D2D]":"bg-gray-300"),children:Be.map((E,ve)=>{let q=E.date.getDay()===0||E.date.getDay()===6;return jsxs("div",{className:f("min-h-[120px] p-2 transition-colors flex flex-col relative group",l?q?"bg-[#1C1F26]":E.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":q?"bg-gray-100":E.isCurrentMonth?"bg-white":"bg-gray-50",E.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let Ae=te[ve]||de,ot=E.events.slice(0,Ae),ne=E.events.length-Ae;return jsxs("div",{className:"space-y-1 flex-1",children:[ot.map(Re=>jsx("div",{className:"relative group",children:jsxs(motion.button,{onClick:()=>{w(Re.task),a.onEventClick?.(Re),C?.(Re.task.id);},whileHover:{scale:1.02},className:f("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",Re.task.progress===100?l?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":l?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsx(jc,{task:Re.task}),jsx("span",{className:"truncate",children:Re.title})]})},Re.id)),ne>0&&jsxs("button",{onClick:Re=>{Re.stopPropagation(),ie(xt=>({...xt,[ve]:Ae+be}));},className:f("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",l?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",ne," ",c==="es"?"M\xC1S":"MORE"]}),Ae>de&&E.events.length>de&&jsx("button",{onClick:Re=>{Re.stopPropagation(),ie(xt=>({...xt,[ve]:de}));},className:f("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",l?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:c==="es"?"MENOS":"LESS"})]})})(),jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let Ae=ve>=28,ot=ve%7>=5;return jsxs("div",{className:"relative",children:[jsx("button",{onClick:ne=>{ne.stopPropagation(),Ce===ve?Me(null):(Me(ve),ye(""),We(void 0),vt(null),Pe(null),mt(false),le(false),at(false),Fe(E.date));},className:f("w-5 h-5 rounded flex items-center justify-center transition-all",Ce===ve?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",l?"hover:bg-[#7C3AED] text-[#6B7280] hover:text-white":"hover:bg-[#7C3AED] text-gray-400 hover:text-white"),children:jsx(Plus,{className:f("w-3.5 h-3.5 transition-transform",Ce===ve&&"rotate-45")})}),jsx(AnimatePresence,{children:Ce===ve&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Me(null),ye(""),We(void 0),vt(null),Pe(null),mt(false),le(false),at(false);}}),jsxs(motion.div,{initial:{opacity:0,y:Ae?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:Ae?-5:5,scale:.95},transition:{duration:.12},className:f("absolute w-[320px] rounded-lg shadow-2xl z-50",Ae?"bottom-full mb-1":"top-full mt-1",ot?"right-0":"left-0",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:ne=>{ne.stopPropagation(),mt(false),le(false),at(false);},children:[jsx("div",{className:"p-2.5",children:jsx("input",{type:"text",value:Oe,onChange:ne=>ye(ne.target.value),placeholder:c==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:f("w-full bg-transparent text-sm outline-none placeholder:opacity-40",l?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:ne=>{if(ne.key==="Enter"&&Oe.trim()){let Re=t.availableUsers?.find(Le=>Le.id===et),xt=xe||E.date;a.onTaskCreate?.({name:Oe.trim(),startDate:xt,endDate:xt,priority:Ye,assignees:Re?[Re]:void 0}),ye(""),We(void 0),vt(null),Pe(null),Me(null);}ne.key==="Escape"&&(Me(null),ye(""),We(void 0),vt(null),Pe(null));}})}),jsxs("div",{className:f("px-2.5 py-2 flex items-center justify-between border-t",l?"border-white/10":"border-gray-100"),children:[jsxs("div",{className:"flex items-center gap-1",children:[jsxs("div",{className:"relative",children:[jsx("button",{onClick:ne=>{ne.stopPropagation(),mt(!Mt),le(false);},className:f("p-1 rounded transition-colors",Ye?Ye==="urgent"||Ye==="high"?"text-red-400 bg-red-500/20":Ye==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":l?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsx(Flag,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:Mt&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:ne=>ne.stopPropagation(),children:[{id:"urgent",label:c==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:c==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:c==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:c==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:c==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(ne=>jsxs("button",{onClick:()=>{We(ne.id),mt(false);},className:f("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",Ye===ne.id&&(l?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:f("w-2 h-2 rounded-full",ne.color)}),jsx("span",{className:l?"text-white":"text-gray-900",children:ne.label})]},ne.id||"none"))})})]}),jsxs("div",{className:"relative",children:[jsxs("button",{onClick:ne=>{ne.stopPropagation(),at(!ze),mt(false),le(false),Fe(xe||E.date);},className:f("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",xe?"bg-[#7C3AED]/20 text-[#7C3AED]":l?"bg-white/5 text-[#9CA3AF] hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsx(CalendarDays,{className:"w-3 h-3"}),(xe||E.date).toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsx(AnimatePresence,{children:ze&&jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:ne=>ne.stopPropagation(),children:[jsx("div",{className:f("w-40 py-2 border-r",l?"border-white/10":"border-gray-200"),children:(()=>{let ne=new Date,Re=new Date(ne);Re.setDate(ne.getDate()+1);let xt=new Date(ne);xt.setDate(ne.getDate()+((6-ne.getDay()+7)%7||7));let Le=new Date(ne);Le.setDate(ne.getDate()+((1-ne.getDay()+7)%7||7));let At=new Date(ne);At.setDate(ne.getDate()+14);let st=new Date(ne);return st.setDate(ne.getDate()+28),[{label:c==="es"?"Hoy":"Today",date:ne,display:ne.toLocaleDateString(c==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:c==="es"?"Ma\xF1ana":"Tomorrow",date:Re,display:Re.toLocaleDateString(c==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:c==="es"?"Este fin de semana":"This weekend",date:xt,display:c==="es"?"s\xE1b.":"sat."},{label:c==="es"?"Pr\xF3xima semana":"Next week",date:Le,display:c==="es"?"lun.":"mon."},{label:c==="es"?"2 semanas":"2 weeks",date:At,display:At.toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:c==="es"?"4 semanas":"4 weeks",date:st,display:st.toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((zt,je)=>jsxs("button",{className:f("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",l?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{Pe(zt.date),at(false);},children:[jsx("span",{children:zt.label}),jsx("span",{className:f("text-[10px]",l?"text-[#6B7280]":"text-gray-400"),children:zt.display})]},je))})()}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("span",{className:f("text-xs font-medium",l?"text-white":"text-gray-900"),children:Et.toLocaleDateString(c==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{onClick:()=>Fe(new Date),className:f("px-1.5 py-0.5 rounded text-[10px] transition-colors",l?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:c==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>Fe(new Date(Et.getFullYear(),Et.getMonth()-1)),className:f("p-0.5 rounded",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-3.5 h-3.5"})}),jsx("button",{onClick:()=>Fe(new Date(Et.getFullYear(),Et.getMonth()+1)),className:f("p-0.5 rounded",l?"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:(c==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(ne=>jsx("div",{className:f("w-6 h-6 flex items-center justify-center text-[10px]",l?"text-[#6B7280]":"text-gray-400"),children:ne},ne))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let ne=Et.getFullYear(),Re=Et.getMonth(),xt=new Date(ne,Re,1).getDay(),Le=new Date(ne,Re+1,0).getDate(),At=new Date(ne,Re,0).getDate(),st=new Date,ga=[];for(let je=xt-1;je>=0;je--)ga.push({dayNum:At-je,isCurrentMonth:false,date:new Date(ne,Re-1,At-je)});for(let je=1;je<=Le;je++)ga.push({dayNum:je,isCurrentMonth:true,date:new Date(ne,Re,je)});let zt=42-ga.length;for(let je=1;je<=zt;je++)ga.push({dayNum:je,isCurrentMonth:false,date:new Date(ne,Re+1,je)});return ga.map((je,kt)=>{let ia=je.date.toDateString()===st.toDateString(),vr=(xe||E.date).toDateString()===je.date.toDateString();return jsx("button",{className:f("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!je.isCurrentMonth&&(l?"text-[#4B5563]":"text-gray-300"),je.isCurrentMonth&&(l?"text-white":"text-gray-900"),ia&&"ring-1 ring-[#3B82F6]",vr&&"bg-[#7C3AED] text-white",!vr&&(l?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{Pe(je.date),at(false);},children:je.dayNum},kt)})})()})]})]})})]}),jsxs("div",{className:"relative",children:[jsx("button",{onClick:ne=>{ne.stopPropagation(),le(!O),mt(false);},className:f("p-1 rounded transition-colors",et?"text-[#7C3AED] bg-[#7C3AED]/20":l?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:et?jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-medium",style:{backgroundColor:t.availableUsers?.find(ne=>ne.id===et)?.color||"#7C3AED"},children:t.availableUsers?.find(ne=>ne.id===et)?.initials||t.availableUsers?.find(ne=>ne.id===et)?.name?.slice(0,2).toUpperCase()}):jsx(User,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:O&&jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:ne=>ne.stopPropagation(),children:[jsxs("button",{onClick:()=>{vt(null),le(false);},className:f("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",!et&&(l?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:f("w-5 h-5 rounded-full flex items-center justify-center",l?"bg-white/10":"bg-gray-200"),children:jsx(User,{className:"w-3 h-3 text-gray-400"})}),jsx("span",{className:l?"text-[#9CA3AF]":"text-gray-500",children:c==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(ne=>jsxs("button",{onClick:()=>{vt(ne.id),le(false);},className:f("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",et===ne.id&&(l?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-white text-[9px] font-medium",style:{backgroundColor:ne.color||"#7C3AED"},children:ne.initials||ne.name?.slice(0,2).toUpperCase()}),jsx("span",{className:l?"text-white":"text-gray-900",children:ne.name})]},ne.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsx("div",{className:f("px-3 py-2 text-xs",l?"text-[#6B7280]":"text-gray-400"),children:c==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsx("button",{onClick:()=>{if(Oe.trim()){let ne=t.availableUsers?.find(xt=>xt.id===et),Re=xe||E.date;a.onTaskCreate?.({name:Oe.trim(),startDate:Re,endDate:Re,priority:Ye,assignees:ne?[ne]:void 0}),ye(""),We(void 0),vt(null),Pe(null),Me(null);}},disabled:!Oe.trim(),className:f("px-2.5 py-1 rounded text-xs font-medium transition-colors",Oe.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":l?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:c==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsx("span",{className:f("text-sm font-medium",E.isToday?"text-[#3B82F6]":E.isCurrentMonth?l?"text-white":"text-gray-900":l?"text-[#6B7280]":"text-gray-400"),children:E.date.getDate()})]})]},ve)})})]})}),jsx(AnimatePresence,{children:k&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>{w(null),ee("");},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:f("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",l?"bg-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxs("div",{className:f("px-6 py-3 border-b flex items-center gap-3",l?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Circle,{className:f("w-4 h-4",l?"text-[#9CA3AF]":"text-gray-500")}),jsxs("span",{className:f("text-xs px-2 py-0.5 rounded",l?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[c==="es"?"Tarea":"Task"," \u2228"]}),jsx("span",{className:f("text-xs font-mono",l?"text-[#6B7280]":"text-gray-400"),children:k.id.slice(0,8)}),jsxs("button",{className:f("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",l?"bg-purple-500/20 text-purple-400 hover:bg-purple-500/30":"bg-purple-100 text-purple-700 hover:bg-purple-200"),children:[jsx(Sparkles,{className:"w-3 h-3"}),"Ask AI"]})]}),jsx("div",{className:"flex-1"}),jsx("button",{className:f("p-1.5 rounded transition-colors",l?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(Maximize2,{className:"w-4 h-4"})}),jsx("button",{className:f("p-1.5 rounded transition-colors",l?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(MoreHorizontal,{className:"w-5 h-5"})}),jsx("button",{onClick:()=>{w(null),ee("");},className:f("p-1.5 rounded transition-colors",l?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-5 h-5"})})]}),jsx("div",{className:"px-6 py-4",children:jsxs("div",{className:"flex items-start gap-3",children:[jsx("button",{onClick:()=>{let E=k.progress===100?0:100,q={...k,progress:E,status:E===100?"completed":"todo"};w(q),a.onTaskUpdate?.(q);},className:f("mt-1 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors",k.progress===100?"bg-green-500 border-green-500":l?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:k.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("h2",{className:f("text-xl font-semibold flex-1",k.progress===100?"line-through text-[#6B7280]":l?"text-white":"text-gray-900"),children:k.name})]})}),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:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Estado":"Status"}),jsx("button",{onClick:()=>{He(),J(!$);},className:f("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",k.progress===100||k.status==="completed"?"bg-green-500/20 text-green-400":k.progress&&k.progress>0||k.status==="in-progress"?"bg-blue-500/20 text-blue-400":l?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:k.progress===100||k.status==="completed"?c==="es"?"COMPLETADO":"DONE":k.progress&&k.progress>0||k.status==="in-progress"?c==="es"?"EN PROGRESO":"IN PROGRESS":c==="es"?"POR HACER":"TO DO"}),jsx(AnimatePresence,{children:$&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>J(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:c==="es"?"Por hacer":"To Do",color:"bg-white/10 text-white"},{id:"in-progress",label:c==="es"?"En progreso":"In Progress",color:"bg-blue-500/20 text-blue-400"},{id:"completed",label:c==="es"?"Completado":"Done",color:"bg-green-500/20 text-green-400"}].map(E=>jsxs("button",{onClick:()=>Ee(E.id),className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",(k.status===E.id||E.id==="completed"&&k.progress===100||E.id==="in-progress"&&k.progress&&k.progress>0&&k.progress<100||E.id==="todo"&&(!k.progress||k.progress===0)&&k.status!=="in-progress"&&k.status!=="completed")&&(l?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:f("w-2 h-2 rounded-full",E.id==="completed"?"bg-green-500":E.id==="in-progress"?"bg-blue-500":"bg-gray-400")}),jsx("span",{className:l?"text-white":"text-gray-900",children:E.label})]},E.id))})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(User,{className:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Asignados":"Assignees"}),jsxs("button",{onClick:()=>{J(false),G(false),I(null),Q(!A);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[k.assignees&&k.assignees.length>0?jsxs("div",{className:"flex items-center gap-1",children:[k.assignees.slice(0,3).map((E,ve)=>jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:E.color||"#8B5CF6"},title:E.name,children:E.initials||E.name.slice(0,2).toUpperCase()},ve)),k.assignees.length>3&&jsxs("span",{className:f("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:["+",k.assignees.length-3]})]}):jsx("span",{className:f("text-sm",l?"text-[#6B7280]":"text-gray-400"),children:c==="es"?"Agregar":"Add"}),jsx(ChevronDown,{className:f("w-3 h-3",l?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:A&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Q(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:t.availableUsers&&t.availableUsers.length>0?t.availableUsers.map(E=>{let ve=k.assignees?.some(q=>q.name===E.name);return jsxs("button",{onClick:()=>{let q=k.assignees||[],Ae;ve?Ae=q.filter(ot=>ot.name!==E.name):Ae=[...q,{name:E.name,avatar:E.avatar,initials:E.initials||E.name.slice(0,2).toUpperCase(),color:E.color||"#8B5CF6"}],ae("assignees",Ae);},className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",l?"hover:bg-white/5":"hover:bg-gray-50",ve&&(l?"bg-white/5":"bg-gray-50")),children:[E.avatar?jsx("img",{src:E.avatar,alt:E.name,className:"w-6 h-6 rounded-full object-cover"}):jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:E.color||"#8B5CF6"},children:E.initials||E.name.slice(0,2).toUpperCase()}),jsx("span",{className:f("flex-1 text-left",l?"text-white":"text-gray-900"),children:E.name}),ve&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},E.id||E.name)}):jsx("div",{className:f("px-3 py-4 text-sm text-center",l?"text-[#6B7280]":"text-gray-400"),children:c==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CalendarDays,{className:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Fechas":"Dates"}),jsxs("button",{onClick:()=>{I(D?null:"start"),K(k.startDate||new Date);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[k.startDate?.toLocaleDateString(c==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(c==="es"?"Inicio":"Start"),jsx("span",{className:f("mx-1",l?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),k.endDate?.toLocaleDateString(c==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(c==="es"?"Fin":"End"),(k.startDate||k.endDate)&&jsx(X,{className:"w-3.5 h-3.5 ml-1 opacity-50 hover:opacity-100",onClick:E=>{E.stopPropagation();}})]}),jsx(AnimatePresence,{children:D&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>I(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:f("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:E=>E.stopPropagation(),children:[jsxs("div",{className:f("w-44 py-2 border-r",l?"border-white/10":"border-gray-200"),children:[(()=>{let E=new Date,ve=new Date(E);ve.setDate(E.getDate()+1);let q=new Date(E);q.setDate(E.getDate()+((6-E.getDay()+7)%7||7));let Ae=new Date(E);Ae.setDate(E.getDate()+((1-E.getDay()+7)%7||7));let ot=new Date(E);ot.setDate(E.getDate()+(6-E.getDay()+7)%7+7);let ne=new Date(E);ne.setDate(E.getDate()+14);let Re=new Date(E);return Re.setDate(E.getDate()+28),[{label:c==="es"?"Hoy":"Today",date:E,display:E.toLocaleDateString(c==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:c==="es"?"Ma\xF1ana":"Tomorrow",date:ve,display:ve.toLocaleDateString(c==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:c==="es"?"Este fin de semana":"This weekend",date:q,display:c==="es"?"s\xE1b.":"sat."},{label:c==="es"?"Pr\xF3xima semana":"Next week",date:Ae,display:c==="es"?"lun.":"mon."},{label:c==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:ot,display:ot.toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:c==="es"?"2 semanas":"2 weeks",date:ne,display:ne.toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:c==="es"?"4 semanas":"4 weeks",date:Re,display:Re.toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Le,At)=>jsxs("button",{className:f("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",l?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(D==="start"){let st=k.endDate&&Le.date>k.endDate?Le.date:k.endDate;Ue(Le.date,st),I("end");}else {let st=k.startDate&&Le.date<k.startDate?Le.date:k.startDate;Ue(st,Le.date),I(null);}},children:[jsx("span",{children:Le.label}),jsx("span",{className:f("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:Le.display})]},At))})(),jsx("div",{className:f("border-t mt-2 pt-2",l?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{Ue(void 0,void 0),I(null);},className:f("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",l?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:c==="es"?"Quitar fechas":"Clear dates"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[jsx("div",{className:f("text-xs mb-3 px-2 py-1 rounded",l?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:D==="start"?c==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":c==="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:f("font-medium",l?"text-white":"text-gray-900"),children:B.toLocaleDateString(c==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>K(new Date),className:f("p-1 rounded text-sm transition-colors",l?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:c==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>K(new Date(B.getFullYear(),B.getMonth()-1)),className:f("p-1 rounded",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-4 h-4"})}),jsx("button",{onClick:()=>K(new Date(B.getFullYear(),B.getMonth()+1)),className:f("p-1 rounded",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:"w-4 h-4"})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(c==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(E=>jsx("div",{className:f("w-8 h-8 flex items-center justify-center text-xs",l?"text-[#6B7280]":"text-gray-400"),children:E},E))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let E=B.getFullYear(),ve=B.getMonth(),q=new Date(E,ve,1).getDay(),Ae=new Date(E,ve+1,0).getDate(),ot=new Date(E,ve,0).getDate(),ne=new Date,Re=[];for(let Le=q-1;Le>=0;Le--)Re.push({day:ot-Le,isCurrentMonth:false,date:new Date(E,ve-1,ot-Le)});for(let Le=1;Le<=Ae;Le++)Re.push({day:Le,isCurrentMonth:true,date:new Date(E,ve,Le)});let xt=42-Re.length;for(let Le=1;Le<=xt;Le++)Re.push({day:Le,isCurrentMonth:false,date:new Date(E,ve+1,Le)});return Re.map((Le,At)=>{let st=Le.date.toDateString()===ne.toDateString(),ga=k.startDate?.toDateString()===Le.date.toDateString(),zt=k.endDate?.toDateString()===Le.date.toDateString(),je=ga||zt,kt=k.startDate&&k.endDate&&Le.date>=k.startDate&&Le.date<=k.endDate;return jsx("button",{className:f("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!Le.isCurrentMonth&&(l?"text-[#4B5563]":"text-gray-300"),Le.isCurrentMonth&&(l?"text-white":"text-gray-900"),st&&"ring-2 ring-[#3B82F6]",ga&&"bg-[#3B82F6] text-white",zt&&!ga&&"bg-[#7C3AED] text-white",kt&&!je&&(l?"bg-[#7C3AED]/20":"bg-purple-100"),!je&&(l?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{let ia=new Date(Le.date);if(D==="start"){let vr=k.endDate&&ia>k.endDate?ia:k.endDate;Ue(ia,vr),I("end");}else {let vr=k.startDate&&ia<k.startDate?ia:k.startDate;Ue(vr,ia),I(null);}},children:Le.day},At)})})()})]})]})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Flag,{className:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Prioridad":"Priority"}),jsx("button",{onClick:()=>{He(),G(!U);},className:f("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",k.priority==="high"||k.priority==="urgent"?"bg-red-500/20 text-red-400":k.priority==="medium"?"bg-yellow-500/20 text-yellow-400":k.priority==="low"?"bg-green-500/20 text-green-400":l?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:k.priority?k.priority==="high"||k.priority==="urgent"?c==="es"?"Urgente":"Urgent":k.priority==="medium"?c==="es"?"Media":"Medium":c==="es"?"Baja":"Low":c==="es"?"Sin prioridad":"No priority"}),jsx(AnimatePresence,{children:U&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>G(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:c==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:c==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:c==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:c==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:c==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(E=>jsxs("button",{onClick:()=>{ae("priority",E.id),G(false);},className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",k.priority===E.id&&(l?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:f("w-2 h-2 rounded-full",E.color)}),jsx("span",{className:l?"text-white":"text-gray-900",children:E.label})]},E.id||"none"))})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Duraci\xF3n":"Duration"}),jsx("span",{className:f("text-sm",l?"text-white":"text-gray-900"),children:k.startDate&&k.endDate?`${Math.ceil((k.endDate.getTime()-k.startDate.getTime())/(1e3*60*60*24))} ${c==="es"?"d\xEDas":"days"}`:c==="es"?"Sin definir":"Not set"})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:f("w-4 h-4 rounded-full border-2",l?"border-[#6B7280]":"border-gray-400")}),jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Progreso":"Progress"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[X$1?jsx("input",{type:"range",min:"0",max:"100",step:"5",value:k.progress||0,onChange:E=>{let ve=parseInt(E.target.value),q=k.status;ve===100?q="completed":ve>0?q="in-progress":q="todo";let Ae={...k,progress:ve,status:q};w(Ae),a.onTaskUpdate?.(Ae);},onBlur:()=>H(false),className:f("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",l?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsx("button",{onClick:()=>H(true),className:f("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",l?"bg-white/10":"bg-gray-200"),children:jsx("div",{className:f("h-full rounded-full transition-all",k.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${k.progress||0}%`}})}),jsxs("span",{className:f("text-sm font-medium min-w-[40px]",l?"text-white":"text-gray-900"),children:[k.progress||0,"%"]})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Tag,{className:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Etiquetas":"Tags"}),jsx(nr,{selectedTags:k.tags||[],availableTags:m,onChange:E=>{ae("tags",E);},onCreateTag:i,theme:x})]}),jsxs("div",{className:"flex items-start gap-3 relative",children:[jsx(Link2,{className:f("w-4 h-4 mt-1.5",l?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-24 mt-1",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Relaciones":"Relations"}),jsxs("div",{className:"flex-1",children:[k.dependencies&&k.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:k.dependencies.map(E=>{let ve=e.find(q=>q.id===E);return jsxs("span",{className:f("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",l?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[ve?.name||E.slice(0,8),jsx("button",{onClick:()=>{let q=(k.dependencies||[]).filter(Ae=>Ae!==E);ae("dependencies",q);},className:f("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsx(X,{className:"w-3 h-3"})})]},E)})}),jsxs("button",{onClick:()=>{He(),Ea(!Jt);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{className:f("text-sm",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Agregar dependencia":"Add dependency"})]}),jsx(AnimatePresence,{children:Jt&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Ea(false),ue("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsx("div",{className:f("p-2 border-b",l?"border-white/10":"border-gray-200"),children:jsx("input",{type:"text",value:oe,onChange:E=>ue(E.target.value),placeholder:c==="es"?"Buscar tarea...":"Search task...",className:f("w-full px-3 py-2 rounded-md text-sm outline-none",l?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsx("div",{className:"max-h-[240px] overflow-y-auto",children:e.length>0?e.filter(E=>E.id!==k.id).filter(E=>oe===""||E.name.toLowerCase().includes(oe.toLowerCase())).map(E=>{let ve=k.dependencies?.includes(E.id);return jsxs("button",{onClick:()=>{let q=k.dependencies||[],Ae;ve?Ae=q.filter(ot=>ot!==E.id):Ae=[...q,E.id],ae("dependencies",Ae);},className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",ve&&(l?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:f("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",ve?"bg-blue-500 border-blue-500":l?"border-white/30":"border-gray-300"),children:ve&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:f("block truncate",l?"text-white":"text-gray-900"),children:E.name}),jsx("span",{className:f("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:E.id.slice(0,8)})]})]},E.id)}):jsx("div",{className:f("px-3 py-4 text-sm text-center",l?"text-[#6B7280]":"text-gray-500"),children:c==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Palette,{className:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxs("button",{onClick:()=>{He(),ya(!pa);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:k.color||"#6366F1"}}),jsx("span",{className:f("text-sm",l?"text-white":"text-gray-900"),children:sr.find(E=>E.value===k.color)?.name||(c==="es"?"Azul":"Blue")}),jsx(ChevronDown,{className:f("w-3 h-3",l?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:pa&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ya(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-6 gap-1.5",children:sr.map(E=>{let ve=k.color===E.value;return jsx("button",{onClick:()=>{ae("color",E.value),ya(false);},className:f("w-7 h-7 rounded-full flex items-center justify-center transition-all",ve&&"ring-2 ring-offset-2",l?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:E.value,outlineColor:ve?E.value:void 0},title:E.name,children:ve&&jsx(Check,{className:"w-3.5 h-3.5 text-white"})},E.value)})})})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Diamond,{className:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Hito":"Milestone"}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",checked:k.isMilestone||false,onChange:E=>ae("isMilestone",E.target.checked),className:f("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",k.isMilestone?"bg-purple-500 border-purple-500":l?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsx("span",{className:f("text-sm",l?"text-white":"text-gray-900"),children:c==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxs("div",{className:f("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsx(FileText,{className:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsx("h3",{className:f("text-sm font-semibold",l?"text-white":"text-gray-900"),children:c==="es"?"Descripci\xF3n":"Description"})]}),jsx("textarea",{value:k.description||"",onChange:E=>ae("description",E.target.value),placeholder:c==="es"?"Agregar descripci\xF3n...":"Add description...",className:f("w-full min-h-[100px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors",l?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")}),jsxs("button",{className:f("flex items-center gap-2 text-sm mt-2 transition-colors",l?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsx(Sparkles,{className:"w-4 h-4"}),c==="es"?"Escribe con IA":"Write with AI"]})]}),jsxs("div",{className:f("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsx("h3",{className:f("text-sm font-semibold mb-3",l?"text-white":"text-gray-900"),children:c==="es"?"Campos personalizados":"Custom fields"}),jsxs("button",{className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsx(Plus,{className:"w-4 h-4"}),c==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxs("div",{className:f("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsx("h3",{className:f("text-sm font-semibold mb-3",l?"text-white":"text-gray-900"),children:c==="es"?"Agregar subtarea":"Add subtask"}),k.subtasks&&k.subtasks.length>0&&jsx("div",{className:"space-y-2 mb-3",children:k.subtasks.map(E=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:f("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",E.progress===100?"bg-green-500 border-green-500":l?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:E.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("span",{className:f("text-sm",E.progress===100?"line-through text-[#6B7280]":l?"text-white":"text-gray-900"),children:E.name})]},E.id))}),jsxs("button",{className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsx(Plus,{className:"w-4 h-4"}),c==="es"?"Add Tarea":"Add Task"]})]}),jsxs("div",{className:f("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("h3",{className:f("text-sm font-semibold",l?"text-white":"text-gray-900"),children:c==="es"?"Listas de control":"Checklists"}),jsx("button",{className:f("p-1 rounded transition-colors",l?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsx(Plus,{className:"w-4 h-4"})})]}),jsxs("button",{className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsx(ListChecks,{className:"w-4 h-4"}),c==="es"?"Crear lista de control":"Create checklist"]})]}),jsxs("div",{className:f("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:f("text-sm font-semibold mb-3",l?"text-white":"text-gray-900"),children:[c==="es"?"Adjuntos":"Attachments",ua.length>0&&jsxs("span",{className:f("ml-2 text-xs font-normal",l?"text-[#6B7280]":"text-gray-400"),children:["(",ua.length,")"]})]}),ua.length>0&&jsx("div",{className:"space-y-2 mb-4",children:ua.map(E=>{let ve=va(E.type),q=E.type.startsWith("image/");return jsxs("div",{className:f("flex items-center gap-3 p-2 rounded-lg group transition-colors",l?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[q&&E.thumbnailUrl?jsx("img",{src:E.thumbnailUrl,alt:E.name,className:"w-10 h-10 rounded object-cover"}):jsx("div",{className:f("w-10 h-10 rounded flex items-center justify-center",l?"bg-white/10":"bg-gray-200"),children:jsx(ve,{className:f("w-5 h-5",l?"text-[#9CA3AF]":"text-gray-500")})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("a",{href:E.url,target:"_blank",rel:"noopener noreferrer",className:f("text-sm font-medium truncate block hover:underline",l?"text-white":"text-gray-900"),children:E.name}),jsx("p",{className:f("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:Je(E.size)})]}),a.onDeleteAttachment&&jsx("button",{onClick:()=>a.onDeleteAttachment?.(E.id),className:f("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",l?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:c==="es"?"Eliminar":"Delete",children:jsx(Trash2,{className:"w-4 h-4"})})]},E.id)})}),jsxs("div",{onDragOver:Ie,onDragLeave:Dt,onDrop:W,className:f("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",Xt?l?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":l?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",Nt&&"pointer-events-none opacity-50"),children:[jsx("input",{type:"file",multiple:true,onChange:ce,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!a.onUploadAttachments||Nt}),Nt?jsxs(Fragment,{children:[jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),jsx("p",{className:f("text-sm",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Subiendo...":"Uploading..."})]}):jsxs(Fragment,{children:[jsx(Upload,{className:f("w-6 h-6 mx-auto mb-2",Xt?"text-blue-500":l?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:f("text-sm",l?"text-[#9CA3AF]":"text-gray-500"),children:Xt?c==="es"?"Suelta los archivos aqu\xED":"Drop files here":c==="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"})]})}),!a.onUploadAttachments&&jsx("p",{className:f("text-xs mt-1",l?"text-[#6B7280]":"text-gray-400"),children:c==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxs("div",{className:f("w-80 border-l flex flex-col",l?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsx("div",{className:f("px-4 py-3 border-b",l?"border-white/10":"border-gray-200"),children:jsxs("h3",{className:f("text-sm font-semibold",l?"text-white":"text-gray-900"),children:[c==="es"?"Actividad":"Activity",d&&d.length>0&&jsxs("span",{className:f("ml-2 text-xs font-normal",l?"text-[#6B7280]":"text-gray-400"),children:["(",d.length,")"]})]})}),jsx("div",{className:"flex-1 overflow-y-auto p-4",children:d&&d.length>0?jsx("div",{className:"space-y-4",children:d.map(E=>{let ve=(()=>{let q=new Date,Ae=new Date(E.createdAt),ot=q.getTime()-Ae.getTime(),ne=Math.floor(ot/6e4),Re=Math.floor(ne/60),xt=Math.floor(Re/24);return ne<1?c==="es"?"ahora":"now":ne<60?c==="es"?`hace ${ne}m`:`${ne}m ago`:Re<24?c==="es"?`hace ${Re}h`:`${Re}h ago`:c==="es"?`hace ${xt}d`:`${xt}d ago`})();return jsxs("div",{className:"flex gap-3",children:[jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:"#8B5CF6"},children:E.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:f("text-sm font-medium",l?"text-white":"text-gray-900"),children:E.user?.name||(c==="es"?"Usuario":"User")}),jsx("span",{className:f("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:ve})]}),jsx("p",{className:f("text-sm break-words",l?"text-[#9CA3AF]":"text-gray-600"),children:E.content})]})]},E.id)})}):jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsx(MessageSquare,{className:f("w-10 h-10 mb-3",l?"text-[#3B4252]":"text-gray-300")}),jsx("p",{className:f("text-sm",l?"text-[#6B7280]":"text-gray-500"),children:c==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsx("div",{className:f("p-4 border-t",l?"border-white/10":"border-gray-200"),children:jsxs("div",{className:"flex items-start gap-2",children:[h&&jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:h.color||"#8B5CF6"},children:h.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:f("flex-1 flex items-center gap-2 px-3 py-2 rounded-lg",l?"bg-white/5":"bg-white border border-gray-200"),children:[jsx("input",{type:"text",value:N,onChange:E=>ee(E.target.value),onKeyDown:async E=>{if(E.key==="Enter"&&!E.shiftKey&&k&&N.trim()&&g){E.preventDefault(),De(true);try{await g(k.id,N.trim()),ee("");}finally{De(false);}}},placeholder:c==="es"?"Escribe un comentario...":"Write a comment...",disabled:se||!g,className:f("flex-1 bg-transparent text-sm outline-none",l?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400",(se||!g)&&"opacity-50")}),jsx("button",{onClick:async()=>{if(k&&N.trim()&&g){De(true);try{await g(k.id,N.trim()),ee("");}finally{De(false);}}},disabled:se||!N.trim()||!g,className:f("p-1.5 rounded transition-colors",N.trim()&&g?"bg-blue-500 text-white hover:bg-blue-600":l?"text-[#6B7280]":"text-gray-400",se&&"opacity-50 cursor-not-allowed"),children:se?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:R&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>M(null),className:"fixed inset-0 bg-black/30 z-40"}),jsxs(motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:f("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",l?"bg-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:f("px-4 py-3 border-b flex items-center justify-between",l?"border-white/10":"border-gray-200"),children:[jsx("span",{className:f("font-medium",l?"text-white":"text-gray-900"),children:R.date.toLocaleDateString(c==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsx("button",{onClick:()=>M(null),className:f("p-1 rounded",l?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-4 h-4"})})]}),jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-2",children:R.events.map(E=>jsxs("button",{onClick:()=>{M(null),w(E.task),C?.(E.task.id);},className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",l?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx(jc,{task:E.task}),jsx("span",{className:f("text-sm truncate flex-1",l?"text-white":"text-gray-900"),children:E.title}),E.task.priority==="high"||E.task.priority==="urgent"?jsx(Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},E.id))})]})]})})]})}var Ui={bgPrimary:"#0d1117",bgSecondary:"#161b22",bgHover:"#21262d",bgToday:"#1f6feb20",bgWeekend:"#161b2280",bgOtherMonth:"#0d111750",border:"#30363d",borderLight:"#21262d",textPrimary:"#c9d1d9",textSecondary:"#8b949e",textMuted:"#6e7681",textToday:"#58a6ff",accent:"#58a6ff",accentHover:"#79b8ff",accentLight:"#58a6ff20",statusTodo:"#8b949e",statusInProgress:"#f0883e",statusCompleted:"#3fb950",focusRing:"#58a6ff"},Hi={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"},Wi={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"},Vn={dark:Ui,light:Hi,neutral:Wi};function qc(e){return Vn[e]||Vn.dark}function hh({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:p}){let[m,i]=useState(false),u=useMemo(()=>t.filter(h=>e.cardIds.includes(h.id)),[t,e.cardIds]),d=useMemo(()=>{let h=u.length,C=new Set(u.flatMap(b=>b.assignedUserIds||[])).size,T=u.map(b=>b.priority).filter(Boolean),c=new Set(u.flatMap(b=>b.labels||[])).size;return {totalCards:h,uniqueAssignees:C,priorities:T,labels:c}},[u]),g=()=>{o?.(e.id);};return jsxs("div",{className:f("card-stack",!e.isExpanded&&"card-stack-collapsed",p),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxs("div",{className:"card-stack-header",onClick:g,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:f("card-stack-chevron",e.isExpanded&&"expanded"),children:jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsx("h3",{className:"card-stack-title",children:e.title}),jsx("div",{className:"card-stack-badge",children:d.totalCards}),jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),m&&jsx("div",{className:"card-stack-actions",children:jsx("button",{className:"card-stack-action",onClick:h=>{h.stopPropagation(),n?.(e.id);},"aria-label":"Delete stack",children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxs("div",{className:"card-stack-summary",children:[jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxs("span",{children:[d.uniqueAssignees," assignees"]})]}),d.labels>0&&jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxs("span",{children:[d.labels," labels"]})]}),e.confidence&&jsx("div",{className:"card-stack-summary-item",children:jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsx("div",{className:"card-stack-content",children: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(h=>jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsx("div",{onClick:()=>r?.(h),children:a(h)}):jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(h),children:[jsx("h4",{children:h.title}),h.description&&jsxs("p",{children:[h.description.substring(0,100),"..."]})]}),jsx("button",{className:"card-stack-unstack-btn",onClick:C=>{C.stopPropagation(),s?.(e.id,h.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"})]})})]},h.id))})})]})}var Jc={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function Vo(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 jo(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 Qc(e){return {created:"#10b981",status_changed:"#3b82f6",assignee_changed:"#8b5cf6",priority_changed:"#f59e0b",moved:"#06b6d4",title_updated:"#6366f1",description_updated:"#6366f1",dates_changed:"#ec4899",labels_changed:"#14b8a6",dependency_added:"#a855f7",dependency_removed:"#ef4444",comment_added:"#84cc16",archived:"#6b7280",restored:"#10b981"}[e]||"#6b7280"}function Zc({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:p}){let m=useMemo(()=>({...Jc,...n}),[n]),[i,u]=useState(new Set),d=useRef(null),g=useMemo(()=>{if(!m.groupByDay)return [{date:null,events:e}];let y=new Map;return e.forEach(l=>{let x=l.timestamp.toISOString().split("T")[0],v=y.get(x);v?v.push(l):y.set(x,[l]);}),Array.from(y.entries()).sort((l,x)=>x[0].localeCompare(l[0])).map(([l,x])=>({date:new Date(l),events:x.sort((v,S)=>S.timestamp.getTime()-v.timestamp.getTime())}))},[e,m.groupByDay]),{uniqueUsers:h,uniqueTypes:C}=useMemo(()=>{let y=new Set,l=new Set;return e.forEach(x=>{y.add(x.userId),l.add(x.type);}),{uniqueUsers:Array.from(y),uniqueTypes:Array.from(l)}},[e]),T=y=>{u(l=>{let x=new Set(l);return x.has(y)?x.delete(y):x.add(y),x});},c=y=>{let x=new Date().getTime()-y.getTime(),v=Math.floor(x/6e4),S=Math.floor(x/36e5),k=Math.floor(x/864e5);return v<1?"just now":v<60?`${v}m ago`:S<24?`${S}h ago`:k<7?`${k}d ago`:y.toLocaleDateString()},b=useMemo(()=>{let y=0;return t.types&&t.types.length>0&&y++,t.users&&t.users.length>0&&y++,t.dateRange&&y++,t.searchTerm&&y++,y},[t]);return useEffect(()=>{if(s&&d.current){let y=d.current.querySelector(`[data-event-id="${s}"]`);y&&y.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxs("div",{className:f("history-timeline-empty",p),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:f("history-timeline",m.compact&&"compact",p),children:[jsxs("div",{className:"history-timeline-filters",children:[jsxs("div",{className:"history-timeline-filter-group",children:[jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:y=>{let l=y.target.value;a({...t,types:l?[l]:void 0});},children:[jsx("option",{value:"",children:"All Events"}),C.map(y=>jsxs("option",{value:y,children:[jo(y)," ",y.replace("_"," ")]},y))]}),h.length>1&&jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:y=>{let l=y.target.value;a({...t,users:l?[l]:void 0});},children:[jsx("option",{value:"",children:"All Users"}),h.map(y=>jsx("option",{value:y,children:y},y))]}),jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:y=>a({...t,searchTerm:y.target.value})})]}),b>0&&jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",b,")"]})]}),jsx("div",{className:"history-timeline-container",ref:d,children:g.map(y=>jsxs("div",{className:"history-timeline-group",children:[m.groupByDay&&y.date&&jsxs("div",{className:"history-timeline-day-header",children:[jsx("span",{className:"history-timeline-day-date",children:y.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxs("span",{className:"history-timeline-day-count",children:[y.events.length," events"]})]}),jsx("div",{className:"history-timeline-events",children:y.events.map((l,x)=>{let v=i.has(l.id),S=s===l.id,k=Qc(l.type);return jsxs("div",{"data-event-id":l.id,className:f("history-timeline-event",v&&"expanded",S&&"selected"),onClick:()=>o?.(l),children:[jsxs("div",{className:"history-timeline-line",children:[jsx("div",{className:"history-timeline-dot",style:{backgroundColor:k},children:m.showIcons&&jsx("span",{className:"history-timeline-dot-icon",children:jo(l.type)})}),x<y.events.length-1&&jsx("div",{className:"history-timeline-connector",style:{borderColor:k}})]}),jsxs("div",{className:"history-timeline-event-content",children:[jsxs("div",{className:"history-timeline-event-header",children:[jsxs("div",{className:"history-timeline-event-header-left",children:[m.showAvatars&&l.userAvatar&&jsx("img",{src:l.userAvatar,alt:l.userName||l.userId,className:"history-timeline-event-avatar"}),jsxs("div",{className:"history-timeline-event-description",children:[jsx("span",{className:"history-timeline-event-user",children:l.userName||l.userId}),jsx("span",{className:"history-timeline-event-action",children:Vo(l)})]})]}),jsx("div",{className:"history-timeline-event-time",children:m.useRelativeTime?c(l.timestamp):l.timestamp.toLocaleString()})]}),Object.keys(l.changes).length>0&&jsxs("button",{className:"history-timeline-event-toggle",onClick:w=>{w.stopPropagation(),T(l.id);},children:[v?"\u25BC":"\u25B6"," Show changes"]}),v&&jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(l.changes).map(([w,R])=>jsxs("div",{className:"history-timeline-event-change",children:[jsxs("span",{className:"history-timeline-event-change-key",children:[w,":"]}),jsxs("div",{className:"history-timeline-event-change-values",children:[jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(R.from)}),jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(R.to)})]})]},w)),l.metadata&&Object.keys(l.metadata).length>0&&jsxs("div",{className:"history-timeline-event-metadata",children:[jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(l.metadata).map(([w,R])=>jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxs("span",{className:"history-timeline-event-metadata-key",children:[w,":"]}),jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(R)})]},w))]})]})]})]},l.id)})})]},y.date?.toISOString()||"all"))})]})}function tm({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:p,onSpeedChange:m,className:i}){let u=[.5,1,1.5,2,3],d=useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),g=useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxs("div",{className:f("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:f("history-replay",i),children:[jsxs("div",{className:"history-replay-current-event",children:[jsx("div",{className:"history-replay-event-icon",children:d&&jo(d.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:d&&Vo(d)}),jsxs("div",{className:"history-replay-event-meta",children:[jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsx("span",{className:"history-replay-event-time",children:d&&d.timestamp.toLocaleString()})]})]})]}),jsxs("div",{className:"history-replay-progress-container",children:[jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:h=>p(parseInt(h.target.value))}),jsx("div",{className:"history-replay-progress-fill",style:{width:`${g}%`}}),jsx("div",{className:"history-replay-progress-markers",children:t.map((h,C)=>jsx("div",{className:f("history-replay-progress-marker",C===e.currentIndex&&"active"),style:{left:`${C/(e.totalEvents-1)*100}%`},onClick:()=>p(C),title:Vo(h)},h.id))})]}),jsxs("div",{className:"history-replay-controls",children:[jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:o,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsx("button",{className:"history-replay-control-btn",onClick:n,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxs("div",{className:"history-replay-speed",children:[jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsx("div",{className:"history-replay-speed-buttons",children:u.map(h=>jsxs("button",{className:f("history-replay-speed-btn",e.speed===h&&"active"),onClick:()=>m(h),children:[h,"x"]},h))})]}),jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxs("div",{className:"history-replay-shortcuts",children:[jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2190"})," Previous"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2192"})," Next"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxs("div",{className:"history-replay-card-preview",children:[jsxs("div",{className:"history-replay-card-preview-header",children:[jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsx("span",{className:"history-replay-card-preview-time",children:d&&d.timestamp.toLocaleDateString()})]}),jsxs("div",{className:"history-replay-card-preview-content",children:[jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(h=>jsx("span",{className:"history-replay-card-preview-label-tag",children:h},h))})]})]})]})]}):jsxs("div",{className:f("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 Gi(e){return {blocks:"#ef4444",blocked_by:"#dc2626",depends_on:"#f59e0b",required_by:"#d97706",relates_to:"#6b7280",duplicates:"#8b5cf6",parent_of:"#3b82f6",child_of:"#2563eb",similar_to:"#10b981"}[e]||"#6b7280"}function _i(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 am(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 rm(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function wh(e,t,a,r,o,s=100){let n=e.map(m=>({...m,x:m.x??a/2+Math.random()*100-50,y:m.y??r/2+Math.random()*100-50,vx:0,vy:0})),p=new Map(n.map(m=>[m.id,m]));for(let m=0;m<s;m++){let i=1-m/s;n.forEach(u=>{let d=a/2,g=r/2;u.vx+=(d-u.x)*o.centerForce*i,u.vy+=(g-u.y)*o.centerForce*i,n.forEach(h=>{if(u.id===h.id)return;let C=u.x-h.x,T=u.y-h.y,c=Math.sqrt(C*C+T*T)||1,b=o.chargeStrength*i/(c*c);u.vx+=C/c*b,u.vy+=T/c*b;});}),t.forEach(u=>{let d=p.get(typeof u.source=="string"?u.source:u.source.id),g=p.get(typeof u.target=="string"?u.target:u.target.id);if(!d||!g)return;let h=g.x-d.x,C=g.y-d.y,T=Math.sqrt(h*h+C*C)||1,c=(T-o.linkDistance)/T*o.forceStrength*i;d.vx+=h*c,d.vy+=C*c,g.vx-=h*c,g.vy-=C*c;}),n.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(o.nodeSize,Math.min(a-o.nodeSize,u.x)),u.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,u.y)),u.vx*=.9,u.vy*=.9;});}return n}function om({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:p,className:m}){let i=useRef(null),[u,d]=useState([]),[g,h]=useState(null),[C,T]=useState(null),[c,b]=useState(null),[y,l]=useState(1),[x,v]=useState({x:0,y:0});useEffect(()=>{if(e.length===0)return;let B=wh(e,t,a.width,a.height,a,150);d(B);},[e,t,a]);let S=useCallback((B,K)=>{a.enableDragging&&(K.stopPropagation(),h(B));},[a.enableDragging]),k=useCallback(B=>{if(!g||!i.current)return;let te=i.current.getBoundingClientRect(),ie=(B.clientX-te.left-x.x)/y,de=(B.clientY-te.top-x.y)/y;d(be=>be.map($=>$.id===g?{...$,x:ie,y:de,fx:ie,fy:de}:$));},[g,y,x]),w=useCallback(()=>{h(null);},[]),R=useCallback((B,K)=>{K.stopPropagation(),p?.({type:"node-click",node:B,position:{x:K.clientX,y:K.clientY}});},[p]),M=useCallback((B,K)=>{K.stopPropagation(),p?.({type:"edge-click",edge:B,position:{x:K.clientX,y:K.clientY}});},[p]),D=useCallback(B=>{let K=u.find(te=>te.id===B);return K?{x:K.x,y:K.y}:{x:0,y:0}},[u]),I=useCallback(B=>{if(B.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return B.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let K=B.card.priority;return K==="URGENT"?"#ef4444":K==="HIGH"?"#f59e0b":K==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return B.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxs("div",{className:f("relationships-graph-empty",m),children:[jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxs("div",{className:f("relationships-graph",m),children:[jsxs("div",{className:"relationships-graph-controls",children:[jsxs("div",{className:"relationships-graph-stats",children:[jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:n.totalNodes}),jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:n.totalEdges}),jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>l(B=>Math.min(B+.2,3)),children:"+"}),jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(y*100),"%"]}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>l(B=>Math.max(B-.2,.5)),children:"\u2212"}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{l(1),v({x:0,y:0});},children:"Reset"})]})]}),jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(B=>B.type))).map(B=>jsxs("div",{className:"relationships-graph-legend-item",children:[jsx("div",{className:"relationships-graph-legend-color",style:{background:Gi(B)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[am(B)," ",_i(B)]})]},B))}),jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:k,onMouseUp:w,onMouseLeave:w,children:[jsxs("g",{transform:`translate(${x.x}, ${x.y}) scale(${y})`,children:[jsx("g",{className:"relationships-graph-edges",children:t.map(B=>{let K=D(typeof B.source=="string"?B.source:B.source.id),te=D(typeof B.target=="string"?B.target:B.target.id),ie=rm(B.type),de=c===B.id,be=B.onCriticalPath;return jsxs("g",{className:f("relationships-graph-edge",de&&"hovered",be&&"critical"),onMouseEnter:()=>b(B.id),onMouseLeave:()=>b(null),onClick:$=>M(B,$),children:[jsx("line",{x1:K.x,y1:K.y,x2:te.x,y2:te.y,stroke:Gi(B.type),strokeWidth:be?a.edgeWidth*2:a.edgeWidth,strokeOpacity:de?1:.6,markerEnd:ie?"url(#arrowhead)":void 0}),a.showEdgeLabels&&de&&jsx("text",{x:(K.x+te.x)/2,y:(K.y+te.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:_i(B.type)})]},B.id)})}),jsx("g",{className:"relationships-graph-nodes",children:u.map(B=>{let K=C===B.id,te=B.onCriticalPath;return jsxs("g",{className:f("relationships-graph-node",K&&"hovered",te&&"critical"),transform:`translate(${B.x}, ${B.y})`,onMouseDown:ie=>S(B.id,ie),onMouseEnter:()=>T(B.id),onMouseLeave:()=>T(null),onClick:ie=>R(B,ie),children:[jsx("circle",{r:te?a.nodeSize*1.2:a.nodeSize,fill:I(B),stroke:te?"#fbbf24":"#ffffff",strokeWidth:te?3:2,opacity:K?1:.9}),a.showLabels&&jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:B.card.title.length>20?B.card.title.substring(0,20)+"...":B.card.title})]},B.id)})})]}),jsx("defs",{children:jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function im({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=useState(""),[p,m]=useState(false),[i,u]=useState(null),[d,g]=useState(null),h=useRef(null),C=p||o;useEffect(()=>{e&&h.current&&h.current.focus();},[e]),useEffect(()=>{let y=l=>{l.key==="Escape"&&!C&&T();};if(e)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[e,C]);let T=()=>{C||(n(""),u(null),g(null),t());},c=async()=>{if(!(!s.trim()||C)){m(true),u(null),g(null);try{let y=await r(s.trim());g(y);}catch(y){u(y instanceof Error?y.message:"Failed to generate plan");}finally{m(false);}}},b=()=>{d&&(a(d),T());};return e?jsxs(lt,{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-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:y=>y.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsx("button",{onClick:T,disabled:C,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:d?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),d.explanation&&jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsx("p",{className:"text-sm text-white/90",children:d.explanation})}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",d.columns.length,")"]}),jsx("div",{className:"flex gap-2 flex-wrap",children:d.columns.map((y,l)=>jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:y.title},l))})]}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",d.cards.length,")"]}),jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[d.cards.slice(0,10).map((y,l)=>jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsx("p",{className:"text-sm font-medium text-white/90",children:y.title}),y.description&&jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:y.description})]}),y.priority&&jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${y.priority==="URGENT"?"bg-red-500/20 text-red-400":y.priority==="HIGH"?"bg-orange-500/20 text-orange-400":y.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:y.priority})]})},l)),d.cards.length>10&&jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",d.cards.length-10," more tasks..."]})]})]})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsx("textarea",{ref:h,value:s,onChange:y=>n(y.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:C}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),i&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((y,l)=>jsx("button",{onClick:()=>n(y),disabled:C,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:y},l))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:C&&jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:T,disabled:C,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),d?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:c,disabled:!s.trim()||C,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:C?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Vi={"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 Th={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Nh={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 Dh(e,t,a){let r=Vi[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function Ko(e){return `$${e.toFixed(4)}`}var ji=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=Dh(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(d=>d.timestamp>=t.start&&d.timestamp<=t.end));let r=a.length,o=a.reduce((d,g)=>d+g.cost,0),s=a.reduce((d,g)=>d+g.inputTokens,0),n=a.reduce((d,g)=>d+g.outputTokens,0),p=a.filter(d=>d.success),m=a.reduce((d,g)=>d+g.duration,0),i={},u={};return a.forEach(d=>{i[d.feature]=(i[d.feature]||0)+1,u[d.feature]=(u[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:u,averageDuration:r>0?m/r:0,successRate:r>0?p.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,n=new Date;a==="month"?n.setMonth(s.getMonth()-1):n.setDate(s.getDate()-1);let p=this.operations.filter(u=>u.timestamp>=n).length,m=Math.max(0,o-p),i=p/o*100;return {used:p,limit:o,remaining:m,percentUsed:i,isExceeded:p>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},Qr=new ji;function cm({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=useState(Qr.getStats()),[s,n]=useState(Qr.checkLimit(a));if(useEffect(()=>{if(!e)return;let m=setInterval(()=>{o(Qr.getStats()),n(Qr.checkLimit(a));},1e3);return ()=>clearInterval(m)},[e,a]),useEffect(()=>{let m=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[e,t]),!e)return null;let p=Qr.getRecentOperations(5);return jsxs(lt,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:m=>m.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-blue-500/10 to-purple-500/10 border border-blue-500/30",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:Ko(r.totalCost)})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:r.totalOperations})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([m,i])=>{let u=r.costsByFeature[m]||0,d=r.totalOperations>0?i/r.totalOperations*100:0;return jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:m.replace(/([A-Z])/g," $1").trim()}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[i," ops"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:Ko(u)})]})]}),jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full bg-blue-500",style:{width:`${d}%`}})})]},m)})})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),p.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:p.map(m=>jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:m.feature.replace(/([A-Z])/g," $1").trim()}),jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(m.timestamp).toLocaleTimeString()," \u2022"," ",m.duration,"ms"]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[m.inputTokens+m.outputTokens," tokens"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:Ko(m.cost)}),jsx("div",{className:`w-2 h-2 rounded-full ${m.success?"bg-green-400":"bg-red-400"}`})]})]},m.id))})]})]}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80",children:"Close"})]})]})})]})}function um({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,p]=useState(""),[m,i]=useState(""),[u,d]=useState(""),[g,h]=useState(false),[C,T]=useState(null),[c,b]=useState(null),[y,l]=useState(null),x=useRef(null),v=g||o;useEffect(()=>{e&&x.current&&x.current.focus();},[e]),useEffect(()=>{let M=D=>{D.key==="Escape"&&!v&&S();};if(e)return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[e,v]);let S=()=>{v||(p(""),i(""),d(""),T(null),b(null),l(null),t());},k=async()=>{if(!(!n.trim()||v)){h(true),T(null),b(null),l(null);try{let M=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:m||void 0,endDate:u||void 0});b(M.tasks.tasks),l({from_cache:M.from_cache,tokens_used:M.tokens_used,mock_mode:M.mock_mode,similarity:M.similarity,tokens_saved:M.tokens_saved});}catch(M){T(M instanceof Error?M.message:"Failed to generate tasks");}finally{h(false);}}},w=()=>{c&&(a(c),S());};if(!e)return null;let R=y?.similarity?((y.similarity||0)*100).toFixed(0):"0";return jsxs(lt,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:S}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:M=>M.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsx("button",{onClick:S,disabled:v,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:c?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxs("div",{className:"flex flex-wrap gap-2",children:[y?.mock_mode&&jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),y?.from_cache?jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",R,"% similar)"]}):jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[y?.tokens_used||0," tokens"]}),y?.tokens_saved&&jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-indigo-500/20 text-indigo-400 border border-indigo-500/30",children:[y.tokens_saved," tokens saved"]}),jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[c.length," tasks"]})]}),jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:c.map((M,D)=>jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-colors",children:jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxs("span",{className:"text-xs text-white/50",children:["#",D+1]}),jsx("p",{className:"text-sm font-medium text-white/90",children:M.name})]}),jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[jsxs("span",{className:"flex items-center gap-1",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-white/40",children:[jsx("rect",{x:"1",y:"2",width:"10",height:"8",rx:"1",stroke:"currentColor"}),jsx("path",{d:"M1 4h10",stroke:"currentColor"})]}),M.start," \u2192 ",M.end]}),jsxs("span",{children:[M.duration," days"]}),M.dependencies.length>0&&jsxs("span",{className:"text-blue-400",children:["Depends: ",M.dependencies.join(", ")]})]})]}),jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${M.priority==="high"?"bg-red-500/20 text-red-400":M.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:M.priority})]})},M.id))})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsx("textarea",{ref:x,value:n,onChange:M=>p(M.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:v}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsx("input",{type:"date",value:m,onChange:M=>i(M.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:v})]}),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:M=>d(M.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:v})]})]}),C&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:C}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((M,D)=>jsx("button",{onClick:()=>p(M),disabled:v,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:M},D))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:v&&jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:S,disabled:v,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),c?jsx("button",{onClick:w,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsx("button",{onClick:k,disabled:!n.trim()||v,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:v?"Generating...":"Generate Tasks"})]})]})]})})]})}function Yn({initialBoard:e,onPersist:t}){let[a,r]=useState(e),o=useCallback(c=>{t&&an(()=>Promise.resolve(t(c)),{maxAttempts:3,initialDelay:1e3,onRetry:(b,y,l)=>{console.warn(`Retry attempt ${y} after ${l}ms: ${b.message}`);}}).then(b=>{b.success||console.error(`Failed to persist board after ${b.attempts} attempts:`,b.error);});},[t]),s=useCallback(async(c,b,y)=>{r(l=>{let x=l.cards.find(M=>M.id===c);if(!x)return l;let v=x.columnId,S={...x,columnId:b,position:y},k=l.cards.map(M=>M.id===c?S:M),w=l.columns.map(M=>{if(M.id===v)return {...M,cardIds:M.cardIds.filter(D=>D!==c)};if(M.id===b){let D=k.filter(I=>I.columnId===b).sort((I,B)=>I.position-B.position);return {...M,cardIds:D.map(I=>I.id)}}return M}),R={...l,cards:k,columns:w};return o(R),R});},[o]),n=useCallback(async(c,b)=>{r(y=>{let l=y.cards.map(v=>v.id===c?{...v,...b}:v),x={...y,cards:l};return o(x),x});},[o]),p=useCallback(async c=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(y=>{let l={...c,id:b},x=y.columns.map(S=>S.id===c.columnId?{...S,cardIds:[...S.cardIds,b]}:S),v={...y,cards:[...y.cards,l],columns:x};return o(v),v});},[o]),m=useCallback(async c=>{r(b=>{let y=b.cards.find(S=>S.id===c);if(!y)return b;let l=b.cards.filter(S=>S.id!==c),x=b.columns.map(S=>S.id===y.columnId?{...S,cardIds:S.cardIds.filter(k=>k!==c)}:S),v={...b,cards:l,columns:x};return o(v),v});},[o]),i=useCallback(async c=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(y=>{let l={...c,id:b,cardIds:[]},x={...y,columns:[...y.columns,l]};return o(x),x});},[o]),u=useCallback(async(c,b)=>{r(y=>{let l=y.columns.map(v=>v.id===c?{...v,...b}:v),x={...y,columns:l};return o(x),x});},[o]),d=useCallback(async c=>{r(b=>{let y=b.cards.filter(v=>v.columnId!==c),l=b.columns.filter(v=>v.id!==c),x={...b,cards:y,columns:l};return o(x),x});},[o]),g=useCallback(c=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return p(c),b},[p]),h=useCallback(c=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(c),b},[i]),C=useCallback(()=>{r(c=>{let b={...c,cards:[],columns:[]};return o(b),b});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:p,onCardDelete:m,onColumnCreate:i,onColumnUpdate:u,onColumnDelete:d},setBoard:r,helpers:{addCard:g,addColumn:h,deleteCard:m,deleteColumn:d,clearBoard:C}}}function fm({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=Yn({initialBoard:e,onPersist:a}),n=useMemo(()=>({addCard:(m,i,u={})=>{s.addCard({title:i,columnId:m,position:r.cards.filter(d=>d.columnId===m).length,...u});},addColumn:(m,i)=>{let u=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:m,position:i??u+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:n}}var Yo={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},bm={by:"none",order:"asc"};function ym({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=useState({...Yo,...e}),[s,n]=useState({...bm,...t}),p=useCallback(T=>{o(c=>({...c,...T}));},[]),m=useCallback(T=>{n(c=>({...c,...T}));},[]),i=useCallback(()=>{o(Yo),n(bm);},[]),u=useCallback(()=>{a&&o({...Yo,assignees:[a]});},[a]),d=useCallback(()=>{o({...Yo,dateFilter:"overdue"});},[]),g=useCallback(()=>{o({...Yo,priorities:["HIGH","URGENT"]});},[]),h=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]),C=useCallback(T=>{let c=[...T];if(r.search){let b=r.search.toLowerCase();c=c.filter(y=>y.title.toLowerCase().includes(b)||y.description?.toLowerCase().includes(b));}if(r.dateFilter!=="all"){let b=new Date,y=b.getFullYear(),l=String(b.getMonth()+1).padStart(2,"0"),x=String(b.getDate()).padStart(2,"0"),v=`${y}-${l}-${x}`;c=c.filter(S=>{if(!S.endDate&&!S.dueDate)return false;let k=S.endDate||S.dueDate;if(!k)return false;let w;if(typeof k=="string")w=k.split("T")[0]||k;else {let R=k.getUTCFullYear(),M=String(k.getUTCMonth()+1).padStart(2,"0"),D=String(k.getUTCDate()).padStart(2,"0");w=`${R}-${M}-${D}`;}switch(r.dateFilter){case "overdue":return w<v;case "today":return w===v;case "this-week":let R=new Date(v+"T00:00:00"),M=new Date(w+"T00:00:00"),D=new Date(R);return D.setDate(D.getDate()+7),M>=R&&M<=D;case "custom":if(r.dateRange){let I=typeof k=="string"?new Date(k):k;return I>=r.dateRange.start&&I<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(c=c.filter(b=>b.priority&&r.priorities.includes(b.priority))),r.assignees.length>0&&(c=c.filter(b=>(b.assignedUserIds||(b.assigneeId?[b.assigneeId]:[])).some(l=>r.assignees.includes(l)))),r.labels.length>0&&(c=c.filter(b=>b.labels&&b.labels.some(y=>r.labels.includes(y)))),r.columns.length>0&&(c=c.filter(b=>r.columns.includes(b.columnId))),s.by!=="none"&&c.sort((b,y)=>{let l=0;switch(s.by){case "created":let x=b.createdAt?new Date(b.createdAt).getTime():0,v=y.createdAt?new Date(y.createdAt).getTime():0;l=x-v;break;case "priority":let S={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},k=S[b.priority||"LOW"],w=S[y.priority||"LOW"];l=k-w;break;case "dueDate":let R=b.endDate||b.dueDate,M=y.endDate||y.dueDate;if(!R)return 1;if(!M)return -1;let D=typeof R=="string"?new Date(R).getTime():R.getTime(),I=typeof M=="string"?new Date(M).getTime():M.getTime();l=D-I;break;case "title":l=b.title.localeCompare(y.title);break;case "estimate":let B=b.estimatedTime||0,K=y.estimatedTime||0;l=B-K;break;default:l=0;}return s.order==="asc"?l:-l}),c},[r,s]);return {filters:r,sort:s,setFilters:p,setSort:m,resetFilters:i,filterMyTasks:u,filterOverdue:d,filterHighPriority:g,applyFilters:C,hasActiveFilters:h}}var xm,km;if(typeof window<"u")try{let e=Zo("ai");xm=e.generateObject,km=e.generateText;}catch{}function wm(e={}){let[t,a]=useState(false),[r,o]=useState(null),s=!!(xm&&km&&e.apiKey),n=useCallback(async d=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",d),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${d}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(g){let h=g instanceof Error?g:new Error("Failed to generate plan");throw o(h),h}finally{a(false);}},[s]),p=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",d.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(g){let h=g instanceof Error?g:new Error("Failed to suggest assignee");throw o(h),h}finally{a(false);}},[s]),m=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("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(g){let h=g instanceof Error?g:new Error("Failed to predict risks");throw o(h),h}finally{a(false);}},[s]),i=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",d.title),[{title:`Subtask 1 for: ${d.title}`,position:d.position+.1,columnId:d.columnId},{title:`Subtask 2 for: ${d.title}`,position:d.position+.2,columnId:d.columnId}]}catch(g){let h=g instanceof Error?g:new Error("Failed to generate subtasks");throw o(h),h}finally{a(false);}},[s]),u=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",d.title),{hours:8,confidence:.75}}catch(g){let h=g instanceof Error?g:new Error("Failed to estimate effort");throw o(h),h}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:p,onPredictRisks:m,onGenerateSubtasks:i,onEstimateEffort:u,isAvailable:s,isLoading:t,error:r}}function Yi(){let[e,t]=useState(()=>selectionStore.getState());useEffect(()=>selectionStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{selectionStore.setState(r);},[]);return [e,a]}function Cm(e){let{cards:t}=e,[a,r]=Yi(),o=useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=useCallback((d,g)=>{if(!g){r({selectedCardIds:[d],lastSelectedCardId:d});return}let h=g.ctrlKey||g.metaKey,C=g.shiftKey;if(h)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(T=>T!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(C&&a.lastSelectedCardId){let T=t.find(b=>b.id===d),c=t.find(b=>b.id===a.lastSelectedCardId);if(T&&c&&T.columnId===c.columnId){let b=t.filter(w=>w.columnId===T.columnId).sort((w,R)=>w.position-R.position),y=b.findIndex(w=>w.id===a.lastSelectedCardId),l=b.findIndex(w=>w.id===d),[x,v]=y<l?[y,l]:[l,y],S=b.slice(x,v+1).map(w=>w.id),k=Array.from(new Set([...a.selectedCardIds,...S]));r({selectedCardIds:k,lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});},[t,a,r]),n=useCallback(d=>{r({selectedCardIds:a.selectedCardIds.filter(g=>g!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),p=useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),m=useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=useCallback(d=>{a.selectedCardIds.includes(d)?n(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,n,r]),u=useCallback(()=>t.filter(d=>a.selectedCardIds.includes(d.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:p,selectAll:m,toggleCard:i,getSelectedCards:u}}var Tm={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function Nm(e){let{cards:t,config:a,aiService:r}=e,o=useMemo(()=>({...Tm,...a}),[a]),[s,n]=useState([]),p=useCallback((T,c,b,y,l)=>{if(c.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let x={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:T,cardIds:c,columnId:b,strategy:y,color:l,isExpanded:true,position:s.filter(v=>v.columnId===b).length,createdAt:new Date};n(v=>[...v,x]);},[o.minCardsPerStack,s]),m=useCallback(T=>{n(c=>c.filter(b=>b.id!==T));},[]),i=useCallback(T=>{n(c=>c.map(b=>b.id===T?{...b,isExpanded:!b.isExpanded}:b));},[]),u=useCallback((T,c)=>{n(b=>b.map(y=>y.id===T&&!y.cardIds.includes(c)?{...y,cardIds:[...y.cardIds,c]}:y));},[]),d=useCallback((T,c)=>{n(b=>b.map(y=>{if(y.id===T){let l=y.cardIds.filter(x=>x!==c);return l.length<o.minCardsPerStack?null:{...y,cardIds:l}}return y}).filter(y=>y!==null));},[o.minCardsPerStack]),g=useCallback(T=>s.filter(c=>c.columnId===T).sort((c,b)=>c.position-b.position),[s]),h=useCallback(async T=>{let c=t.filter(v=>v.columnId===T);if(c.length<o.minCardsPerStack*2)return [];let b=[],y=new Map;c.forEach(v=>{v.labels&&v.labels.length>0&&v.labels.forEach(S=>{y.has(S)||y.set(S,[]),y.get(S).push(v);});}),y.forEach((v,S)=>{v.length>=o.minCardsPerStack&&b.push({stack:{title:`\u{1F4CC} ${S}`,cardIds:v.map(k=>k.id),columnId:T,strategy:"labels",color:"#3b82f6"},reason:`${v.length} cards with label "${S}"`,confidence:.85});});let l=new Map;c.forEach(v=>{v.assignedUserIds&&v.assignedUserIds.length>0&&v.assignedUserIds.forEach(S=>{l.has(S)||l.set(S,[]),l.get(S).push(v);});}),l.forEach((v,S)=>{v.length>=o.minCardsPerStack&&b.push({stack:{title:`\u{1F464} Assigned to user-${S.slice(-4)}`,cardIds:v.map(k=>k.id),columnId:T,strategy:"assignee",color:"#8b5cf6"},reason:`${v.length} cards assigned to the same user`,confidence:.8});});let x=new Map;if(c.forEach(v=>{v.priority&&(x.has(v.priority)||x.set(v.priority,[]),x.get(v.priority).push(v));}),x.forEach((v,S)=>{if(v.length>=o.minCardsPerStack){let k={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[S.toLowerCase()]||"\u26AA";b.push({stack:{title:`${k} ${S} Priority`,cardIds:v.map(w=>w.id),columnId:T,strategy:"priority",color:S==="high"||S==="urgent"?"#ef4444":"#10b981"},reason:`${v.length} cards with ${S} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let v of c){let k=(await r.findSimilar(v,c)).filter(w=>w.similarity>=o.autoStackConfidenceThreshold);if(k.length>=o.minCardsPerStack-1){let w=[v.id,...k.map(M=>M.card.id)],R=k.reduce((M,D)=>M+D.similarity,0)/k.length;b.push({stack:{title:`\u2728 Similar to "${v.title.substring(0,30)}${v.title.length>30?"...":""}"`,cardIds:w,columnId:T,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${k.length+1} similar tasks`,confidence:R});}}return b.filter(v=>v.confidence>=o.autoStackConfidenceThreshold).sort((v,S)=>S.confidence-v.confidence).slice(0,5)},[t,o,r]),C=useCallback(T=>{p(T.stack.title,T.stack.cardIds,T.stack.columnId,T.stack.strategy,T.stack.color);},[p]);return useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(c=>c.columnId)).forEach(async c=>{let b=await h(c),y=b[0];b.length>0&&y&&y.confidence>=.9&&C(y);});},[]),{stacks:s,createStack:p,deleteStack:m,toggleStack:i,addToStack:u,removeFromStack:d,getStacksForColumn:g,getSuggestions:h,applySuggestion:C,config:o}}var Dm=createContext(null);function Sm({children:e,initialData:t,onStateChange:a}){let r=useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(m=>{let{Column:i}=Zo("@libxai/core");s.set(m.id,new i(m));}),t?.cards?.forEach(m=>{let{Card:i}=Zo("@libxai/core");n.set(m.id,new i(m));});let p=null;if(t?.board){let{Board:m}=Zo("@libxai/core");p=new m(t.board);}r.current=new BoardStore({board:p,columns:s,cards:n});}let o=r.current;return useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsx(Dm.Provider,{value:{store:o},children:e})}function qn(){let e=useContext(Dm);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Xo(){let e=qn(),[t,a]=useState(e.getBoard()),[r,o]=useState(e.getAllColumns()),[s,n]=useState(e.getAllCards());useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),n(e.getAllCards());}),[e]);let p=useCallback(y=>{e.updateBoard(y);},[e]),m=useCallback(y=>{e.addColumn(y);},[e]),i=useCallback((y,l)=>{e.updateColumn(y,l);},[e]),u=useCallback(y=>{e.deleteColumn(y);},[e]),d=useCallback(y=>e.getColumn(y),[e]),g=useCallback(y=>{e.addCard(y);},[e]),h=useCallback((y,l)=>{e.updateCard(y,l);},[e]),C=useCallback(y=>{e.deleteCard(y);},[e]),T=useCallback((y,l,x)=>{e.moveCard(y,l,x);},[e]),c=useCallback(y=>e.getCard(y),[e]),b=useCallback(y=>e.getCardsByColumn(y),[e]);return {board:t,columns:r,cards:s,updateBoard:p,addColumn:m,updateColumn:i,deleteColumn:u,getColumn:d,addCard:g,updateCard:h,deleteCard:C,moveCard:T,getCard:c,getCardsByColumn:b}}function Pm(e){let{cards:t}=Xo();return useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let r=e.searchQuery.toLowerCase(),o=a.title.toLowerCase().includes(r),s=a.description?.toLowerCase().includes(r);if(!o&&!s)return false}return !(e.priorities&&e.priorities.length>0&&(!a.priority||!e.priorities.includes(a.priority))||e.statuses&&e.statuses.length>0&&(!a.status||!e.statuses.includes(a.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(o=>a.isAssignedTo(o))||e.labels&&e.labels.length>0&&!e.labels.some(o=>a.hasLabel(o))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(a.columnId)||e.isOverdue!==void 0&&e.isOverdue!==a.isOverdue())}):t,[t,e])}function Mm(e="position",t="asc"){let{cards:a}=Xo();return useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let p={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},m=o.priority?p[o.priority]:0,i=s.priority?p[s.priority]:0;n=m-i;break}case "createdAt":n=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":n=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":n=o.position-s.position;break}return t==="asc"?n:-n}),[a,e,t])}var Xn=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Nl.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let o=this.config.get(t);o[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let o=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let n=s[t];if(typeof n=="function")try{let p=await Promise.resolve(n.apply(s,a));p!==void 0&&(o=p,a[0]=p);}catch(p){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,p,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(n=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,n,{plugin:o.id,hook:t});}));}await Promise.all(r);}},Gh=new Xn;function Fm({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:p=0,getItemKey:m}){let i=useRef(null),u=useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:p}),d=u.getVirtualItems(),g={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},h=n?{width:`${u.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${u.getTotalSize()}px`,width:"100%",position:"relative"};return jsx("div",{ref:i,style:g,className:o,children:jsx("div",{style:h,children:d.map(C=>{let T=e[C.index];if(!T)return null;let c=m?m(T,C.index):C.index,b={position:"absolute",top:n?0:C.start,left:n?C.start:0,width:n?C.size:"100%",height:n?"100%":C.size};return jsx("div",{style:b,"data-index":C.index,children:r(T,C.index)},c)})})})}function Lm(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 Bm({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:p=16,getItemKey:m,horizontal:i=true}){let u=useRef(null),d=useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>u.current,estimateSize:()=>r,overscan:n,gap:p}),g=d.getVirtualItems(),h={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},C={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsx("div",{ref:u,style:h,className:s,children:jsx("div",{style:C,children:g.map(T=>{let c=e[T.index];if(!c)return null;let b=m?m(c,T.index):T.index,y={position:"absolute",top:0,left:T.start,width:T.size,height:"100%"};return jsx("div",{style:y,"data-index":T.index,children:o(c,T.index)},b)})})})}function Rm(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 $m(e,t=10){return e>t}var Qi={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Zi={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},el={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},tl={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},al={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},rl={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},ol={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},nl={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)"},sl={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)"},il={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},ll={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}},dl={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}},Jn={spacing:Qi,borderRadius:Zi,fontSize:el,fontWeight:tl,lineHeight:al,zIndex:rl,duration:ol,easing:nl,shadows:sl,opacity:il,kanban:ll,gantt:dl};function Om(e,t,a){return e[t]??a}function cl(e,t="",a={}){for(let[r,o]of Object.entries(e)){let s=t?`${t}-${r}`:r;typeof o=="object"&&o!==null&&!Array.isArray(o)?cl(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function jh(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function ml(e="asakaa"){let t=cl(Jn),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=jh(o);a.push(` ${s}: ${n};`);}return `:root {
390
390
  ${a.join(`
391
391
  `)}
392
392
  }`}function Jo(e,t="asakaa"){let a=[],r=cl(e);for(let[o,s]of Object.entries(r)){let n=`--${t}-color-${o}`;a.push(` ${n}: ${s};`);}return `:root {
@@ -416,5 +416,5 @@ ${Jo(ul,"asakaa").split(`
416
416
  `)}
417
417
  }
418
418
  `}var Kh=({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 Um({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=go();return jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([n,p])=>{let m=n,i=m===r;return jsxs("button",{onClick:()=>o(m),className:`theme-switcher__button ${i?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${p.displayName} theme`,"aria-pressed":i,title:p.displayName,children:[jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsx(Kh,{theme:m})}),e&&!t&&jsx("span",{className:"theme-switcher__label",children:p.displayName})]},m)})})}
419
- export{cm as AIUsageDashboard,Nh as AI_FEATURES,Vi as AI_MODELS,Ds as AddCardButton,Ns as AddColumnButton,dr as AttachmentUploader,Sm as BoardProvider,hn as BulkOperationsToolbar,Os as BurnDownChart,Yc as CalendarBoard,ur as Card,Fs as CardDetailModal,Bs as CardDetailModalV2,tm as CardHistoryReplay,Zc as CardHistoryTimeline,om as CardRelationshipsGraph,hh as CardStack,Vs as CardTemplateSelector,ss as CircuitBreaker,io as Column,Cn as ColumnManager,Ps as CommandPalette,qs as ConfigMenu,yo as ContextMenu,Lo as DEFAULT_SHORTCUTS,_s as DEFAULT_TEMPLATES,To as DateRangePicker,Do as DependenciesSelector,Mn as DependencyLine,zs as DistributionCharts,gs as EditableColumnTitle,co as ErrorBoundary,Ks as ExportImportModal,Ys as FilterBar,Dc as GANTT_AI_SYSTEM_PROMPT,Bn as GanttAIAssistant,wc as GanttBoard,ho as GanttI18nContext,Fn as GanttMilestone,wn as GanttToolbar,um as GenerateGanttTasksDialog,im as GeneratePlanModal,Ws as GroupBySelector,Er as KanbanBoard,Cs as KanbanToolbar,Mo as KanbanViewAdapter,Gs as KeyboardShortcutsHelp,Oc as ListView,Rt as MenuIcons,Xn as PluginManager,zr as PrioritySelector,Th as RATE_LIMITS,Us as SwimlaneBoardView,hs as TagBadge,td as TagList,nr as TagPicker,Sn as TaskBar,_r as TaskDetailModal,Nc as TaskFormModal,Dn as TaskGrid,Zs as ThemeModal,zd as ThemeProvider,Um as ThemeSwitcher,In as Timeline,Hr as UserAssignmentSelector,$s as VelocityChart,Bm as VirtualGrid,Fm as VirtualList,Qr as aiUsageTracker,Zi as borderRadius,tn as calculatePosition,Ui as calendarDarkTheme,Fi as calendarEnTranslations,Li as calendarEsTranslations,Hi as calendarLightTheme,Wi as calendarNeutralTheme,Vn as calendarThemes,Wn as calendarTranslations,$n as cardToGanttTask,Lc as cardsToGanttTasks,f as cn,yd as createKanbanView,lp as createRetryWrapper,Xs as darkTheme,Qn as darkTokenTheme,yn as defaultTheme,Jn as designTokens,ol as duration,nl as easing,zm as exportTokensToCSS,yr as findTaskByName,el as fontSize,tl as fontWeight,Ko as formatCost,xn as ganttEnTranslations,Hd as ganttEsTranslations,Fc as ganttTaskToCardUpdate,qe as ganttThemes,dl as ganttTokens,ei as ganttTranslations,ue as ganttUtils,ml as generateCSSVariables,gl as generateCompleteCSS,op as generateInitialPositions,Sc as generateTasksContext,Jo as generateThemeVariables,qc as getCalendarTheme,Wo as getCalendarTranslations,zc as getListViewTheme,Ei as getListViewTranslations,Uc as getMonthNames,Om as getToken,Wd as getTranslations,Hc as getWeekdayNames,ll as kanbanTokens,Js as lightTheme,pl as lightTokenTheme,al as lineHeight,Pi as listViewDarkTheme,Di as listViewEnTranslations,Si as listViewEsTranslations,Mi as listViewLightTheme,Ai as listViewNeutralTheme,Hn as listViewThemes,On as listViewTranslations,Gn as mergeCalendarTranslations,zn as mergeListViewTranslations,ti as mergeTranslations,Qs as neutralTheme,ul as neutralTokenTheme,il as opacity,Mc as parseLocalCommand,Ci as parseNaturalDate,Ti as parseNaturalDuration,Ni as parseProgress,Pc as parseStatus,Gh as pluginManager,ip as retrySyncOperation,an as retryWithBackoff,sl as shadows,$m as shouldVirtualizeGrid,Qi as spacing,Kr as themes,wm as useAI,fm as useBoard,Xo as useBoardCore,qn as useBoardStore,Nm as useCardStacking,ks as useDragState,Pm as useFilteredCards,ym as useFilters,bo as useGanttI18n,Yn as useKanbanState,Rd as useKeyboardShortcuts,Cm as useMultiSelect,Yi as useSelectionState,Mm as useSortedCards,go as useTheme,Rm as useVirtualGrid,Lm as useVirtualList,Ac as validateAIResponse,Ss as withErrorBoundary,on as wouldCreateCircularDependency,rl as zIndex};//# sourceMappingURL=index.js.map
419
+ export{cm as AIUsageDashboard,Nh as AI_FEATURES,Vi as AI_MODELS,Ds as AddCardButton,Ns as AddColumnButton,dr as AttachmentUploader,Sm as BoardProvider,hn as BulkOperationsToolbar,Os as BurnDownChart,Yc as CalendarBoard,ur as Card,Fs as CardDetailModal,Bs as CardDetailModalV2,tm as CardHistoryReplay,Zc as CardHistoryTimeline,om as CardRelationshipsGraph,hh as CardStack,Vs as CardTemplateSelector,ss as CircuitBreaker,io as Column,Cn as ColumnManager,Ps as CommandPalette,qs as ConfigMenu,yo as ContextMenu,Lo as DEFAULT_SHORTCUTS,_s as DEFAULT_TEMPLATES,To as DateRangePicker,Do as DependenciesSelector,Mn as DependencyLine,zs as DistributionCharts,gs as EditableColumnTitle,co as ErrorBoundary,Ks as ExportImportModal,Ys as FilterBar,Dc as GANTT_AI_SYSTEM_PROMPT,Bn as GanttAIAssistant,wc as GanttBoard,ho as GanttI18nContext,Fn as GanttMilestone,wn as GanttToolbar,um as GenerateGanttTasksDialog,im as GeneratePlanModal,Ws as GroupBySelector,Er as KanbanBoard,Cs as KanbanToolbar,Mo as KanbanViewAdapter,Gs as KeyboardShortcutsHelp,Oc as ListView,Rt as MenuIcons,Xn as PluginManager,zr as PrioritySelector,Th as RATE_LIMITS,Us as SwimlaneBoardView,hs as TagBadge,td as TagList,nr as TagPicker,Sn as TaskBar,_r as TaskDetailModal,Nc as TaskFormModal,Dn as TaskGrid,Zs as ThemeModal,zd as ThemeProvider,Um as ThemeSwitcher,In as Timeline,Hr as UserAssignmentSelector,$s as VelocityChart,Bm as VirtualGrid,Fm as VirtualList,Qr as aiUsageTracker,Zi as borderRadius,tn as calculatePosition,Ui as calendarDarkTheme,Fi as calendarEnTranslations,Li as calendarEsTranslations,Hi as calendarLightTheme,Wi as calendarNeutralTheme,Vn as calendarThemes,Wn as calendarTranslations,$n as cardToGanttTask,Lc as cardsToGanttTasks,f as cn,yd as createKanbanView,lp as createRetryWrapper,Xs as darkTheme,Qn as darkTokenTheme,yn as defaultTheme,Jn as designTokens,ol as duration,nl as easing,zm as exportTokensToCSS,yr as findTaskByName,el as fontSize,tl as fontWeight,Ko as formatCost,xn as ganttEnTranslations,Hd as ganttEsTranslations,Fc as ganttTaskToCardUpdate,qe as ganttThemes,dl as ganttTokens,ei as ganttTranslations,fe as ganttUtils,ml as generateCSSVariables,gl as generateCompleteCSS,op as generateInitialPositions,Sc as generateTasksContext,Jo as generateThemeVariables,qc as getCalendarTheme,Wo as getCalendarTranslations,zc as getListViewTheme,Ei as getListViewTranslations,Uc as getMonthNames,Om as getToken,Wd as getTranslations,Hc as getWeekdayNames,ll as kanbanTokens,Js as lightTheme,pl as lightTokenTheme,al as lineHeight,Pi as listViewDarkTheme,Di as listViewEnTranslations,Si as listViewEsTranslations,Mi as listViewLightTheme,Ai as listViewNeutralTheme,Hn as listViewThemes,On as listViewTranslations,Gn as mergeCalendarTranslations,zn as mergeListViewTranslations,ti as mergeTranslations,Qs as neutralTheme,ul as neutralTokenTheme,il as opacity,Mc as parseLocalCommand,Ci as parseNaturalDate,Ti as parseNaturalDuration,Ni as parseProgress,Pc as parseStatus,Gh as pluginManager,ip as retrySyncOperation,an as retryWithBackoff,sl as shadows,$m as shouldVirtualizeGrid,Qi as spacing,Kr as themes,wm as useAI,fm as useBoard,Xo as useBoardCore,qn as useBoardStore,Nm as useCardStacking,ks as useDragState,Pm as useFilteredCards,ym as useFilters,bo as useGanttI18n,Yn as useKanbanState,Rd as useKeyboardShortcuts,Cm as useMultiSelect,Yi as useSelectionState,Mm as useSortedCards,go as useTheme,Rm as useVirtualGrid,Lm as useVirtualList,Ac as validateAIResponse,Ss as withErrorBoundary,on as wouldCreateCircularDependency,rl as zIndex};//# sourceMappingURL=index.js.map
420
420
  //# sourceMappingURL=index.js.map