@libxai/board 0.17.241 → 0.17.243
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +63 -63
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +63 -63
- package/dist/index.js.map +1 -1
- package/dist/styles.css +16 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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
|
|
2
|
-
`)}async function
|
|
3
|
-
`)?`"${e.replace(/"/g,'""')}"`:e}async function yl(e,t,a,r){switch(t){case "json":return
|
|
4
|
-
`);if(t.length<1||!t[0])return {success:!1,errors:["CSV file is empty or invalid"]};let a=xl(t[0]),r=[],o=new Map,n=[];for(let s=1;s<t.length;s++)try{let p=xl(t[s]||"");if(p.length>a.length){n.push(`Line ${s+1}: Too many columns`);continue}if(a.length-p.length>3){n.push(`Line ${s+1}: Column count mismatch (expected ${a.length}, got ${p.length})`);continue}for(;p.length<a.length;)p.push("");let l={};a.forEach((i,w)=>{l[i]=p[w]||"";});let u=l.Column||"Unnamed";o.has(u)||o.set(u,{id:`col-${o.size+1}`,title:u,position:o.size+1,cardIds:[]});let c=o.get(u),d={id:l["Card ID"]||`card-${s}`,title:l.Title||"Untitled",description:l.Description?l.Description:void 0,columnId:c.id,position:c.cardIds.length+1,priority:l.Priority||void 0,labels:l.Labels?l.Labels.split(";").filter(Boolean):void 0,assignedUserIds:l["Assigned Users"]?l["Assigned Users"].split(";").filter(Boolean):void 0,startDate:l["Start Date"]?l["Start Date"]:void 0,endDate:l["End Date"]?l["End Date"]:void 0,createdAt:l["Created At"]?l["Created At"]:void 0,updatedAt:l["Updated At"]?l["Updated At"]:void 0};r.push(d),c.cardIds.push(d.id);}catch(p){n.push(`Line ${s+1}: ${p instanceof Error?p.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...n]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:n.length>0?n:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function xl(e){let t=[],a="",r=false;for(let o=0;o<e.length;o++){let n=e[o],s=e[o+1];n==='"'&&r&&s==='"'?(a+='"',o++):n==='"'?r=!r:n===","&&!r?(t.push(a),a=""):a+=n;}return t.push(a),t}function kl(e,t){switch(t){case "json":return qp(e);case "csv":return Xp(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function wl(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 as=createContext(null);function Cl(){return useContext(as)}var Tl=createContext(null);function Dl({children:e,themeName:t}){return jsx(Tl.Provider,{value:{themeName:t},children:e})}function Kr(){return useContext(Tl)}function it({children:e,container:t}){let[a,r]=useState(false),o=Cl(),n=Kr();if(useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let s=t||(typeof document<"u"?document.body:null);if(!s)return null;if(o){let{theme:p,themeName:m}=o,l={"--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:l,children:e}),s)}return n?createPortal(jsx("div",{"data-theme":n.themeName,"data-kanban-portal":"true",children:e}),s):createPortal(e,s)}var Ml={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},om="#BDC3C7",nm=({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 Er({priority:e,onChange:t,className:a}){let[r,o]=useState(false),[n,s]=useState({top:0,left:0}),p=useRef(null),m=useRef(null),l=()=>{if(!m.current)return;let i=m.current.getBoundingClientRect(),w=window.innerHeight,g=window.innerWidth,b=160,h=220,v=4,f=i.right-b;f<10&&(f=i.left),f+b>g-10&&(f=g-b-10);let x=w-i.bottom,T=i.top,D;x>=h+v?D=i.bottom+v:T>=h+v?D=i.top-h-v:D=x>=T?i.bottom+v:Math.max(10,i.top-h-v),s({top:D,left:f}),o(true);};useEffect(()=>{let i=w=>{p.current&&!p.current.contains(w.target)&&!m.current?.contains(w.target)&&o(false);};if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]),useEffect(()=>{let i=w=>{w.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[r]);let u=i=>{t(i),o(false);},c=e?Ml[e]:null,d=c?.color||om;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:m,onClick:()=>r?o(false):l(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${d}10`:"transparent",boxShadow:e?`0 0 0 2px ${d}30 inset`:"none"},title:c?.label||"Set priority",children:jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:d,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:d,fillOpacity:e?"0.6":"0.4"})})}),r&&jsx(it,{children:jsxs("div",{ref:p,className:"priority-selector-menu",style:{position:"fixed",top:`${n.top}px`,left:`${n.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(Ml).map(([i,w])=>jsxs("button",{onClick:()=>u(i),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:w.color,background:"transparent"},onMouseEnter:g=>{g.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:g=>{g.currentTarget.style.background="transparent";},children:[jsx(nm,{color:w.color}),jsx("span",{className:"font-semibold text-sm",children:w.label}),e===i&&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"})})]},i)),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:i=>{i.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:i=>{i.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 sm=[{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 fo({startDate:e,endDate:t,onChange:a,className:r}){let[o,n]=useState(false),[s,p]=useState({top:0,left:0}),m=useRef(null),l=useRef(null),d=(Kr()?.themeName||"dark")==="dark",i=()=>{if(!l.current)return;let f=l.current.getBoundingClientRect(),x=window.innerHeight,T=window.innerWidth,D=320,I=380,k=4,L=f.left;L+D>T-10&&(L=T-D-10),L<10&&(L=10);let N=x-f.bottom,C=f.top,G;N>=I+k?G=f.bottom+k:C>=I+k?G=f.top-I-k:G=N>=C?f.bottom+k:Math.max(10,f.top-I-k),p({top:G,left:L}),n(true);};useEffect(()=>{let f=x=>{m.current&&!m.current.contains(x.target)&&!l.current?.contains(x.target)&&n(false);};if(o)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[o]),useEffect(()=>{let f=x=>{x.key==="Escape"&&n(false);};if(o)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[o]);let w=f=>{let x=new Date,T=L=>{let N=L.getFullYear(),C=String(L.getMonth()+1).padStart(2,"0"),G=String(L.getDate()).padStart(2,"0");return `${N}-${C}-${G}`},D=T(x),I=new Date(x);I.setDate(I.getDate()+f);let k=T(I);a(D,k),n(false);},g=()=>{if(!e||!t)return "Set date";let f=I=>{if(I instanceof Date)return I;if(typeof I!="string"||!I.match(/^\d{4}-\d{2}-\d{2}$/))return null;let k=I.split("-").map(Number);if(k.length!==3||k.some(G=>isNaN(G)))return null;let L=k[0],N=k[1],C=k[2];return L===void 0||N===void 0||C===void 0?null:new Date(L,N-1,C)},x=f(e),T=f(t);if(!x||!T||isNaN(x.getTime())||isNaN(T.getTime()))return "Set date";let D=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${D[x.getMonth()]} ${x.getDate()} \u2013 ${D[T.getMonth()]} ${T.getDate()}`},b=e&&t,v=(()=>{if(!t)return false;let f=typeof t=="string"?new Date(t):t,x=new Date;return x.setHours(0,0,0,0),f<x})();return jsxs("div",{className:`relative ${r||""}`,children:[jsxs("button",{ref:l,onClick:()=>o?n(false):i(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${v?"asakaa-date-overdue":"asakaa-date"}`,title:b?`${g()}`:"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:g()})]}),o&&jsx(it,{children:jsxs("div",{ref:m,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,background:d?"#1A1D25":"#FFFFFF",border:`1px solid ${d?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:d?"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)":"0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08)",zIndex:99999},children:[jsxs("div",{className:"p-4 border-b",style:{borderColor:d?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.08)"},children:[jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:d?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Quick Select"}),jsx("div",{className:"grid grid-cols-2 gap-2",children:sm.map(f=>jsx("button",{onClick:()=>w(f.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:d?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${d?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:d?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:x=>{x.currentTarget.style.backgroundColor=d?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",x.currentTarget.style.border=`1px solid ${d?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:x=>{x.currentTarget.style.backgroundColor=d?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",x.currentTarget.style.border=`1px solid ${d?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:f.label},f.label))})]}),jsxs("div",{className:"p-4",children:[jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:d?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Custom Range"}),jsxs("div",{className:"space-y-3",children:[jsx("input",{type:"date",value:e||"",onChange:f=>a(f.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:d?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:d?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:d?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:d?"dark":"light"}}),jsx("input",{type:"date",value:t||"",onChange:f=>a(e,f.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:d?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:d?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:d?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:d?"dark":"light"}})]}),(e||t)&&jsx("button",{onClick:()=>{a(void 0,void 0),n(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:f=>{f.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:f=>{f.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function Mr({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[n,s]=useState(false),[p,m]=useState(""),[l,u]=useState({top:0,left:0}),c=useRef(null),d=useRef(null),i=()=>{if(!d.current)return;let v=d.current.getBoundingClientRect(),f=window.innerHeight,x=window.innerWidth,T=300,D=380,I=4,k=v.right-T;k<10&&(k=v.left),k+T>x-10&&(k=x-T-10);let L=f-v.bottom,N=v.top,C;L>=D+I?C=v.bottom+I:N>=D+I?C=v.top-D-I:C=L>=N?v.bottom+I:Math.max(10,v.top-D-I),u({top:C,left:k}),s(true);};useEffect(()=>{let v=f=>{c.current&&!c.current.contains(f.target)&&!d.current?.contains(f.target)&&(s(false),m(""));};if(n)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[n]),useEffect(()=>{let v=f=>{f.key==="Escape"&&(s(false),m(""));};if(n)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[n]);let w=v=>{let f=e.some(x=>x.id===v.id);a(f?e.filter(x=>x.id!==v.id):[...e,v]);},g=t.filter(v=>v.name.toLowerCase().includes(p.toLowerCase())),b=e.slice(0,o),h=e.length-o;return jsxs("div",{className:`relative ${r||""}`,children:[jsx("button",{ref:d,onClick:()=>n?s(false):i(),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:[b.map(v=>jsx("div",{className:"asakaa-avatar",title:v.name,children:v.avatar?jsx("img",{src:v.avatar,alt:v.name,className:"asakaa-avatar-img"}):v.initials},v.id)),h>0&&jsxs("div",{className:"asakaa-avatar",children:["+",h]})]}):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"})]})})}),n&&jsx(it,{children:jsxs("div",{ref:c,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${l.top}px`,left:`${l.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("input",{type:"text",value:p,onChange:v=>m(v.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:g.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"}):g.map(v=>{let f=e.some(x=>x.id===v.id);return jsxs("button",{onClick:()=>w(v),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:v.color,color:"#fff"},children:v.avatar?jsx("img",{src:v.avatar,alt:v.name,className:"w-full h-full rounded-full object-cover"}):v.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:v.name}),jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:f?"#3b82f6":"transparent"},children:f?"\u2713":""})]},v.id)})}),e.length>0&&jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsx("button",{onClick:()=>{a([]),s(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 qo(e,t,a){let r=new Map;e.forEach(m=>{if(m.dependencies&&Array.isArray(m.dependencies)){let l=m.dependencies.map(u=>{if(typeof u=="string")return u;let c=u;return c.taskId||c.targetId||""}).filter(Boolean);r.set(m.id,l);}});let o=r.get(a)||[];r.set(a,[...o,t]);let n=new Set,s=new Set,p=m=>{if(!n.has(m)){n.add(m),s.add(m);let l=r.get(m)||[];for(let u of l){if(!n.has(u)&&p(u))return true;if(s.has(u))return true}}return s.delete(m),false};return p(a)}function bo({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:n=true,onCircularDependencyError:s}){let[p,m]=useState(false),[l,u]=useState(""),[c,d]=useState(t.length>0),[i,w]=useState({top:0,left:0}),[g,b]=useState(null),h=useRef(null),v=useRef(null),f=()=>{if(!v.current)return;let k=v.current.getBoundingClientRect(),L=window.innerHeight,N=window.innerWidth,C=300,G=c?380:120,F=4,J=k.right-C;J<10&&(J=k.left),J+C>N-10&&(J=N-C-10);let K=L-k.bottom,de=k.top,ge;K>=G+F?ge=k.bottom+F:de>=G+F?ge=k.top-G-F:ge=K>=de?k.bottom+F:Math.max(10,k.top-G-F),w({top:ge,left:J}),m(true);};useEffect(()=>{if(!p||!v.current)return;let k=v.current.getBoundingClientRect(),L=window.innerHeight,N=window.innerWidth,C=300,G=c?380:120,F=4,J=k.right-C;J<10&&(J=k.left),J+C>N-10&&(J=N-C-10);let K=L-k.bottom,de=k.top,ge;K>=G+F?ge=k.bottom+F:de>=G+F?ge=k.top-G-F:ge=K>=de?k.bottom+F:Math.max(10,k.top-G-F),w({top:ge,left:J});},[c,p]),useEffect(()=>{let k=L=>{h.current&&!h.current.contains(L.target)&&!v.current?.contains(L.target)&&(m(false),u(""));};if(p)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[p]),useEffect(()=>{let k=L=>{L.key==="Escape"&&(m(false),u(""));};if(p)return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[p]);let x=k=>{let L=t.includes(k),N=a.find(C=>C.id===k);if(b(null),L){let C=t.filter(G=>G!==k);r(C),C.length===0&&d(false);}else {if(n&&qo(a,k,e)){let G=`Cannot add "${N?.title||k}" as dependency - would create circular reference`;b(G),s?.(k,N?.title||k),setTimeout(()=>b(null),3e3);return}r([...t,k]),d(true);}},T=()=>{let k=!c;d(k),k||r([]);},D=a.filter(k=>k.id!==e).filter(k=>k.title.toLowerCase().includes(l.toLowerCase())||k.id.toLowerCase().includes(l.toLowerCase())),I=t.length>0?"#3B82F6":"#BDC3C7";return jsxs("div",{className:`relative ${o||""}`,children:[jsxs("button",{ref:v,onClick:()=>p?m(false):f(),className:"flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5",title:t.length>0?`${t.length} dependencies`:"Add dependencies",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M7 9L9 7M11.5 3.5L10 2C8.89543 0.89543 7.10457 0.89543 6 2C4.89543 3.10457 4.89543 4.89543 6 6L7.5 7.5M4.5 12.5L6 14C7.10457 15.1046 8.89543 15.1046 10 14C11.1046 12.8954 11.1046 11.1046 10 10L8.5 8.5",stroke:I,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsx("span",{className:"text-xs font-medium",style:{color:I},children:t.length})]}),p&&jsx(it,{children:jsxs("div",{ref:h,className:"dependencies-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:[g&&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:g})]}),jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:T,children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:c?"#3b82f6":"transparent",borderColor:c?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:c&&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"})]})}),c&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsx("input",{type:"text",value:l,onChange:k=>u(k.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:D.length===0?jsx("div",{className:"px-4 py-3 text-xs text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:"No tasks found"}):D.map(k=>{let L=t.includes(k.id);return jsxs("button",{onClick:()=>x(k.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:N=>{N.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:N=>{N.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:L?"#3b82f6":"transparent",borderColor:L?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:L&&jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxs("div",{className:"flex-1 text-left",children:[jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:k.title}),jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:k.id})]})]},k.id)})})]}),t.length>0&&jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsx("button",{onClick:()=>{r([]),d(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 er=memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:n,onUpdate:s,availableUsers:p=[],allCards:m=[]})=>{let{attributes:l,listeners:u,setNodeRef:c,transform:d,transition:i,isDragging:w}=useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),g={transform:Vo.Transform.toString(d),transition:i};if(t)return jsx("div",{ref:c,style:g,...l,...u,onClick:()=>a?.(e),children:t(e)});let b=p.filter(x=>e.assignedUserIds?.includes(x.id)),h=e.progress===100,v=(e.attachments||[]).filter(x=>x.type.startsWith("image/")),f={...g,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxs("div",{ref:c,style:f,className:y("asakaa-card",w&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",n),...l,...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";}})}),v.length>0&&!e.coverImage&&jsx("div",{className:"asakaa-card-attachments mb-3",children:v.length===1&&v[0]?jsx("img",{src:v[0].url,alt:v[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:v.slice(0,4).map((x,T)=>jsxs("div",{className:"relative",children:[jsx("img",{src:x.url,alt:x.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:D=>{D.currentTarget.style.display="none";}}),T===3&&v.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:["+",v.length-4]})})]},x.id))})}),jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:h?"line-through":"none",opacity:h?.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(Er,{priority:e.priority,onChange:x=>s?.(e.id,{priority:x})})}),jsx("div",{onClick:x=>x.stopPropagation(),className:"date-picker",children:jsx(fo,{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,T)=>s?.(e.id,{startDate:x,endDate:T})})}),p.length>0&&jsx("div",{onClick:x=>x.stopPropagation(),className:"user-selector",children:jsx(Mr,{assignedUsers:b,availableUsers:p,onChange:x=>s?.(e.id,{assignedUserIds:x.map(T=>T.id)})})}),jsx("div",{onClick:x=>x.stopPropagation(),className:"dependencies-selector",children:jsx(bo,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(x=>typeof x=="string"?x:x.taskId):[],availableTasks:m,onChange:x=>s?.(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)));er.displayName="Card";var Xo={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"}},Ul=({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 Wl({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,n]=useState(false),[s,p]=useState({top:0,left:0}),m=useRef(null),l=useRef(null),u=[...Object.entries(Xo).map(([b,h])=>({id:b,label:h.label,color:h.color,icon:h.icon})),...r.filter(b=>!Object.keys(Xo).includes(b.id)).map(b=>({id:b.id,label:b.title,color:b.color||"#8B5CF6",icon:"circle-dot"}))],c=()=>{let b=Xo[e];if(b)return {...b,id:e};let h=r.find(v=>v.id===e);return h?{id:h.id,label:h.title,color:h.color||"#8B5CF6",icon:"circle-dot"}:{...Xo.todo,id:"todo"}},d=()=>{if(!l.current)return;let b=l.current.getBoundingClientRect(),h=window.innerHeight,v=window.innerWidth,f=180,x=280,T=4,D=b.right-f;D<10&&(D=b.left),D+f>v-10&&(D=v-f-10);let I=h-b.bottom,k=b.top,L;I>=x+T?L=b.bottom+T:k>=x+T?L=b.top-x-T:L=I>=k?b.bottom+T:Math.max(10,b.top-x-T),p({top:L,left:D}),n(true);};useEffect(()=>{let b=h=>{m.current&&!m.current.contains(h.target)&&!l.current?.contains(h.target)&&n(false);};if(o)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[o]),useEffect(()=>{let b=h=>{h.key==="Escape"&&n(false);};if(o)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[o]);let i=b=>{t(b),n(false);},w=c(),g=w.color;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:l,onClick:()=>o?n(false):d(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${g}10`,boxShadow:`0 0 0 2px ${g}30 inset`},title:w.label,children:jsx(Ul,{icon:w.icon,color:g})}),o&&jsx(it,{children:jsxs("div",{ref:m,className:"status-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.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(b=>jsxs("button",{onClick:()=>i(b.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:b.color,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(Ul,{icon:b.icon,color:b.color}),jsx("span",{className:"font-semibold",children:b.label}),e===b.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"})})]},b.id))})]})})]})}function Hl({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[n,s]=useState(false),[p,m]=useState(false),[l,u]=useState(e),[c,d]=useState({top:0,left:0}),i=useRef(null),w=useRef(null),g=useRef(null);useEffect(()=>{if(n&&w.current){let f=w.current.getBoundingClientRect();d({top:f.bottom+window.scrollY+8,left:f.left+window.scrollX});}},[n]),useEffect(()=>{let f=x=>{i.current&&!i.current.contains(x.target)&&!w.current?.contains(x.target)&&(s(false),m(false));};if(n)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[n]),useEffect(()=>{let f=x=>{x.key==="Escape"&&(s(false),m(false),u(e));};if(n)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[n,e]),useEffect(()=>{p&&g.current&&(g.current.focus(),g.current.select());},[p]);let b=()=>{m(true),u(e);},h=()=>{let f=l.trim();f&&f!==e&&t(f),m(false),s(false),u(e);},v=f=>{f.key==="Enter"?h():f.key==="Escape"&&(m(false),u(e));};return jsxs("div",{className:`relative ${o||""}`,children:[jsx("button",{ref:w,onClick:()=>s(!n),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"})]})}),n&&jsx(it,{children:jsx("div",{ref:i,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${c.top}px`,left:`${c.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:g,type:"text",value:l,onChange:f=>u(f.target.value),onKeyDown:v,onBlur:h,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:b,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-white/90 hover:bg-white/10 transition-all",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-medium",children:"Rename"})]}),r&&a&&jsxs(Fragment,{children:[jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxs("button",{onClick:()=>{a(),s(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 Xr=memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:n,onCardClick:s,onCardUpdate:p,availableUsers:m,allCards:l,enableVirtualization:u,cardHeight:c=120,isCollapsed:d,onToggleCollapse:i,onColumnRename:w,onColumnDelete:g,isDeletable:b=false,className:h})=>{let{setNodeRef:v,isOver:f}=useDroppable({id:e.id,data:{type:"column",column:e}}),x=useRef(null),T=u??gl(t.length),D=useVirtualizer({count:t.length,getScrollElement:()=>x.current,estimateSize:()=>c,enabled:T});if(a)return jsx("div",{ref:v,className:h,children:a(e,t)});let k=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let C=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:C}:C>=80?{state:"warning",percentage:C}:C>=60?{state:"approaching",percentage:C}:{state:"ok",percentage:C}})(),L=k.state==="exceeded",N=()=>"asakaa-column-count";return jsxs("div",{ref:v,className:y("asakaa-column",f&&"ring-2 ring-asakaa-accent-blue",L&&"ring-2 ring-asakaa-accent-red",h),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:y(N()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&k.state!=="none"&&jsxs("span",{className:"text-xs font-medium flex items-center",title:`${k.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[k.state==="exceeded"&&jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#EF4444",opacity:"0.9"}),jsx("path",{d:"M5 5L11 11M11 5L5 11",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]}),k.state==="warning"&&jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsx("path",{d:"M8 1L15 14H1L8 1Z",fill:"#F59E0B",opacity:"0.9"}),jsx("path",{d:"M8 6V9M8 11V11.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})]}),k.state==="approaching"&&jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M8 1L10 7H14L10 10L12 16L8 12L4 16L6 10L2 7H6L8 1Z",fill:"#FB923C",opacity:"0.9"})}),k.state==="ok"&&jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(w||g)&&jsx(Hl,{columnTitle:e.title,onRename:C=>w?.(e.id,C),onDelete:g?()=>g(e.id):void 0,isDeletable:b}),i&&jsx("button",{onClick:i,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":d?"Expand column":"Collapse column",children:d?"\u25B6":"\u25BC"})]})]}),!d&&jsx("div",{ref:x,className:"asakaa-column-cards",style:{maxHeight:T?"600px":void 0},children:jsx(SortableContext,{items:t.map(C=>C.id),strategy:verticalListSortingStrategy,children:t.length===0?n?n(e):jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsx("p",{children:"Drop cards here"})}):T?jsx("div",{style:{height:`${D.getTotalSize()}px`,position:"relative"},children:D.getVirtualItems().map(C=>{let G=t[C.index];return G?jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${C.start}px)`},children:jsx(er,{card:G,render:r,onClick:s,onUpdate:p,availableUsers:m,allCards:l})},G.id):null})}):t.map(C=>jsx(er,{card:C,render:r,onClick:s,onUpdate:p,availableUsers:m,allCards:l},C.id))})})]})});Xr.displayName="Column";function is({title:e,onSave:t,className:a}){let[r,o]=useState(false),[n,s]=useState(e),p=useRef(null);useEffect(()=>{r&&p.current&&(p.current.focus(),p.current.select());},[r]);let m=()=>{let u=n.trim();u&&u!==e?t(u):s(e),o(false);},l=u=>{u.key==="Enter"?m():u.key==="Escape"&&(s(e),o(false));};return r?jsx("input",{ref:p,type:"text",value:n,onChange:u=>s(u.target.value),onBlur:m,onKeyDown:l,className:y("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsx("h2",{className:y("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}var en=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function ja({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:n=false,compact:s=true}){let[p,m]=useState(false),[l,u]=useState(""),[c,d]=useState(false),[i,w]=useState(en[10]||"#3B82F6"),[g,b]=useState({top:0,left:0}),h=useRef(null),v=useRef(null),f=useRef(null),x=useRef(null),T=t.filter(C=>C.name.toLowerCase().includes(l.toLowerCase())),D=t.some(C=>C.name.toLowerCase()===l.toLowerCase());useEffect(()=>{if(p&&v.current){let C=v.current.getBoundingClientRect();b({top:C.bottom+6,left:C.left});}},[p]),useEffect(()=>{let C=G=>{let F=G.target,J=h.current?.contains(F),K=f.current?.contains(F);!J&&!K&&(m(false),u(""),d(false));};if(p)return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[p]),useEffect(()=>{p&&x.current&&x.current.focus();},[p]);let I=C=>{let G=e.some(F=>F.id===C.id);a(G?e.filter(F=>F.id!==C.id):[...e,C]);},k=async()=>{if(!(!r||!l.trim())){d(true);try{let C=await r(l.trim(),i);C&&(a([...e,C]),u(""),w(en[Math.floor(Math.random()*en.length)]||"#3B82F6"));}finally{d(false);}}},L=(C,G)=>{G.stopPropagation(),a(e.filter(F=>F.id!==C));},N={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxs("div",{ref:h,className:"relative",children:[jsxs("button",{ref:v,type:"button",onClick:()=>!n&&m(!p),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:N,disabled:n,children:[jsx(Tag,{className:"w-3.5 h-3.5"}),e.length>0?jsxs("div",{className:"flex items-center gap-1",children:[e.slice(0,2).map(C=>jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${C.color}20`,color:C.color},children:C.name},C.id)),e.length>2&&jsxs("span",{className:"text-xs",style:{color:o.textTertiary},children:["+",e.length-2]})]}):jsx("span",{children:"Agregar"}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:o.textTertiary}})]}),typeof document<"u"&&createPortal(jsx(AnimatePresence,{children:p&&jsxs(motion.div,{ref:f,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:g.top,left:g.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:l,onChange:C=>u(C.target.value),placeholder:"Buscar o crear etiqueta...",className:"w-full px-3 py-1.5 text-sm rounded-md outline-none",style:{backgroundColor:o.bgSecondary,color:o.textPrimary,border:`1px solid ${o.borderLight}`},onKeyDown:C=>{C.key==="Enter"&&l.trim()&&!D&&r&&k();}})}),e.length>0&&jsxs("div",{className:"p-2 border-b",style:{borderColor:o.border},children:[jsx("p",{className:"text-xs mb-1.5",style:{color:o.textTertiary},children:"Seleccionadas"}),jsx("div",{className:"flex flex-wrap gap-1",children:e.map(C=>jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium cursor-pointer hover:opacity-80",style:{backgroundColor:`${C.color}20`,color:C.color},onClick:G=>L(C.id,G),children:[C.name,jsx(X,{className:"w-3 h-3"})]},C.id))})]}),jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:T.length>0?T.map(C=>{let G=e.some(F=>F.id===C.id);return jsxs("button",{type:"button",onClick:()=>I(C),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:G?`${C.color}15`:"transparent",color:o.textPrimary},onMouseEnter:F=>{G||(F.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:F=>{G||(F.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:C.color}}),jsx("span",{className:"flex-1 text-left",children:C.name}),G&&jsx(Check,{className:"w-4 h-4",style:{color:C.color}})]},C.id)}):l.trim()?jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No se encontraron etiquetas"}):jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No hay etiquetas disponibles"})}),l.trim()&&!D&&r&&jsxs("div",{className:"p-2 border-t",style:{borderColor:o.border},children:[jsx("div",{className:"flex items-center gap-2 mb-2",children:jsx("p",{className:"text-xs",style:{color:o.textTertiary},children:"Crear nueva etiqueta"})}),jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:en.map(C=>jsx("button",{type:"button",onClick:()=>w(C),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:C,outline:i===C?`2px solid ${C}`:"none",outlineOffset:"2px"}},C))}),jsxs("button",{type:"button",onClick:k,disabled:c,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:i,color:"#FFFFFF",opacity:c?.7:1},children:[c?jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsx(Plus,{className:"w-4 h-4"}),'Crear "',l.trim(),'"']})]})]})}),document.body)]})}function ds({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 jl({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(n=>jsx(ds,{tag:n,size:a},n.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]})]})}function Yl(e,t=[]){if("title"in e&&!("name"in e)){let a=e,r=(a.assignedUserIds||[]).map(o=>{let n=t.find(s=>s.id===o);return n||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 Ym(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 ms({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:n="dark",locale:s="es",availableUsers:p=[],availableTags:m=[],onCreateTag:l,attachments:u=[],onUploadAttachments:c,onDeleteAttachment:d}){let i=n==="dark",w={textTertiary:i?"#6B7280":"#9CA3AF",textSecondary:i?"#9CA3AF":"#6B7280",textPrimary:i?"#FFFFFF":"#111827",borderLight:i?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:i?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:i?"#1A1D25":"#FFFFFF",bgSecondary:i?"#0F1117":"#F9FAFB",hoverBg:i?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},g=e&&"title"in e&&!("name"in e),b=e,[h,v]=useState(e?Yl(e,p):null),[f,x]=useState(false),[T,D]=useState(false),[I,k]=useState(false),[L,N]=useState(null),[C,G]=useState(new Date),[F,J]=useState(false),[K,de]=useState(false),[ge,Te]=useState(false);useEffect(()=>{e&&v(Yl(e,p));},[e?.id,p]);let Ce=useCallback(U=>{v(U),g&&o&&b?o(Ym(U,b)):r&&r(U);},[g,b,o,r]),z=useCallback(()=>{x(false),D(false),k(false),N(null);},[]),B=useCallback((U,ae)=>{if(!h)return;let Me={...h,[U]:ae};Ce(Me);},[h,Ce]),$=useCallback(U=>{if(!h)return;let ae=h.progress||0;U==="completed"?ae=100:U==="in-progress"&&ae===0?ae=10:U==="todo"&&(ae=0);let Me={...h,status:U,progress:ae};Ce(Me),x(false);},[h,Ce]),P=useCallback((U,ae)=>{if(!h)return;let Me={...h,startDate:U,endDate:ae};Ce(Me);},[h,Ce]),Q=useCallback(()=>{let U=C.getFullYear(),ae=C.getMonth(),Me=new Date(U,ae,1),qe=new Date(U,ae+1,0).getDate(),Ke=Me.getDay(),O=[],re=new Date(U,ae,0).getDate();for(let fe=Ke-1;fe>=0;fe--)O.push({date:new Date(U,ae-1,re-fe),isCurrentMonth:false});for(let fe=1;fe<=qe;fe++)O.push({date:new Date(U,ae,fe),isCurrentMonth:true});let ce=42-O.length;for(let fe=1;fe<=ce;fe++)O.push({date:new Date(U,ae+1,fe),isCurrentMonth:false});return O},[C]),ee=useCallback(async U=>{if(U.preventDefault(),U.stopPropagation(),de(false),!h||!c)return;let ae=Array.from(U.dataTransfer.files);if(ae.length!==0){Te(true);try{await c(h.id,ae);}finally{Te(false);}}},[h,c]),H=useCallback(async U=>{if(!h||!c||!U.target.files)return;let ae=Array.from(U.target.files);if(ae.length!==0){Te(true);try{await c(h.id,ae);}finally{Te(false);}U.target.value="";}},[h,c]),De=useCallback(U=>{U.preventDefault(),U.stopPropagation(),de(true);},[]),Ee=useCallback(U=>{U.preventDefault(),U.stopPropagation(),de(false);},[]),Be=useCallback(U=>U<1024?`${U} B`:U<1024*1024?`${(U/1024).toFixed(1)} KB`:`${(U/(1024*1024)).toFixed(1)} MB`,[]),xe=useCallback(U=>U.startsWith("image/")?Image:U.includes("pdf")||U.includes("document")?FileText:File,[]);return !t||!h?null:jsx(AnimatePresence,{children:t&&h&&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:y("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",i?"bg-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxs("div",{className:y("px-6 py-3 border-b flex items-center gap-3",i?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Circle,{className:y("w-4 h-4",i?"text-[#9CA3AF]":"text-gray-500")}),jsxs("span",{className:y("text-xs px-2 py-0.5 rounded",i?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[s==="es"?"Tarea":"Task"," \u2228"]}),jsx("span",{className:y("text-xs font-mono",i?"text-[#6B7280]":"text-gray-400"),children:h.id.slice(0,8)}),jsxs("button",{className:y("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",i?"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:y("p-1.5 rounded transition-colors",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(Maximize2,{className:"w-4 h-4"})}),jsx("button",{className:y("p-1.5 rounded transition-colors",i?"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:y("p-1.5 rounded transition-colors",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-5 h-5"})})]}),jsx("div",{className:"px-6 py-4",children:jsxs("div",{className:"flex items-start gap-3",children:[jsx("button",{onClick:()=>{let U=h.progress===100?0:100,Me={...h,progress:U,status:U===100?"completed":"todo"};Ce(Me);},className:y("mt-1 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors",h.progress===100?"bg-green-500 border-green-500":i?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:h.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("h2",{className:y("text-xl font-semibold flex-1",h.progress===100?"line-through text-[#6B7280]":i?"text-white":"text-gray-900"),children:h.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:y("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:y("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Estado":"Status"}),jsx("button",{onClick:()=>{z(),x(!f);},className:y("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",h.progress===100||h.status==="completed"?"bg-green-500/20 text-green-400":h.progress&&h.progress>0||h.status==="in-progress"?"bg-blue-500/20 text-blue-400":i?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:h.progress===100||h.status==="completed"?s==="es"?"COMPLETADO":"DONE":h.progress&&h.progress>0||h.status==="in-progress"?s==="es"?"EN PROGRESO":"IN PROGRESS":s==="es"?"POR HACER":"TO DO"}),jsx(AnimatePresence,{children:f&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>x(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:y("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:s==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:s==="es"?"En progreso":"In Progress",color:"bg-blue-500"},{id:"completed",label:s==="es"?"Completado":"Done",color:"bg-green-500"}].map(U=>jsxs("button",{onClick:()=>$(U.id),className:y("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",h.status===U.id&&(i?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:y("w-2 h-2 rounded-full",U.color)}),jsx("span",{className:i?"text-white":"text-gray-900",children:U.label})]},U.id))})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(User,{className:y("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:y("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Asignados":"Assignees"}),jsxs("button",{onClick:()=>{z(),k(!I);},className:y("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[h.assignees&&h.assignees.length>0?jsxs("div",{className:"flex items-center gap-1",children:[h.assignees.slice(0,3).map((U,ae)=>jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:U.color||"#8B5CF6"},title:U.name,children:U.initials||U.name.slice(0,2).toUpperCase()},ae)),h.assignees.length>3&&jsxs("span",{className:y("text-xs",i?"text-[#6B7280]":"text-gray-400"),children:["+",h.assignees.length-3]})]}):jsx("span",{className:y("text-sm",i?"text-[#6B7280]":"text-gray-400"),children:s==="es"?"Agregar":"Add"}),jsx(ChevronDown,{className:y("w-3 h-3",i?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:I&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>k(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:y("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:p.length>0?p.map(U=>{let ae=h.assignees?.some(Me=>Me.name===U.name);return jsxs("button",{onClick:()=>{let Me=h.assignees||[],_e;ae?_e=Me.filter(qe=>qe.name!==U.name):_e=[...Me,U],B("assignees",_e);},className:y("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",ae&&(i?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:U.color||"#8B5CF6"},children:U.initials||U.name.slice(0,2).toUpperCase()}),jsx("span",{className:y("flex-1",i?"text-white":"text-gray-900"),children:U.name}),ae&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},U.name)}):jsx("div",{className:y("px-3 py-4 text-sm text-center",i?"text-[#6B7280]":"text-gray-500"),children:s==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CalendarDays,{className:y("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:y("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Fechas":"Dates"}),jsxs("button",{onClick:()=>{N(L?null:"start"),G(h.startDate||new Date);},className:y("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[h.startDate?.toLocaleDateString(s==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(s==="es"?"Inicio":"Start"),jsx("span",{className:y("mx-1",i?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),h.endDate?.toLocaleDateString(s==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(s==="es"?"Fin":"End")]}),jsx(AnimatePresence,{children:L&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>N(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:y("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:U=>U.stopPropagation(),children:[jsx("div",{className:y("w-44 py-2 border-r",i?"border-white/10":"border-gray-200"),children:(()=>{let U=new Date,ae=new Date(U);ae.setDate(U.getDate()+1);let Me=new Date(U);Me.setDate(U.getDate()+7);let _e=new Date(U);return _e.setDate(U.getDate()+14),[{label:s==="es"?"Hoy":"Today",date:U},{label:s==="es"?"Ma\xF1ana":"Tomorrow",date:ae},{label:s==="es"?"Pr\xF3xima semana":"Next week",date:Me},{label:s==="es"?"2 semanas":"2 weeks",date:_e}].map((qe,Ke)=>jsxs("button",{className:y("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",i?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{L==="start"?(P(qe.date,h.endDate),N("end")):(P(h.startDate,qe.date),N(null));},children:[jsx("span",{children:qe.label}),jsx("span",{className:y("text-xs",i?"text-[#6B7280]":"text-gray-400"),children:qe.date.toLocaleDateString(s==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]},Ke))})()}),jsxs("div",{className:"p-4 w-[280px]",children:[jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("span",{className:y("text-sm font-medium",i?"text-white":"text-gray-900"),children:L==="start"?s==="es"?"Fecha inicio":"Start date":s==="es"?"Fecha fin":"End date"}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>G(new Date(C.getFullYear(),C.getMonth()-1)),className:y("p-1 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),jsx("span",{className:y("text-sm min-w-[100px] text-center",i?"text-white":"text-gray-900"),children:C.toLocaleDateString(s==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsx("button",{onClick:()=>G(new Date(C.getFullYear(),C.getMonth()+1)),className:y("p-1 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(s==="es"?["L","M","M","J","V","S","D"]:["S","M","T","W","T","F","S"]).map((U,ae)=>jsx("div",{className:y("text-xs text-center py-1",i?"text-[#6B7280]":"text-gray-400"),children:U},ae))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:Q().map((U,ae)=>{let Me=U.date.toDateString()===new Date().toDateString(),_e=h.startDate?.toDateString()===U.date.toDateString(),qe=h.endDate?.toDateString()===U.date.toDateString(),Ke=h.startDate&&h.endDate&&U.date>=h.startDate&&U.date<=h.endDate;return jsx("button",{onClick:()=>{L==="start"?(P(U.date,h.endDate&&U.date>h.endDate?U.date:h.endDate),N("end")):(P(h.startDate&&U.date<h.startDate?U.date:h.startDate,U.date),N(null));},className:y("w-8 h-8 text-xs rounded-lg transition-colors",!U.isCurrentMonth&&(i?"text-[#4B5563]":"text-gray-300"),U.isCurrentMonth&&(i?"text-white":"text-gray-900"),Me&&"ring-1 ring-blue-500",(_e||qe)&&"bg-blue-500 text-white",Ke&&!_e&&!qe&&(i?"bg-blue-500/20":"bg-blue-100"),i?"hover:bg-white/10":"hover:bg-gray-100"),children:U.date.getDate()},ae)})})]})]})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Flag,{className:y("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:y("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Prioridad":"Priority"}),jsx("button",{onClick:()=>{z(),D(!T);},className:y("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",h.priority==="high"||h.priority==="urgent"?"bg-red-500/20 text-red-400":h.priority==="medium"?"bg-yellow-500/20 text-yellow-400":h.priority==="low"?"bg-green-500/20 text-green-400":i?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:h.priority?h.priority==="high"||h.priority==="urgent"?s==="es"?"Alta":"High":h.priority==="medium"?s==="es"?"Media":"Medium":s==="es"?"Baja":"Low":s==="es"?"Sin prioridad":"No priority"}),jsx(AnimatePresence,{children:T&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>D(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:y("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:s==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:s==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:s==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:s==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:s==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(U=>jsxs("button",{onClick:()=>{B("priority",U.id),D(false);},className:y("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",h.priority===U.id&&(i?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:y("w-2 h-2 rounded-full",U.color)}),jsx("span",{className:i?"text-white":"text-gray-900",children:U.label})]},U.id||"none"))})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:y("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:y("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Duraci\xF3n":"Duration"}),jsx("span",{className:y("text-sm",i?"text-white":"text-gray-900"),children:h.startDate&&h.endDate?`${Math.ceil((h.endDate.getTime()-h.startDate.getTime())/(1e3*60*60*24))} ${s==="es"?"d\xEDas":"days"}`:s==="es"?"Sin definir":"Not set"})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:y("w-4 h-4 rounded-full border-2",i?"border-[#6B7280]":"border-gray-400")}),jsx("span",{className:y("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Progreso":"Progress"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[F?jsx("input",{type:"range",min:"0",max:"100",step:"5",value:h.progress||0,onChange:U=>{let ae=parseInt(U.target.value),Me=h.status;ae===100?Me="completed":ae>0?Me="in-progress":Me="todo";let _e={...h,progress:ae,status:Me};Ce(_e);},onBlur:()=>J(false),className:y("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",i?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsx("button",{onClick:()=>J(true),className:y("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",i?"bg-white/10":"bg-gray-200"),children:jsx("div",{className:y("h-full rounded-full transition-all",h.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${h.progress||0}%`}})}),jsxs("span",{className:y("text-sm font-medium min-w-[40px]",i?"text-white":"text-gray-900"),children:[h.progress||0,"%"]})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Tag,{className:y("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:y("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Etiquetas":"Tags"}),jsx(ja,{selectedTags:h.tags||[],availableTags:m,onChange:U=>{B("tags",U);},onCreateTag:l,theme:w})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Link2,{className:y("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:y("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Relaciones":"Relations"}),jsx("span",{className:y("text-sm",i?"text-[#6B7280]":"text-gray-400"),children:h.dependencies&&h.dependencies.length>0?`${h.dependencies.length} ${s==="es"?"dependencias":"dependencies"}`:s==="es"?"Vac\xEDo":"Empty"})]})]}),jsxs("div",{className:y("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsx(FileText,{className:y("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsx("h3",{className:y("text-sm font-semibold",i?"text-white":"text-gray-900"),children:s==="es"?"Descripci\xF3n":"Description"})]}),jsx("textarea",{value:h.description||"",onChange:U=>B("description",U.target.value),placeholder:s==="es"?"Agregar descripci\xF3n...":"Add description...",className:y("w-full min-h-[100px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors",i?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")}),jsxs("button",{className:y("flex items-center gap-2 text-sm mt-2 transition-colors",i?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsx(Sparkles,{className:"w-4 h-4"}),s==="es"?"Escribe con IA":"Write with AI"]})]}),jsxs("div",{className:y("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsx("h3",{className:y("text-sm font-semibold mb-3",i?"text-white":"text-gray-900"),children:s==="es"?"Campos personalizados":"Custom fields"}),jsxs("button",{className:y("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsx(Plus,{className:"w-4 h-4"}),s==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxs("div",{className:y("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsx("h3",{className:y("text-sm font-semibold mb-3",i?"text-white":"text-gray-900"),children:s==="es"?"Subtareas":"Subtasks"}),h.subtasks&&h.subtasks.length>0&&jsx("div",{className:"space-y-2 mb-3",children:h.subtasks.map(U=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:y("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",U.progress===100?"bg-green-500 border-green-500":i?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:U.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("span",{className:y("text-sm",U.progress===100?"line-through text-[#6B7280]":i?"text-white":"text-gray-900"),children:U.name})]},U.id))}),jsxs("button",{className:y("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsx(Plus,{className:"w-4 h-4"}),s==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxs("div",{className:y("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("h3",{className:y("text-sm font-semibold",i?"text-white":"text-gray-900"),children:s==="es"?"Listas de control":"Checklists"}),jsx("button",{className:y("p-1 rounded transition-colors",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(Plus,{className:"w-4 h-4"})})]}),jsxs("button",{className:y("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsx(ListChecks,{className:"w-4 h-4"}),s==="es"?"Crear lista de control":"Create checklist"]})]}),jsxs("div",{className:y("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:y("text-sm font-semibold mb-3",i?"text-white":"text-gray-900"),children:[s==="es"?"Adjuntos":"Attachments",u.length>0&&jsxs("span",{className:y("ml-2 text-xs font-normal",i?"text-[#6B7280]":"text-gray-400"),children:["(",u.length,")"]})]}),u.length>0&&jsx("div",{className:"space-y-2 mb-4",children:u.map(U=>{let ae=xe(U.type),Me=U.type.startsWith("image/");return jsxs("div",{className:y("flex items-center gap-3 p-2 rounded-lg group transition-colors",i?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[Me&&U.thumbnailUrl?jsx("img",{src:U.thumbnailUrl,alt:U.name,className:"w-10 h-10 rounded object-cover"}):jsx("div",{className:y("w-10 h-10 rounded flex items-center justify-center",i?"bg-white/10":"bg-gray-200"),children:jsx(ae,{className:y("w-5 h-5",i?"text-[#9CA3AF]":"text-gray-500")})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("a",{href:U.url,target:"_blank",rel:"noopener noreferrer",className:y("text-sm font-medium truncate block hover:underline",i?"text-white":"text-gray-900"),children:U.name}),jsx("p",{className:y("text-xs",i?"text-[#6B7280]":"text-gray-400"),children:Be(U.size)})]}),d&&jsx("button",{onClick:()=>d(U.id),className:y("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",i?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:s==="es"?"Eliminar":"Delete",children:jsx(Trash2,{className:"w-4 h-4"})})]},U.id)})}),jsxs("div",{onDragOver:De,onDragLeave:Ee,onDrop:ee,className:y("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",K?i?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":i?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",ge&&"pointer-events-none opacity-50"),children:[jsx("input",{type:"file",multiple:true,onChange:H,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!c||ge}),ge?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:y("text-sm",i?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Subiendo...":"Uploading..."})]}):jsxs(Fragment,{children:[jsx(Upload,{className:y("w-6 h-6 mx-auto mb-2",K?"text-blue-500":i?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:y("text-sm",i?"text-[#9CA3AF]":"text-gray-500"),children:K?s==="es"?"Suelta los archivos aqu\xED":"Drop files here":s==="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"})]})}),!c&&jsx("p",{className:y("text-xs mt-1",i?"text-[#6B7280]":"text-gray-400"),children:s==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxs("div",{className:y("w-80 border-l flex flex-col",i?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsx("div",{className:y("px-4 py-3 border-b",i?"border-white/10":"border-gray-200"),children:jsx("h3",{className:y("text-sm font-semibold",i?"text-white":"text-gray-900"),children:s==="es"?"Actividad":"Activity"})}),jsx("div",{className:"flex-1 overflow-y-auto p-4",children:jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsx(MessageSquare,{className:y("w-10 h-10 mb-3",i?"text-[#3B4252]":"text-gray-300")}),jsx("p",{className:y("text-sm",i?"text-[#6B7280]":"text-gray-500"),children:s==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsx("div",{className:y("p-4 border-t",i?"border-white/10":"border-gray-200"),children:jsxs("div",{className:y("flex items-center gap-2 px-3 py-2 rounded-lg",i?"bg-white/5":"bg-white border border-gray-200"),children:[jsx("input",{type:"text",placeholder:s==="es"?"Escribe un comentario...":"Write a comment...",className:y("flex-1 bg-transparent text-sm outline-none",i?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400")}),jsx("button",{className:y("p-1.5 rounded transition-colors",i?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600"),children:jsx(Send,{className:"w-4 h-4"})})]})})]})]})]})})}function gs(){let[e,t]=useState(()=>dragStore.getState());useEffect(()=>dragStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{dragStore.setState(r);},[]);return [e,a]}function fr({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:n=[],className:s,style:p,isLoading:m,error:l,children:u,availableTags:c=[],onCreateTag:d}){let[i,w]=gs(),[g,b]=useState(null),h=o?.theme||"dark",v=h==="dark"||h==="neutral",f=v?"dark":"",x=useCallback((K,de)=>{t.onCardUpdate?.(K,de);},[t]),T=useCallback((K,de)=>{t.onColumnUpdate?.(K,{title:de});},[t]),D=useCallback(K=>{t.onColumnDelete?.(K);},[t]),I=["todo","in-progress","completed"],k=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),L=useMemo(()=>{let K=new Map;return e.columns.forEach(de=>{let ge=de.cardIds.map(Te=>e.cards.find(Ce=>Ce.id===Te)).filter(Te=>Te!==void 0).sort((Te,Ce)=>Te.position-Ce.position);K.set(de.id,ge);}),K},[e.cards,e.columns]),N=useCallback(K=>{let{active:de}=K,ge=e.cards.find(Te=>Te.id===de.id);ge&&w({isDragging:true,draggedCardId:ge.id,sourceColumnId:ge.columnId,targetColumnId:ge.columnId});},[e.cards,w]),C=useCallback(K=>{let{active:de,over:ge}=K;if(!ge||!e.cards.find(z=>z.id===de.id))return;let Ce=null;ge.data.current?.type==="column"?Ce=ge.id:ge.data.current?.type==="card"&&(Ce=e.cards.find(B=>B.id===ge.id)?.columnId||null),Ce&&Ce!==i.targetColumnId&&w({...i,targetColumnId:Ce});},[e.cards,i,w]),G=useCallback(async K=>{let{active:de,over:ge}=K;if(w({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!ge)return;let Te=e.cards.find($=>$.id===de.id);if(!Te)return;let Ce,z;if(ge.data.current?.type==="column"){Ce=ge.id;let $=L.get(Ce)||[];z=Zn($,0);}else {let $=e.cards.find(ee=>ee.id===ge.id);if(!$)return;Ce=$.columnId;let P=L.get(Ce)||[],Q=P.findIndex(ee=>ee.id===ge.id);z=Zn(P,Q);}let B=e.columns.find($=>$.id===Ce);if(B&&B.wipLimit&&B.wipLimitType==="hard"){let $=L.get(Ce)||[];if(Te.columnId!==Ce&&$.length>=B.wipLimit){t.onWipLimitExceeded?.(B,Te);return}}(Te.columnId!==Ce||Te.position!==z)&&await t.onCardMove?.(Te.id,Ce,z);},[e.cards,e.columns,L,t,w]),F=useCallback(K=>{b(K),a?.(K);},[a]),J=useCallback(K=>{t.onCardUpdate?.(K.id,K),b(K);},[t]);return m?jsx("div",{className:y("asakaa-board",f,s),style:p,children:jsx(iu,{columnCount:3})}):l?jsx("div",{className:y("asakaa-board",f,s),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 l=="string"?l:l.message})]})})}):jsxs(Dl,{themeName:h,children:[jsxs(DndContext,{sensors:k,collisionDetection:closestCorners,onDragStart:N,onDragOver:C,onDragEnd:G,children:[jsxs("div",{className:y("asakaa-board",f,s),style:p,"data-theme":h,children:[e.columns.sort((K,de)=>K.position-de.position).map(K=>{let de=L.get(K.id)||[],ge=!I.includes(K.id);return jsx(Xr,{column:K,cards:de,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:F,onCardUpdate:x,onColumnRename:T,onColumnDelete:D,isDeletable:ge,availableUsers:n,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},K.id)}),u]}),jsx(DragOverlay,{children:i.draggedCardId?jsx(er,{card:e.cards.find(K=>K.id===i.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),jsx(ms,{task:g,isOpen:!!g,onClose:()=>b(null),onCardUpdate:J,theme:v?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:n,availableTags:c,onCreateTag:d})]})}function iu({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 mu={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)"},uu={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)"},gu={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},fu={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function hu({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[n,s]=useState(false),p=useRef(null);useEffect(()=>{let l=u=>{p.current&&!p.current.contains(u.target)&&s(false);};return n&&document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[n]);let m=l=>{t(l),s(false);};return jsxs("div",{ref:p,className:"relative",children:[jsxs(motion.button,{onClick:()=>s(!n),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:n?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:n&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((l,u)=>l.position-u.position).map((l,u)=>jsxs(motion.button,{onClick:()=>m(l.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:l.color||a.accent}}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:l.title}),jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[l.cardIds.length," ",l.cardIds.length===1?"tarea":"tareas"]})]})]},l.id))]})})})]})}function bu({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[n,s]=useState(false),[p,m]=useState(null),l=useRef(null);if(useEffect(()=>{let i=w=>{l.current&&!l.current.contains(w.target)&&s(false);};return n&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]),!(a||r||o))return null;let c=[{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(i=>i.handler),d=async(i,w)=>{if(w){m(i);try{await w();}catch(g){console.error(`Export ${i} failed:`,g);}finally{m(null),s(false);}}};return jsxs("div",{ref:l,className:"relative",children:[jsxs(motion.button,{onClick:()=>s(!n),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:n?e.accent:e.bgSecondary,border:`1px solid ${n?e.accent:e.borderLight}`,color:n?"#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:n?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:n&&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:c.map((i,w)=>jsxs(motion.button,{onClick:()=>d(i.id,i.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:w<c.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:w*.03},children:[jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:p===i.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-4 h-4"})}):i.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:i.label}),jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:i.description})]})]},i.id))})})})]})}function yu({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 hs({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:n=false,onExportCSV:s,onExportJSON:p,onExportExcel:m,translations:l}){let u=r==="dark"?mu:uu,c={...o==="es"?gu:fu,...l},d=s||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:[d&&jsxs(Fragment,{children:[jsx(bu,{theme:u,t:c,onExportCSV:s,onExportJSON:p,onExportExcel:m}),t&&jsx("div",{className:"w-px h-6",style:{backgroundColor:u.borderLight}})]}),t&&(n?jsx(hu,{columns:e,onSelect:t,theme:u,t:c,createTaskLabel:a}):jsx(yu,{onClick:()=>t(),label:a||c.newTask}))]})})}function ys({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[n,s]=useState(false),[p,m]=useState(""),l=useCallback(()=>{let d=p.trim();d&&(e(d),m(""),s(false));},[p,e]),u=useCallback(d=>{d.key==="Enter"?(d.preventDefault(),l()):d.key==="Escape"&&(m(""),s(false));},[l]),c=useCallback(()=>{setTimeout(()=>{p.trim()||s(false);},150);},[p]);return n?jsx("div",{className:y("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:d=>m(d.target.value),onKeyDown:u,onBlur:c,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxs("div",{className:"asakaa-add-column__actions",children:[jsx("button",{onClick:l,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(""),s(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:y("asakaa-add-column",t),children:jsxs("button",{onClick:()=>s(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 vs({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:n,disabled:s=false,theme:p="dark",locale:m="es"}){let[l,u]=useState(false),[c,d]=useState(false),[i,w]=useState(""),[g,b]=useState([]),[h,v]=useState(""),[f,x]=useState(""),[T,D]=useState(""),[I,k]=useState(false),[L,N]=useState(false),[C,G]=useState(false),F=useRef(null),J=useRef(null),K={placeholder:o||(m==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:n||(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"},de=useCallback(()=>{w(""),b([]),v(""),x(""),D(""),k(false),N(false),G(false),u(false);},[]);useEffect(()=>{l&&F.current&&F.current.focus();},[l]),useEffect(()=>{if(!l)return;let B=$=>{J.current&&!J.current.contains($.target)&&(i.trim()||de());};return document.addEventListener("mousedown",B),()=>document.removeEventListener("mousedown",B)},[l,i,de]);let ge=useCallback(async()=>{let B=i.trim();if(!(!B||c)){d(true);try{await t({name:B,columnId:e,assigneeIds:g.length>0?g:void 0,startDate:h?new Date(h):void 0,endDate:f?new Date(f):void 0,priority:T||void 0}),w(""),b([]),v(""),x(""),D(""),k(!1),N(!1),G(!1),F.current?.focus();}catch($){console.error("Error creating card:",$);}finally{d(false);}}},[i,e,g,h,f,T,t,c]),Te=useCallback(B=>{B.key==="Enter"&&!B.shiftKey?(B.preventDefault(),ge()):B.key==="Escape"&&de();},[ge,de]),Ce=useCallback(B=>{b($=>$.includes(B)?$.filter(P=>P!==B):[...$,B]);},[]),z=p==="dark";return l?jsxs("div",{ref:J,className:y("rounded-lg overflow-hidden shadow-lg",z?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxs("div",{className:"p-3",children:[jsx("input",{ref:F,type:"text",value:i,onChange:B=>w(B.target.value),onKeyDown:Te,placeholder:K.placeholder,disabled:c,className:y("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",z?"text-gray-100 placeholder-gray-500":"text-gray-800 placeholder-gray-400")}),jsxs("div",{className:"flex items-center gap-1 mt-3",children:[a.length>0&&jsxs("button",{onClick:()=>k(!I),className:y("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",I||g.length>0?"bg-emerald-500/20 text-emerald-400":z?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:K.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"})]}),g.length>0&&jsx("span",{className:"ml-0.5",children:g.length})]}),jsx("button",{onClick:()=>N(!L),className:y("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",L||h||f?"bg-blue-500/20 text-blue-400":z?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:K.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:()=>G(!C),className:y("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",C||T?T==="urgent"?"bg-red-500/20 text-red-400":T==="high"?"bg-orange-500/20 text-orange-400":T==="medium"?"bg-yellow-500/20 text-yellow-400":T==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":z?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:K.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:ge,disabled:!i.trim()||c,className:y("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:c?jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}):K.save})]})]}),I&&a.length>0&&jsx("div",{className:y("px-3 pb-3 pt-0","border-t",z?"border-[#3a3a4e]":"border-gray-200"),children:jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(B=>jsxs("button",{onClick:()=>Ce(B.id),className:y("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",g.includes(B.id)?"bg-emerald-500 text-white":z?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[B.avatar?jsx("img",{src:B.avatar,alt:B.name,className:"w-4 h-4 rounded-full"}):jsx("div",{className:y("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",g.includes(B.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:B.name.charAt(0).toUpperCase()}),jsx("span",{children:B.name.split(" ")[0]})]},B.id))})}),L&&jsx("div",{className:y("px-3 pb-3 pt-0","border-t",z?"border-[#3a3a4e]":"border-gray-200"),children:jsxs("div",{className:"grid grid-cols-2 gap-2 pt-3",children:[jsxs("div",{children:[jsx("label",{className:y("block text-[10px] uppercase tracking-wide mb-1",z?"text-gray-500":"text-gray-400"),children:K.startDate}),jsx("input",{type:"date",value:h,onChange:B=>v(B.target.value),className:y("w-full px-2 py-1.5 rounded text-xs border",z?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxs("div",{children:[jsx("label",{className:y("block text-[10px] uppercase tracking-wide mb-1",z?"text-gray-500":"text-gray-400"),children:K.endDate}),jsx("input",{type:"date",value:f,onChange:B=>x(B.target.value),className:y("w-full px-2 py-1.5 rounded text-xs border",z?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),C&&jsx("div",{className:y("px-3 pb-3 pt-0","border-t",z?"border-[#3a3a4e]":"border-gray-200"),children:jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(B=>jsx("button",{onClick:()=>D(T===B?"":B),className:y("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",T===B?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[B]} text-white`:z?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:K[B]},B))})})]}):jsxs("button",{onClick:()=>u(true),disabled:s,className:y("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",z?"hover:bg-[#2a2a3e]":"hover:bg-gray-100",s&&"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:K.buttonLabel})]})}var wo=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(fr,{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(n=>n.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,n)=>{r.toBlob(s=>{s?o(s):n(new Error("Failed to create PNG blob"));},"image/png");})}};function nd(e={}){return new wo(e)}var Qr=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:n}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${n||"Component"}:`,a),console.error("Error Info:",r)),this.setState({errorInfo:r}),o)try{o(a,r);}catch(s){console.error("Error in error handler:",s);}}render(){let{hasError:a,error:r}=this.state,{children:o,fallback:n,componentName:s}=this.props;return a&&r?n?n(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:s?`Error in ${s}`:"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 xs(e,t){let a=r=>jsx(Qr,{...t,children:jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function ws({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:n,onGeneratePlan:s,onPredictRisks:p,onOpenAIUsage:m,shortcut:l="k",className:u=""}){let[c,d]=useState(false),[i,w]=useState(""),[g,b]=useState("home"),[h,v]=useState(""),[f,x]=useState("");useEffect(()=>{let k=L=>{(L.metaKey||L.ctrlKey)&&L.key===l&&(L.preventDefault(),d(N=>!N)),L.key==="Escape"&&(d(false),b("home"),w(""));};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[l]),useEffect(()=>{c||(b("home"),w(""),v(""),x(""));},[c]);let T=useCallback(()=>{d(false);},[]),D=useCallback(k=>{let[L,N]=k.split(":");switch(L){case "create-card":b("create-card");break;case "create-card-in":v(N||"");break;case "navigate":N?(a?.(N),T()):b("navigate");break;case "search":r?.(i),T();break;case "priority":b("priority");break;case "set-priority":f&&N&&(o?.(f,N),T());break;case "assign":b("assign");break;case "assign-user":f&&N&&(n?.(f,N),T());break;case "ai":b("ai");break;case "ai-generate-plan":s?.(),T();break;case "ai-predict-risks":p?.(),T();break;case "ai-usage":m?.(),T();break;case "back":b("home");break;}},[i,f,t,a,r,o,n,s,p,m,T]),I=useCallback(()=>{h&&i.trim()&&(t?.(h,i.trim()),T());},[h,i,t,T]);return c?jsx(it,{children:jsx("div",{className:"command-palette-overlay",onClick:T,children:jsx("div",{className:`command-palette ${u}`,onClick:k=>k.stopPropagation(),children:jsxs(Command,{value:i,onValueChange:w,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:g==="create-card"&&h?"Type card title and press Enter...":g==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:k=>{k.key==="Enter"&&g==="create-card"&&h&&I();}}),jsxs("div",{className:"command-palette-shortcut",children:[jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsx("kbd",{children:"K"})]})]}),jsxs(Command.List,{className:"command-palette-list",children:[jsx(Command.Empty,{className:"command-palette-empty",children:"No results found."}),g==="home"&&jsxs(Fragment,{children:[jsxs(Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxs(Command.Item,{value:"create-card",onSelect:D,className:"command-palette-item",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),jsx("path",{d:"M12 8v8m-4-4h8"})]}),jsx("span",{children:"Create Card"}),jsx("div",{className:"command-palette-item-shortcut",children:"C"})]}),jsxs(Command.Item,{value:"navigate",onSelect:D,className:"command-palette-item",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("polyline",{points:"12 16 16 12 12 8"}),jsx("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]}),jsx("span",{children:"Navigate to Card"}),jsx("div",{className:"command-palette-item-shortcut",children:"G"})]}),jsxs(Command.Item,{value:"search",onSelect:D,className:"command-palette-item",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"11",cy:"11",r:"8"}),jsx("path",{d:"m21 21-4.35-4.35"})]}),jsx("span",{children:"Search Cards"}),jsx("div",{className:"command-palette-item-shortcut",children:"/"})]})]}),jsx(Command.Group,{heading:"AI Features",className:"command-palette-group",children:jsxs(Command.Item,{value:"ai",onSelect:D,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),jsx("span",{children:"AI Commands"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsx(Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(k=>jsxs(Command.Item,{value:`navigate:${k.id}`,onSelect:D,className:"command-palette-item",children:[jsx("div",{className:"command-palette-item-dot",style:{background:k.priority==="URGENT"?"#EF4444":k.priority==="HIGH"?"#F59E0B":k.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsx("span",{children:k.title}),k.labels&&k.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:k.labels.slice(0,2).map(L=>jsx("span",{className:"command-palette-item-label",children:L},L))})]},k.id))})]}),g==="create-card"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:D,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsx(Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(k=>jsxs(Command.Item,{value:`create-card-in:${k.id}`,onSelect:D,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"})}),jsx("span",{children:k.title}),jsxs("div",{className:"command-palette-item-count",children:[k.cardIds.length," cards"]})]},k.id))})]}),g==="navigate"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:D,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsx(Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(k=>{let L=e.columns.find(N=>N.id===k.columnId);return jsxs(Command.Item,{value:`navigate:${k.id}`,onSelect:D,className:"command-palette-item",keywords:[k.title,k.description||"",...k.labels||[]],children:[jsx("div",{className:"command-palette-item-dot",style:{background:k.priority==="URGENT"?"#EF4444":k.priority==="HIGH"?"#F59E0B":k.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxs("div",{className:"command-palette-item-content",children:[jsx("div",{children:k.title}),jsx("div",{className:"command-palette-item-meta",children:L?.title})]}),k.labels&&k.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:k.labels.slice(0,2).map(N=>jsx("span",{className:"command-palette-item-label",children:N},N))})]},k.id)})})]}),g==="ai"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:D,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsxs(Command.Group,{heading:"AI Features",className:"command-palette-group",children:[jsxs(Command.Item,{value:"ai-generate-plan",onSelect:D,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),jsx("span",{children:"Generate Project Plan"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxs(Command.Item,{value:"ai-predict-risks",onSelect:D,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsx("span",{children:"Predict Risks"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxs(Command.Item,{value:"ai-usage",onSelect:D,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),jsx("path",{d:"M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6"})]}),jsx("span",{children:"AI Usage & Costs"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]})]})]})]}),jsxs("div",{className:"command-palette-footer",children:[jsxs("div",{className:"command-palette-footer-hint",children:[jsx("kbd",{children:"\u2191"}),jsx("kbd",{children:"\u2193"}),jsx("span",{children:"Navigate"})]}),jsxs("div",{className:"command-palette-footer-hint",children:[jsx("kbd",{children:"Enter"}),jsx("span",{children:"Select"})]}),jsxs("div",{className:"command-palette-footer-hint",children:[jsx("kbd",{children:"Esc"}),jsx("span",{children:"Close"})]})]})]})})})}):null}function ld(e,t,a,r,o){let n=document.getElementById("attachment-lightbox-native");n&&n.remove();let s=document.createElement("div");s.id="attachment-lightbox-native",s.className="attachment-lightbox",s.style.cssText=`
|
|
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 gc 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,X,AlertCircle,CircleDot,ChevronDown,Check,Flag,Users,Calendar,ChevronLeft,Clock,Milestone,Rows3,FileImage,FileText,FileSpreadsheet,FileJson,FolderKanban,Download,GripVertical,Tag,List,Search,Image,File,CalendarDays,User,Sparkles,Maximize2,MoreHorizontal,ListChecks,Upload,MessageSquare,Send}from'lucide-react';import {Command}from'cmdk';import Au from'react-markdown';import Fu from'remark-gfm';import Iu from'rehype-sanitize';import {ResponsiveContainer,LineChart,CartesianGrid,XAxis,YAxis,Tooltip,Legend,Line,AreaChart,Area,PieChart,Pie,Cell,BarChart,Bar}from'recharts';var jo=(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 Ko=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 [Ko.Translate.toString(e),Ko.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function y(...e){return twMerge(clsx(e))}function Yo(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 _p(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function Qn(e,t){return e.length===0?1e3:t===0?Yo(null,e[0].position):t>=e.length?Yo(e[e.length-1].position,null):Yo(e[t-1].position,e[t].position)}function gl(e,t=100){return e>t}var Vp=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 jp(e,t,a,r){let o=t*Math.pow(a,e-1),n=o*.2*Math.random();return Math.min(o+n,r)}async function qo(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:n=1e4,shouldRetry:s=Vp,onRetry:c}=t,p,i=0;for(let u=1;u<=a;u++){i=u;try{return {data:await e(),attempts:i,success:!0}}catch(d){if(p=d,u===a||!s(p,u))return {error:p,attempts:i,success:false};let h=jp(u,r,o,n);if(c)try{c(p,u,h);}catch(b){console.error("Error in retry callback:",b);}await new Promise(b=>setTimeout(b,h));}}return {error:p||new Error("Unknown error"),attempts:i,success:false}}function Kp(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 Yp(e,t={}){return async(...a)=>qo(()=>e(...a),t)}var es=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 fl=(n=>(n[n.DEBUG=0]="DEBUG",n[n.INFO=1]="INFO",n[n.WARN=2]="WARN",n[n.ERROR=3]="ERROR",n[n.NONE=4]="NONE",n))(fl||{}),Pr=class Pr{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:n,...s}=t,c=`[${a}] [${r}] [${n}]`,p=Object.keys(s).length>0;switch(r){case "DEBUG":console.debug(c,o,p?s:"");break;case "INFO":console.info(c,o,p?s:"");break;case "WARN":console.warn(c,o,p?s:"");break;case "ERROR":console.error(c,o,p?s:""),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",...Pr.globalOptions};}static configure(t){Pr.globalOptions={...Pr.globalOptions,...t};}child(t){return new Pr({...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 Xo((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new Xo(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:fl[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};Pr.globalOptions={};var ts=Pr,Xo=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}},hl=new ts;function Xp(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 Jp(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(n=>{let s=e.columns.find(c=>c.id===n.columnId);return [n.id,as(n.title),as(n.description||""),as(s?.title||""),n.priority||"",(n.labels||[]).join(";"),(n.assignedUserIds||[]).join(";"),n.startDate||"",n.endDate||"",n.createdAt||"",n.updatedAt||""]});return [a.join(","),...r.map(n=>n.join(","))].join(`
|
|
2
|
+
`)}async function Zp(e,t,a){let r=t;if(!r){let s=document.querySelector(".asakaa-board");s&&(r=s.parentElement||s);}if(r)try{let s=await gc(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),c=s.toDataURL("image/png"),p=297,i=210,u=s.width/s.height,d=p-20,l=d/u;l>i-20&&(l=i-20,d=l*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,p,15,"F"),h.text(e.title||"Kanban Board",10,10);let b=(p-d)/2;return h.addImage(c,"PNG",b,20,d,l),h}catch(s){console.error("Error capturing board:",s);}let o=new jsPDF,n=20;return o.setFontSize(20),o.text(e.title||"Kanban Board",20,n),n+=10,o.setFontSize(10),o.setTextColor(128,128,128),o.text(`Exported on ${new Date().toLocaleString()}`,20,n),n+=15,o.setTextColor(0,0,0),e.columns.forEach(s=>{let c=e.cards.filter(p=>p.columnId===s.id);n>250&&(o.addPage(),n=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(s.title,20,n),n+=8,c.length===0?(o.setFontSize(10),o.setFont("helvetica","italic"),o.setTextColor(128,128,128),o.text("No cards in this column",20,n),o.setTextColor(0,0,0),n+=10):c.forEach(p=>{if(n>260&&(o.addPage(),n=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(p.title,25,n),n+=6,p.description){o.setFontSize(9),o.setFont("helvetica","normal");let u=o.splitTextToSize(p.description,160);o.text(u,25,n),n+=u.length*5;}let i=[];if(p.priority&&i.push(`Priority: ${p.priority}`),p.labels&&p.labels.length>0&&i.push(`Labels: ${p.labels.join(", ")}`),p.assignedUserIds&&p.assignedUserIds.length>0&&i.push(`Assigned: ${p.assignedUserIds.length} user(s)`),p.startDate||p.endDate){let u=[];p.startDate&&u.push(`Start: ${p.startDate}`),p.endDate&&u.push(`End: ${p.endDate}`),i.push(u.join(" \u2192 "));}i.length>0&&(o.setFontSize(8),o.setTextColor(100,100,100),o.text(i.join(" \u2022 "),25,n),o.setTextColor(0,0,0),n+=5),n+=5;}),n+=5;}),o}function as(e){return e.includes(",")||e.includes('"')||e.includes(`
|
|
3
|
+
`)?`"${e.replace(/"/g,'""')}"`:e}async function yl(e,t,a,r){switch(t){case "json":return Xp(e,r);case "csv":return Jp(e);case "pdf":return await Zp(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function vl(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 n=`${r}.${{json:"json",csv:"csv",pdf:"pdf"}[t]}`,s={json:"application/json",csv:"text/csv",pdf:"application/pdf"},c=new Blob([e],{type:s[t]}),p=URL.createObjectURL(c),i=document.createElement("a");i.href=p,i.download=n,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(p);}function Qp(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 em(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=xl(t[0]),r=[],o=new Map,n=[];for(let s=1;s<t.length;s++)try{let c=xl(t[s]||"");if(c.length>a.length){n.push(`Line ${s+1}: Too many columns`);continue}if(a.length-c.length>3){n.push(`Line ${s+1}: Column count mismatch (expected ${a.length}, got ${c.length})`);continue}for(;c.length<a.length;)c.push("");let i={};a.forEach((h,b)=>{i[h]=c[b]||"";});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),l={id:i["Card ID"]||`card-${s}`,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(l),d.cardIds.push(l.id);}catch(c){n.push(`Line ${s+1}: ${c instanceof Error?c.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...n]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:n.length>0?n:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function xl(e){let t=[],a="",r=false;for(let o=0;o<e.length;o++){let n=e[o],s=e[o+1];n==='"'&&r&&s==='"'?(a+='"',o++):n==='"'?r=!r:n===","&&!r?(t.push(a),a=""):a+=n;}return t.push(a),t}function kl(e,t){switch(t){case "json":return Qp(e);case "csv":return em(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function wl(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 rs=createContext(null);function Cl(){return useContext(rs)}var Tl=createContext(null);function Nl({children:e,themeName:t}){return jsx(Tl.Provider,{value:{themeName:t},children:e})}function qr(){return useContext(Tl)}function ot({children:e,container:t}){let[a,r]=useState(false),o=Cl(),n=qr();if(useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let s=t||(typeof document<"u"?document.body:null);if(!s)return null;if(o){let{theme:c,themeName:p}=o,i={"--asakaa-color-background-primary":c.bgPrimary,"--asakaa-color-background-secondary":c.bgSecondary,"--asakaa-color-background-card":c.bgGrid,"--asakaa-color-background-hover":c.hoverBg,"--asakaa-color-text-primary":c.textPrimary,"--asakaa-color-text-secondary":c.textSecondary,"--asakaa-color-text-tertiary":c.textTertiary,"--asakaa-color-text-inverse":c.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":c.border,"--asakaa-color-border-hover":c.borderLight,"--asakaa-color-border-subtle":c.borderLight,"--asakaa-color-interactive-primary":c.accent,"--asakaa-color-interactive-primaryHover":c.accentHover,"--asakaa-color-interactive-primaryBorder":`${c.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${c.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${c.accent}33`,"--asakaa-color-status-success":c.statusCompleted,"--asakaa-color-status-warning":c.milestone,"--asakaa-color-status-error":c.criticalPath,"--asakaa-color-danger":c.criticalPath,"--asakaa-color-danger-border":`${c.criticalPath}4D`,"--asakaa-color-danger-background":`${c.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${c.criticalPath}26`};return createPortal(jsx("div",{"data-theme":p,"data-gantt-portal":"true",style:i,children:e}),s)}return n?createPortal(jsx("div",{"data-theme":n.themeName,"data-kanban-portal":"true",children:e}),s):createPortal(e,s)}var Ml={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},lm="#BDC3C7",dm=({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 Mr({priority:e,onChange:t,className:a}){let[r,o]=useState(false),[n,s]=useState({top:0,left:0}),c=useRef(null),p=useRef(null),i=()=>{if(!p.current)return;let h=p.current.getBoundingClientRect(),b=window.innerHeight,m=window.innerWidth,v=160,w=220,g=4,f=h.right-v;f<10&&(f=h.left),f+v>m-10&&(f=m-v-10);let x=b-h.bottom,N=h.top,D;x>=w+g?D=h.bottom+g:N>=w+g?D=h.top-w-g:D=x>=N?h.bottom+g:Math.max(10,h.top-w-g),s({top:D,left:f}),o(true);};useEffect(()=>{let h=b=>{c.current&&!c.current.contains(b.target)&&!p.current?.contains(b.target)&&o(false);};if(r)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[r]),useEffect(()=>{let h=b=>{b.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?Ml[e]:null,l=d?.color||lm;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:p,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?`${l}10`:"transparent",boxShadow:e?`0 0 0 2px ${l}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:l,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:l,fillOpacity:e?"0.6":"0.4"})})}),r&&jsx(ot,{children:jsxs("div",{ref:c,className:"priority-selector-menu",style:{position:"fixed",top:`${n.top}px`,left:`${n.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(Ml).map(([h,b])=>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:b.color,background:"transparent"},onMouseEnter:m=>{m.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:m=>{m.currentTarget.style.background="transparent";},children:[jsx(dm,{color:b.color}),jsx("span",{className:"font-semibold text-sm",children:b.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 cm=[{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 bo({startDate:e,endDate:t,onChange:a,className:r}){let[o,n]=useState(false),[s,c]=useState({top:0,left:0}),p=useRef(null),i=useRef(null),l=(qr()?.themeName||"dark")==="dark",h=()=>{if(!i.current)return;let f=i.current.getBoundingClientRect(),x=window.innerHeight,N=window.innerWidth,D=320,I=380,k=4,$=f.left;$+D>N-10&&($=N-D-10),$<10&&($=10);let S=x-f.bottom,C=f.top,H;S>=I+k?H=f.bottom+k:C>=I+k?H=f.top-I-k:H=S>=C?f.bottom+k:Math.max(10,f.top-I-k),c({top:H,left:$}),n(true);};useEffect(()=>{let f=x=>{p.current&&!p.current.contains(x.target)&&!i.current?.contains(x.target)&&n(false);};if(o)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[o]),useEffect(()=>{let f=x=>{x.key==="Escape"&&n(false);};if(o)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[o]);let b=f=>{let x=new Date,N=$=>{let S=$.getFullYear(),C=String($.getMonth()+1).padStart(2,"0"),H=String($.getDate()).padStart(2,"0");return `${S}-${C}-${H}`},D=N(x),I=new Date(x);I.setDate(I.getDate()+f);let k=N(I);a(D,k),n(false);},m=()=>{if(!e||!t)return "Set date";let f=I=>{if(I instanceof Date)return I;if(typeof I!="string"||!I.match(/^\d{4}-\d{2}-\d{2}$/))return null;let k=I.split("-").map(Number);if(k.length!==3||k.some(H=>isNaN(H)))return null;let $=k[0],S=k[1],C=k[2];return $===void 0||S===void 0||C===void 0?null:new Date($,S-1,C)},x=f(e),N=f(t);if(!x||!N||isNaN(x.getTime())||isNaN(N.getTime()))return "Set date";let D=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${D[x.getMonth()]} ${x.getDate()} \u2013 ${D[N.getMonth()]} ${N.getDate()}`},v=e&&t,g=(()=>{if(!t)return false;let f=typeof t=="string"?new Date(t):t,x=new Date;return x.setHours(0,0,0,0),f<x})();return jsxs("div",{className:`relative ${r||""}`,children:[jsxs("button",{ref:i,onClick:()=>o?n(false):h(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${g?"asakaa-date-overdue":"asakaa-date"}`,title:v?`${m()}`:"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:m()})]}),o&&jsx(ot,{children:jsxs("div",{ref:p,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,background:l?"#1A1D25":"#FFFFFF",border:`1px solid ${l?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:l?"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:l?"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:l?"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:cm.map(f=>jsx("button",{onClick:()=>b(f.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:l?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${l?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:l?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:x=>{x.currentTarget.style.backgroundColor=l?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",x.currentTarget.style.border=`1px solid ${l?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:x=>{x.currentTarget.style.backgroundColor=l?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",x.currentTarget.style.border=`1px solid ${l?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:f.label},f.label))})]}),jsxs("div",{className:"p-4",children:[jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:l?"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:f=>a(f.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:l?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:l?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:l?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:l?"dark":"light"}}),jsx("input",{type:"date",value:t||"",onChange:f=>a(e,f.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:l?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:l?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:l?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:l?"dark":"light"}})]}),(e||t)&&jsx("button",{onClick:()=>{a(void 0,void 0),n(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:f=>{f.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:f=>{f.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function Fr({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[n,s]=useState(false),[c,p]=useState(""),[i,u]=useState({top:0,left:0}),d=useRef(null),l=useRef(null),h=()=>{if(!l.current)return;let g=l.current.getBoundingClientRect(),f=window.innerHeight,x=window.innerWidth,N=300,D=380,I=4,k=g.right-N;k<10&&(k=g.left),k+N>x-10&&(k=x-N-10);let $=f-g.bottom,S=g.top,C;$>=D+I?C=g.bottom+I:S>=D+I?C=g.top-D-I:C=$>=S?g.bottom+I:Math.max(10,g.top-D-I),u({top:C,left:k}),s(true);};useEffect(()=>{let g=f=>{d.current&&!d.current.contains(f.target)&&!l.current?.contains(f.target)&&(s(false),p(""));};if(n)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[n]),useEffect(()=>{let g=f=>{f.key==="Escape"&&(s(false),p(""));};if(n)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[n]);let b=g=>{let f=e.some(x=>x.id===g.id);a(f?e.filter(x=>x.id!==g.id):[...e,g]);},m=t.filter(g=>g.name.toLowerCase().includes(c.toLowerCase())),v=e.slice(0,o),w=e.length-o;return jsxs("div",{className:`relative ${r||""}`,children:[jsx("button",{ref:l,onClick:()=>n?s(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:[v.map(g=>jsx("div",{className:"asakaa-avatar",title:g.name,children:g.avatar?jsx("img",{src:g.avatar,alt:g.name,className:"asakaa-avatar-img"}):g.initials},g.id)),w>0&&jsxs("div",{className:"asakaa-avatar",children:["+",w]})]}):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"})]})})}),n&&jsx(ot,{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:c,onChange:g=>p(g.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:m.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"}):m.map(g=>{let f=e.some(x=>x.id===g.id);return jsxs("button",{onClick:()=>b(g),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:g.color,color:"#fff"},children:g.avatar?jsx("img",{src:g.avatar,alt:g.name,className:"w-full h-full rounded-full object-cover"}):g.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:g.name}),jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:f?"#3b82f6":"transparent"},children:f?"\u2713":""})]},g.id)})}),e.length>0&&jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsx("button",{onClick:()=>{a([]),s(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 Jo(e,t,a){let r=new Map;e.forEach(p=>{if(p.dependencies&&Array.isArray(p.dependencies)){let i=p.dependencies.map(u=>{if(typeof u=="string")return u;let d=u;return d.taskId||d.targetId||""}).filter(Boolean);r.set(p.id,i);}});let o=r.get(a)||[];r.set(a,[...o,t]);let n=new Set,s=new Set,c=p=>{if(!n.has(p)){n.add(p),s.add(p);let i=r.get(p)||[];for(let u of i){if(!n.has(u)&&c(u))return true;if(s.has(u))return true}}return s.delete(p),false};return c(a)}function vo({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:n=true,onCircularDependencyError:s}){let[c,p]=useState(false),[i,u]=useState(""),[d,l]=useState(t.length>0),[h,b]=useState({top:0,left:0}),[m,v]=useState(null),w=useRef(null),g=useRef(null),f=()=>{if(!g.current)return;let k=g.current.getBoundingClientRect(),$=window.innerHeight,S=window.innerWidth,C=300,H=d?380:120,B=4,J=k.right-C;J<10&&(J=k.left),J+C>S-10&&(J=S-C-10);let ne=$-k.bottom,xe=k.top,Pe;ne>=H+B?Pe=k.bottom+B:xe>=H+B?Pe=k.top-H-B:Pe=ne>=xe?k.bottom+B:Math.max(10,k.top-H-B),b({top:Pe,left:J}),p(true);};useEffect(()=>{if(!c||!g.current)return;let k=g.current.getBoundingClientRect(),$=window.innerHeight,S=window.innerWidth,C=300,H=d?380:120,B=4,J=k.right-C;J<10&&(J=k.left),J+C>S-10&&(J=S-C-10);let ne=$-k.bottom,xe=k.top,Pe;ne>=H+B?Pe=k.bottom+B:xe>=H+B?Pe=k.top-H-B:Pe=ne>=xe?k.bottom+B:Math.max(10,k.top-H-B),b({top:Pe,left:J});},[d,c]),useEffect(()=>{let k=$=>{w.current&&!w.current.contains($.target)&&!g.current?.contains($.target)&&(p(false),u(""));};if(c)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[c]),useEffect(()=>{let k=$=>{$.key==="Escape"&&(p(false),u(""));};if(c)return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[c]);let x=k=>{let $=t.includes(k),S=a.find(C=>C.id===k);if(v(null),$){let C=t.filter(H=>H!==k);r(C),C.length===0&&l(false);}else {if(n&&Jo(a,k,e)){let H=`Cannot add "${S?.title||k}" as dependency - would create circular reference`;v(H),s?.(k,S?.title||k),setTimeout(()=>v(null),3e3);return}r([...t,k]),l(true);}},N=()=>{let k=!d;l(k),k||r([]);},D=a.filter(k=>k.id!==e).filter(k=>k.title.toLowerCase().includes(i.toLowerCase())||k.id.toLowerCase().includes(i.toLowerCase())),I=t.length>0?"#3B82F6":"#BDC3C7";return jsxs("div",{className:`relative ${o||""}`,children:[jsxs("button",{ref:g,onClick:()=>c?p(false):f(),className:"flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5",title:t.length>0?`${t.length} dependencies`:"Add dependencies",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M7 9L9 7M11.5 3.5L10 2C8.89543 0.89543 7.10457 0.89543 6 2C4.89543 3.10457 4.89543 4.89543 6 6L7.5 7.5M4.5 12.5L6 14C7.10457 15.1046 8.89543 15.1046 10 14C11.1046 12.8954 11.1046 11.1046 10 10L8.5 8.5",stroke:I,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsx("span",{className:"text-xs font-medium",style:{color:I},children:t.length})]}),c&&jsx(ot,{children:jsxs("div",{ref:w,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:[m&&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:m})]}),jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:N,children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:d?"#3b82f6":"transparent",borderColor:d?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:d&&jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),d&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsx("input",{type:"text",value:i,onChange:k=>u(k.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:D.length===0?jsx("div",{className:"px-4 py-3 text-xs text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:"No tasks found"}):D.map(k=>{let $=t.includes(k.id);return jsxs("button",{onClick:()=>x(k.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:S=>{S.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:S=>{S.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:$?"#3b82f6":"transparent",borderColor:$?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:$&&jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxs("div",{className:"flex-1 text-left",children:[jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:k.title}),jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:k.id})]})]},k.id)})})]}),t.length>0&&jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsx("button",{onClick:()=>{r([]),l(false),p(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 or=memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:n,onUpdate:s,availableUsers:c=[],allCards:p=[]})=>{let{attributes:i,listeners:u,setNodeRef:d,transform:l,transition:h,isDragging:b}=useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),m={transform:Ko.Transform.toString(l),transition:h};if(t)return jsx("div",{ref:d,style:m,...i,...u,onClick:()=>a?.(e),children:t(e)});let v=c.filter(x=>e.assignedUserIds?.includes(x.id)),w=e.progress===100,g=(e.attachments||[]).filter(x=>x.type.startsWith("image/")),f={...m,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxs("div",{ref:d,style:f,className:y("asakaa-card",b&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",n),...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";}})}),g.length>0&&!e.coverImage&&jsx("div",{className:"asakaa-card-attachments mb-3",children:g.length===1&&g[0]?jsx("img",{src:g[0].url,alt:g[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:g.slice(0,4).map((x,N)=>jsxs("div",{className:"relative",children:[jsx("img",{src:x.url,alt:x.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:D=>{D.currentTarget.style.display="none";}}),N===3&&g.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:["+",g.length-4]})})]},x.id))})}),jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:w?"line-through":"none",opacity:w?.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(Mr,{priority:e.priority,onChange:x=>s?.(e.id,{priority:x})})}),jsx("div",{onClick:x=>x.stopPropagation(),className:"date-picker",children:jsx(bo,{startDate:e.startDate?typeof e.startDate=="string"?e.startDate:e.startDate.toISOString().split("T")[0]:void 0,endDate:e.endDate?typeof e.endDate=="string"?e.endDate:e.endDate.toISOString().split("T")[0]:void 0,onChange:(x,N)=>s?.(e.id,{startDate:x,endDate:N})})}),c.length>0&&jsx("div",{onClick:x=>x.stopPropagation(),className:"user-selector",children:jsx(Fr,{assignedUsers:v,availableUsers:c,onChange:x=>s?.(e.id,{assignedUserIds:x.map(N=>N.id)})})}),jsx("div",{onClick:x=>x.stopPropagation(),className:"dependencies-selector",children:jsx(vo,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(x=>typeof x=="string"?x:x.taskId):[],availableTasks:p,onChange:x=>s?.(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)));or.displayName="Card";var Zo={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"}},Ul=({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 Wl({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,n]=useState(false),[s,c]=useState({top:0,left:0}),p=useRef(null),i=useRef(null),u=[...Object.entries(Zo).map(([v,w])=>({id:v,label:w.label,color:w.color,icon:w.icon})),...r.filter(v=>!Object.keys(Zo).includes(v.id)).map(v=>({id:v.id,label:v.title,color:v.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let v=Zo[e];if(v)return {...v,id:e};let w=r.find(g=>g.id===e);return w?{id:w.id,label:w.title,color:w.color||"#8B5CF6",icon:"circle-dot"}:{...Zo.todo,id:"todo"}},l=()=>{if(!i.current)return;let v=i.current.getBoundingClientRect(),w=window.innerHeight,g=window.innerWidth,f=180,x=280,N=4,D=v.right-f;D<10&&(D=v.left),D+f>g-10&&(D=g-f-10);let I=w-v.bottom,k=v.top,$;I>=x+N?$=v.bottom+N:k>=x+N?$=v.top-x-N:$=I>=k?v.bottom+N:Math.max(10,v.top-x-N),c({top:$,left:D}),n(true);};useEffect(()=>{let v=w=>{p.current&&!p.current.contains(w.target)&&!i.current?.contains(w.target)&&n(false);};if(o)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[o]),useEffect(()=>{let v=w=>{w.key==="Escape"&&n(false);};if(o)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[o]);let h=v=>{t(v),n(false);},b=d(),m=b.color;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:i,onClick:()=>o?n(false):l(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${m}10`,boxShadow:`0 0 0 2px ${m}30 inset`},title:b.label,children:jsx(Ul,{icon:b.icon,color:m})}),o&&jsx(ot,{children:jsxs("div",{ref:p,className:"status-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.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(v=>jsxs("button",{onClick:()=>h(v.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:v.color,background:"transparent"},onMouseEnter:w=>{w.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:w=>{w.currentTarget.style.background="transparent";},children:[jsx(Ul,{icon:v.icon,color:v.color}),jsx("span",{className:"font-semibold",children:v.label}),e===v.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"})})]},v.id))})]})})]})}function Hl({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[n,s]=useState(false),[c,p]=useState(false),[i,u]=useState(e),[d,l]=useState({top:0,left:0}),h=useRef(null),b=useRef(null),m=useRef(null);useEffect(()=>{if(n&&b.current){let f=b.current.getBoundingClientRect();l({top:f.bottom+window.scrollY+8,left:f.left+window.scrollX});}},[n]),useEffect(()=>{let f=x=>{h.current&&!h.current.contains(x.target)&&!b.current?.contains(x.target)&&(s(false),p(false));};if(n)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[n]),useEffect(()=>{let f=x=>{x.key==="Escape"&&(s(false),p(false),u(e));};if(n)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[n,e]),useEffect(()=>{c&&m.current&&(m.current.focus(),m.current.select());},[c]);let v=()=>{p(true),u(e);},w=()=>{let f=i.trim();f&&f!==e&&t(f),p(false),s(false),u(e);},g=f=>{f.key==="Enter"?w():f.key==="Escape"&&(p(false),u(e));};return jsxs("div",{className:`relative ${o||""}`,children:[jsx("button",{ref:b,onClick:()=>s(!n),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"})]})}),n&&jsx(ot,{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:c?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:m,type:"text",value:i,onChange:f=>u(f.target.value),onKeyDown:g,onBlur:w,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:"Column name",maxLength:50})]}):jsxs("div",{className:"py-1",children:[jsxs("button",{onClick:v,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(),s(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 Zr=memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:n,onCardClick:s,onCardUpdate:c,availableUsers:p,allCards:i,enableVirtualization:u,cardHeight:d=120,isCollapsed:l,onToggleCollapse:h,onColumnRename:b,onColumnDelete:m,isDeletable:v=false,className:w})=>{let{setNodeRef:g,isOver:f}=useDroppable({id:e.id,data:{type:"column",column:e}}),x=useRef(null),N=u??gl(t.length),D=useVirtualizer({count:t.length,getScrollElement:()=>x.current,estimateSize:()=>d,enabled:N});if(a)return jsx("div",{ref:g,className:w,children:a(e,t)});let k=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let C=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:C}:C>=80?{state:"warning",percentage:C}:C>=60?{state:"approaching",percentage:C}:{state:"ok",percentage:C}})(),$=k.state==="exceeded",S=()=>"asakaa-column-count";return jsxs("div",{ref:g,className:y("asakaa-column",f&&"ring-2 ring-asakaa-accent-blue",$&&"ring-2 ring-asakaa-accent-red",w),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:y(S()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&k.state!=="none"&&jsxs("span",{className:"text-xs font-medium flex items-center",title:`${k.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[k.state==="exceeded"&&jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#EF4444",opacity:"0.9"}),jsx("path",{d:"M5 5L11 11M11 5L5 11",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]}),k.state==="warning"&&jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsx("path",{d:"M8 1L15 14H1L8 1Z",fill:"#F59E0B",opacity:"0.9"}),jsx("path",{d:"M8 6V9M8 11V11.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})]}),k.state==="approaching"&&jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M8 1L10 7H14L10 10L12 16L8 12L4 16L6 10L2 7H6L8 1Z",fill:"#FB923C",opacity:"0.9"})}),k.state==="ok"&&jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(b||m)&&jsx(Hl,{columnTitle:e.title,onRename:C=>b?.(e.id,C),onDelete:m?()=>m(e.id):void 0,isDeletable:v}),h&&jsx("button",{onClick:h,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":l?"Expand column":"Collapse column",children:l?"\u25B6":"\u25BC"})]})]}),!l&&jsx("div",{ref:x,className:"asakaa-column-cards",style:{maxHeight:N?"600px":void 0},children:jsx(SortableContext,{items:t.map(C=>C.id),strategy:verticalListSortingStrategy,children:t.length===0?n?n(e):jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsx("p",{children:"Drop cards here"})}):N?jsx("div",{style:{height:`${D.getTotalSize()}px`,position:"relative"},children:D.getVirtualItems().map(C=>{let H=t[C.index];return H?jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${C.start}px)`},children:jsx(or,{card:H,render:r,onClick:s,onUpdate:c,availableUsers:p,allCards:i})},H.id):null})}):t.map(C=>jsx(or,{card:C,render:r,onClick:s,onUpdate:c,availableUsers:p,allCards:i},C.id))})})]})});Zr.displayName="Column";function ls({title:e,onSave:t,className:a}){let[r,o]=useState(false),[n,s]=useState(e),c=useRef(null);useEffect(()=>{r&&c.current&&(c.current.focus(),c.current.select());},[r]);let p=()=>{let u=n.trim();u&&u!==e?t(u):s(e),o(false);},i=u=>{u.key==="Enter"?p():u.key==="Escape"&&(s(e),o(false));};return r?jsx("input",{ref:c,type:"text",value:n,onChange:u=>s(u.target.value),onBlur:p,onKeyDown:i,className:y("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsx("h2",{className:y("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}var an=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function Xa({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:n=false,compact:s=true}){let[c,p]=useState(false),[i,u]=useState(""),[d,l]=useState(false),[h,b]=useState(an[10]||"#3B82F6"),[m,v]=useState({top:0,left:0}),w=useRef(null),g=useRef(null),f=useRef(null),x=useRef(null),N=t.filter(C=>C.name.toLowerCase().includes(i.toLowerCase())),D=t.some(C=>C.name.toLowerCase()===i.toLowerCase());useEffect(()=>{if(c&&g.current){let C=g.current.getBoundingClientRect();v({top:C.bottom+6,left:C.left});}},[c]),useEffect(()=>{let C=H=>{let B=H.target,J=w.current?.contains(B),ne=f.current?.contains(B);!J&&!ne&&(p(false),u(""),l(false));};if(c)return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[c]),useEffect(()=>{c&&x.current&&x.current.focus();},[c]);let I=C=>{let H=e.some(B=>B.id===C.id);a(H?e.filter(B=>B.id!==C.id):[...e,C]);},k=async()=>{if(!(!r||!i.trim())){l(true);try{let C=await r(i.trim(),h);C&&(a([...e,C]),u(""),b(an[Math.floor(Math.random()*an.length)]||"#3B82F6"));}finally{l(false);}}},$=(C,H)=>{H.stopPropagation(),a(e.filter(B=>B.id!==C));},S={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxs("div",{ref:w,className:"relative",children:[jsxs("button",{ref:g,type:"button",onClick:()=>!n&&p(!c),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:S,disabled:n,children:[jsx(Tag,{className:"w-3.5 h-3.5"}),e.length>0?jsxs("div",{className:"flex items-center gap-1",children:[e.slice(0,2).map(C=>jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${C.color}20`,color:C.color},children:C.name},C.id)),e.length>2&&jsxs("span",{className:"text-xs",style:{color:o.textTertiary},children:["+",e.length-2]})]}):jsx("span",{children:"Agregar"}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:o.textTertiary}})]}),typeof document<"u"&&createPortal(jsx(AnimatePresence,{children:c&&jsxs(motion.div,{ref:f,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:m.top,left:m.left,zIndex:99999,backgroundColor:o.bgPrimary,border:`1px solid ${o.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsx("div",{className:"p-2 border-b",style:{borderColor:o.border},children:jsx("input",{ref:x,type:"text",value:i,onChange:C=>u(C.target.value),placeholder:"Buscar o crear etiqueta...",className:"w-full px-3 py-1.5 text-sm rounded-md outline-none",style:{backgroundColor:o.bgSecondary,color:o.textPrimary,border:`1px solid ${o.borderLight}`},onKeyDown:C=>{C.key==="Enter"&&i.trim()&&!D&&r&&k();}})}),e.length>0&&jsxs("div",{className:"p-2 border-b",style:{borderColor:o.border},children:[jsx("p",{className:"text-xs mb-1.5",style:{color:o.textTertiary},children:"Seleccionadas"}),jsx("div",{className:"flex flex-wrap gap-1",children:e.map(C=>jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium cursor-pointer hover:opacity-80",style:{backgroundColor:`${C.color}20`,color:C.color},onClick:H=>$(C.id,H),children:[C.name,jsx(X,{className:"w-3 h-3"})]},C.id))})]}),jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:N.length>0?N.map(C=>{let H=e.some(B=>B.id===C.id);return jsxs("button",{type:"button",onClick:()=>I(C),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:H?`${C.color}15`:"transparent",color:o.textPrimary},onMouseEnter:B=>{H||(B.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:B=>{H||(B.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:C.color}}),jsx("span",{className:"flex-1 text-left",children:C.name}),H&&jsx(Check,{className:"w-4 h-4",style:{color:C.color}})]},C.id)}):i.trim()?jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No se encontraron etiquetas"}):jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No hay etiquetas disponibles"})}),i.trim()&&!D&&r&&jsxs("div",{className:"p-2 border-t",style:{borderColor:o.border},children:[jsx("div",{className:"flex items-center gap-2 mb-2",children:jsx("p",{className:"text-xs",style:{color:o.textTertiary},children:"Crear nueva etiqueta"})}),jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:an.map(C=>jsx("button",{type:"button",onClick:()=>b(C),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:C,outline:h===C?`2px solid ${C}`:"none",outlineOffset:"2px"}},C))}),jsxs("button",{type:"button",onClick:k,disabled:d,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor: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 cs({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 jl({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(n=>jsx(cs,{tag:n,size:a},n.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]})]})}function Xl(e,t=[]){if("title"in e&&!("name"in e)){let a=e,r=(a.assignedUserIds||[]).map(o=>{let n=t.find(s=>s.id===o);return n||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 Xm(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 ms({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:n="dark",locale:s="es",availableUsers:c=[],availableTags:p=[],onCreateTag:i,attachments:u=[],onUploadAttachments:d,onDeleteAttachment:l,availableTasks:h=[]}){let b=n==="dark",m={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)"},v=e&&"title"in e&&!("name"in e),w=e,[g,f]=useState(e?Xl(e,c):null),[x,N]=useState(false),[D,I]=useState(false),[k,$]=useState(false),[S,C]=useState(null),[H,B]=useState(new Date),[J,ne]=useState(false),[xe,Pe]=useState(false),[Re,le]=useState(""),[z,L]=useState(false),[W,E]=useState(false);useEffect(()=>{e&&f(Xl(e,c));},[e?.id,c]);let q=useCallback(O=>{f(O),v&&o&&w?o(Xm(O,w)):r&&r(O);},[v,w,o,r]),Z=useCallback(()=>{N(false),I(false),$(false),C(null),Pe(false),le("");},[]),U=useCallback((O,F)=>{if(!g)return;let K={...g,[O]:F};q(K);},[g,q]),ke=useCallback(O=>{if(!g)return;let F=g.progress||0;O==="completed"?F=100:O==="in-progress"&&F===0?F=10:O==="todo"&&(F=0);let K={...g,status:O,progress:F};q(K),N(false);},[g,q]),Ne=useCallback((O,F)=>{if(!g)return;let K={...g,startDate:O,endDate:F};q(K);},[g,q]),Fe=useCallback(()=>{let O=H.getFullYear(),F=H.getMonth(),K=new Date(O,F,1),ge=new Date(O,F+1,0).getDate(),Se=K.getDay(),Ke=[],yt=new Date(O,F,0).getDate();for(let pe=Se-1;pe>=0;pe--)Ke.push({date:new Date(O,F-1,yt-pe),isCurrentMonth:false});for(let pe=1;pe<=ge;pe++)Ke.push({date:new Date(O,F,pe),isCurrentMonth:true});let Be=42-Ke.length;for(let pe=1;pe<=Be;pe++)Ke.push({date:new Date(O,F+1,pe),isCurrentMonth:false});return Ke},[H]),ye=useCallback(async O=>{if(O.preventDefault(),O.stopPropagation(),L(false),!g||!d)return;let F=Array.from(O.dataTransfer.files);if(F.length!==0){E(true);try{await d(g.id,F);}finally{E(false);}}},[g,d]),tt=useCallback(async O=>{if(!g||!d||!O.target.files)return;let F=Array.from(O.target.files);if(F.length!==0){E(true);try{await d(g.id,F);}finally{E(false);}O.target.value="";}},[g,d]),Ie=useCallback(O=>{O.preventDefault(),O.stopPropagation(),L(true);},[]),st=useCallback(O=>{O.preventDefault(),O.stopPropagation(),L(false);},[]),it=useCallback(O=>O<1024?`${O} B`:O<1024*1024?`${(O/1024).toFixed(1)} KB`:`${(O/(1024*1024)).toFixed(1)} MB`,[]),dt=useCallback(O=>O.startsWith("image/")?Image:O.includes("pdf")||O.includes("document")?FileText:File,[]);return !t||!g?null:jsx(AnimatePresence,{children:t&&g&&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:y("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:y("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:y("w-4 h-4",b?"text-[#9CA3AF]":"text-gray-500")}),jsxs("span",{className:y("text-xs px-2 py-0.5 rounded",b?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[s==="es"?"Tarea":"Task"," \u2228"]}),jsx("span",{className:y("text-xs font-mono",b?"text-[#6B7280]":"text-gray-400"),children:g.id.slice(0,8)}),jsxs("button",{className:y("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:y("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:y("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:y("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 O=g.progress===100?0:100,K={...g,progress:O,status:O===100?"completed":"todo"};q(K);},className:y("mt-1 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors",g.progress===100?"bg-green-500 border-green-500":b?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:g.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("h2",{className:y("text-xl font-semibold flex-1",g.progress===100?"line-through text-[#6B7280]":b?"text-white":"text-gray-900"),children:g.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:y("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:y("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Estado":"Status"}),jsx("button",{onClick:()=>{Z(),N(!x);},className:y("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",g.progress===100||g.status==="completed"?"bg-green-500/20 text-green-400":g.progress&&g.progress>0||g.status==="in-progress"?"bg-blue-500/20 text-blue-400":b?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:g.progress===100||g.status==="completed"?s==="es"?"COMPLETADO":"DONE":g.progress&&g.progress>0||g.status==="in-progress"?s==="es"?"EN PROGRESO":"IN PROGRESS":s==="es"?"POR HACER":"TO DO"}),jsx(AnimatePresence,{children:x&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>N(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:y("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:s==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:s==="es"?"En progreso":"In Progress",color:"bg-blue-500"},{id:"completed",label:s==="es"?"Completado":"Done",color:"bg-green-500"}].map(O=>jsxs("button",{onClick:()=>ke(O.id),className:y("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",g.status===O.id&&(b?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:y("w-2 h-2 rounded-full",O.color)}),jsx("span",{className:b?"text-white":"text-gray-900",children:O.label})]},O.id))})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(User,{className:y("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:y("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Asignados":"Assignees"}),jsxs("button",{onClick:()=>{Z(),$(!k);},className:y("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:[g.assignees&&g.assignees.length>0?jsxs("div",{className:"flex items-center gap-1",children:[g.assignees.slice(0,3).map((O,F)=>jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:O.color||"#8B5CF6"},title:O.name,children:O.initials||O.name.slice(0,2).toUpperCase()},F)),g.assignees.length>3&&jsxs("span",{className:y("text-xs",b?"text-[#6B7280]":"text-gray-400"),children:["+",g.assignees.length-3]})]}):jsx("span",{className:y("text-sm",b?"text-[#6B7280]":"text-gray-400"),children:s==="es"?"Agregar":"Add"}),jsx(ChevronDown,{className:y("w-3 h-3",b?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:k&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>$(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:y("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:c.length>0?c.map(O=>{let F=g.assignees?.some(K=>K.name===O.name);return jsxs("button",{onClick:()=>{let K=g.assignees||[],ae;F?ae=K.filter(ge=>ge.name!==O.name):ae=[...K,O],U("assignees",ae);},className:y("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",F&&(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:O.color||"#8B5CF6"},children:O.initials||O.name.slice(0,2).toUpperCase()}),jsx("span",{className:y("flex-1",b?"text-white":"text-gray-900"),children:O.name}),F&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},O.name)}):jsx("div",{className:y("px-3 py-4 text-sm text-center",b?"text-[#6B7280]":"text-gray-500"),children:s==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CalendarDays,{className:y("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:y("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Fechas":"Dates"}),jsxs("button",{onClick:()=>{C(S?null:"start"),B(g.startDate||new Date);},className:y("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:[g.startDate?.toLocaleDateString(s==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(s==="es"?"Inicio":"Start"),jsx("span",{className:y("mx-1",b?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),g.endDate?.toLocaleDateString(s==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(s==="es"?"Fin":"End")]}),jsx(AnimatePresence,{children:S&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>C(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:y("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:O=>O.stopPropagation(),children:[jsx("div",{className:y("w-44 py-2 border-r",b?"border-white/10":"border-gray-200"),children:(()=>{let O=new Date,F=new Date(O);F.setDate(O.getDate()+1);let K=new Date(O);K.setDate(O.getDate()+7);let ae=new Date(O);return ae.setDate(O.getDate()+14),[{label:s==="es"?"Hoy":"Today",date:O},{label:s==="es"?"Ma\xF1ana":"Tomorrow",date:F},{label:s==="es"?"Pr\xF3xima semana":"Next week",date:K},{label:s==="es"?"2 semanas":"2 weeks",date:ae}].map((ge,Se)=>jsxs("button",{className:y("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:()=>{S==="start"?(Ne(ge.date,g.endDate),C("end")):(Ne(g.startDate,ge.date),C(null));},children:[jsx("span",{children:ge.label}),jsx("span",{className:y("text-xs",b?"text-[#6B7280]":"text-gray-400"),children:ge.date.toLocaleDateString(s==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]},Se))})()}),jsxs("div",{className:"p-4 w-[280px]",children:[jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("span",{className:y("text-sm font-medium",b?"text-white":"text-gray-900"),children:S==="start"?s==="es"?"Fecha inicio":"Start date":s==="es"?"Fecha fin":"End date"}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>B(new Date(H.getFullYear(),H.getMonth()-1)),className:y("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("span",{className:y("text-sm min-w-[100px] text-center",b?"text-white":"text-gray-900"),children:H.toLocaleDateString(s==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsx("button",{onClick:()=>B(new Date(H.getFullYear(),H.getMonth()+1)),className:y("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:(s==="es"?["L","M","M","J","V","S","D"]:["S","M","T","W","T","F","S"]).map((O,F)=>jsx("div",{className:y("text-xs text-center py-1",b?"text-[#6B7280]":"text-gray-400"),children:O},F))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:Fe().map((O,F)=>{let K=O.date.toDateString()===new Date().toDateString(),ae=g.startDate?.toDateString()===O.date.toDateString(),ge=g.endDate?.toDateString()===O.date.toDateString(),Se=g.startDate&&g.endDate&&O.date>=g.startDate&&O.date<=g.endDate;return jsx("button",{onClick:()=>{S==="start"?(Ne(O.date,g.endDate&&O.date>g.endDate?O.date:g.endDate),C("end")):(Ne(g.startDate&&O.date<g.startDate?O.date:g.startDate,O.date),C(null));},className:y("w-8 h-8 text-xs rounded-lg transition-colors",!O.isCurrentMonth&&(b?"text-[#4B5563]":"text-gray-300"),O.isCurrentMonth&&(b?"text-white":"text-gray-900"),K&&"ring-1 ring-blue-500",(ae||ge)&&"bg-blue-500 text-white",Se&&!ae&&!ge&&(b?"bg-blue-500/20":"bg-blue-100"),b?"hover:bg-white/10":"hover:bg-gray-100"),children:O.date.getDate()},F)})})]})]})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Flag,{className:y("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:y("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Prioridad":"Priority"}),jsx("button",{onClick:()=>{Z(),I(!D);},className:y("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",g.priority==="high"||g.priority==="urgent"?"bg-red-500/20 text-red-400":g.priority==="medium"?"bg-yellow-500/20 text-yellow-400":g.priority==="low"?"bg-green-500/20 text-green-400":b?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:g.priority?g.priority==="high"||g.priority==="urgent"?s==="es"?"Alta":"High":g.priority==="medium"?s==="es"?"Media":"Medium":s==="es"?"Baja":"Low":s==="es"?"Sin prioridad":"No priority"}),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:y("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:s==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:s==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:s==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:s==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:s==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(O=>jsxs("button",{onClick:()=>{U("priority",O.id),I(false);},className:y("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",g.priority===O.id&&(b?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:y("w-2 h-2 rounded-full",O.color)}),jsx("span",{className:b?"text-white":"text-gray-900",children:O.label})]},O.id||"none"))})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:y("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:y("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Duraci\xF3n":"Duration"}),jsx("span",{className:y("text-sm",b?"text-white":"text-gray-900"),children:g.startDate&&g.endDate?`${Math.ceil((g.endDate.getTime()-g.startDate.getTime())/(1e3*60*60*24))} ${s==="es"?"d\xEDas":"days"}`:s==="es"?"Sin definir":"Not set"})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:y("w-4 h-4 rounded-full border-2",b?"border-[#6B7280]":"border-gray-400")}),jsx("span",{className:y("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Progreso":"Progress"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[J?jsx("input",{type:"range",min:"0",max:"100",step:"5",value:g.progress||0,onChange:O=>{let F=parseInt(O.target.value),K=g.status;F===100?K="completed":F>0?K="in-progress":K="todo";let ae={...g,progress:F,status:K};q(ae);},onBlur:()=>ne(false),className:y("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:()=>ne(true),className:y("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:y("h-full rounded-full transition-all",g.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${g.progress||0}%`}})}),jsxs("span",{className:y("text-sm font-medium min-w-[40px]",b?"text-white":"text-gray-900"),children:[g.progress||0,"%"]})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Tag,{className:y("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:y("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Etiquetas":"Tags"}),jsx(Xa,{selectedTags:g.tags||[],availableTags:p,onChange:O=>{U("tags",O);},onCreateTag:i,theme:m})]}),jsxs("div",{className:"flex items-start gap-3 relative",children:[jsx(Link2,{className:y("w-4 h-4 mt-1.5",b?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:y("text-sm w-24 mt-1",b?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Relaciones":"Relations"}),jsxs("div",{className:"flex-1",children:[g.dependencies&&g.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:g.dependencies.map(O=>{let F=h.find(K=>K.id===O);return jsxs("span",{className:y("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:[F?.name||O.slice(0,8),jsx("button",{onClick:()=>{let K=(g.dependencies||[]).filter(ae=>ae!==O);U("dependencies",K);},className:y("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsx(X,{className:"w-3 h-3"})})]},O)})}),jsxs("button",{onClick:()=>{Z(),Pe(!xe);},className:y("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:y("text-sm",b?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Agregar dependencia":"Add dependency"})]}),jsx(AnimatePresence,{children:xe&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Pe(false),le("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:y("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:y("p-2 border-b",b?"border-white/10":"border-gray-200"),children:jsx("input",{type:"text",value:Re,onChange:O=>le(O.target.value),placeholder:s==="es"?"Buscar tarea...":"Search task...",className:y("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(O=>O.id!==g.id).filter(O=>Re===""||O.name.toLowerCase().includes(Re.toLowerCase())).map(O=>{let F=g.dependencies?.includes(O.id);return jsxs("button",{onClick:()=>{let K=g.dependencies||[],ae;F?ae=K.filter(ge=>ge!==O.id):ae=[...K,O.id],U("dependencies",ae);},className:y("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",F&&(b?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:y("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",F?"bg-blue-500 border-blue-500":b?"border-white/30":"border-gray-300"),children:F&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:y("block truncate",b?"text-white":"text-gray-900"),children:O.name}),jsx("span",{className:y("text-xs",b?"text-[#6B7280]":"text-gray-400"),children:O.id.slice(0,8)})]})]},O.id)}):jsx("div",{className:y("px-3 py-4 text-sm text-center",b?"text-[#6B7280]":"text-gray-500"),children:s==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]})]}),jsxs("div",{className:y("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:y("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsx("h3",{className:y("text-sm font-semibold",b?"text-white":"text-gray-900"),children:s==="es"?"Descripci\xF3n":"Description"})]}),jsx("textarea",{value:g.description||"",onChange:O=>U("description",O.target.value),placeholder:s==="es"?"Agregar descripci\xF3n...":"Add description...",className:y("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:y("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"}),s==="es"?"Escribe con IA":"Write with AI"]})]}),jsxs("div",{className:y("mt-6 pt-4 border-t",b?"border-white/10":"border-gray-200"),children:[jsx("h3",{className:y("text-sm font-semibold mb-3",b?"text-white":"text-gray-900"),children:s==="es"?"Campos personalizados":"Custom fields"}),jsxs("button",{className:y("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"}),s==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxs("div",{className:y("mt-6 pt-4 border-t",b?"border-white/10":"border-gray-200"),children:[jsx("h3",{className:y("text-sm font-semibold mb-3",b?"text-white":"text-gray-900"),children:s==="es"?"Subtareas":"Subtasks"}),g.subtasks&&g.subtasks.length>0&&jsx("div",{className:"space-y-2 mb-3",children:g.subtasks.map(O=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:y("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",O.progress===100?"bg-green-500 border-green-500":b?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:O.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("span",{className:y("text-sm",O.progress===100?"line-through text-[#6B7280]":b?"text-white":"text-gray-900"),children:O.name})]},O.id))}),jsxs("button",{className:y("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"}),s==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxs("div",{className:y("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:y("text-sm font-semibold",b?"text-white":"text-gray-900"),children:s==="es"?"Listas de control":"Checklists"}),jsx("button",{className:y("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:y("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"}),s==="es"?"Crear lista de control":"Create checklist"]})]}),jsxs("div",{className:y("mt-6 pt-4 border-t",b?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:y("text-sm font-semibold mb-3",b?"text-white":"text-gray-900"),children:[s==="es"?"Adjuntos":"Attachments",u.length>0&&jsxs("span",{className:y("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(O=>{let F=dt(O.type),K=O.type.startsWith("image/");return jsxs("div",{className:y("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:[K&&O.thumbnailUrl?jsx("img",{src:O.thumbnailUrl,alt:O.name,className:"w-10 h-10 rounded object-cover"}):jsx("div",{className:y("w-10 h-10 rounded flex items-center justify-center",b?"bg-white/10":"bg-gray-200"),children:jsx(F,{className:y("w-5 h-5",b?"text-[#9CA3AF]":"text-gray-500")})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("a",{href:O.url,target:"_blank",rel:"noopener noreferrer",className:y("text-sm font-medium truncate block hover:underline",b?"text-white":"text-gray-900"),children:O.name}),jsx("p",{className:y("text-xs",b?"text-[#6B7280]":"text-gray-400"),children:it(O.size)})]}),l&&jsx("button",{onClick:()=>l(O.id),className:y("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:s==="es"?"Eliminar":"Delete",children:jsx(Trash2,{className:"w-4 h-4"})})]},O.id)})}),jsxs("div",{onDragOver:Ie,onDragLeave:st,onDrop:ye,className:y("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",z?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",W&&"pointer-events-none opacity-50"),children:[jsx("input",{type:"file",multiple:true,onChange:tt,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!d||W}),W?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:y("text-sm",b?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Subiendo...":"Uploading..."})]}):jsxs(Fragment,{children:[jsx(Upload,{className:y("w-6 h-6 mx-auto mb-2",z?"text-blue-500":b?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:y("text-sm",b?"text-[#9CA3AF]":"text-gray-500"),children:z?s==="es"?"Suelta los archivos aqu\xED":"Drop files here":s==="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:y("text-xs mt-1",b?"text-[#6B7280]":"text-gray-400"),children:s==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxs("div",{className:y("w-80 border-l flex flex-col",b?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsx("div",{className:y("px-4 py-3 border-b",b?"border-white/10":"border-gray-200"),children:jsx("h3",{className:y("text-sm font-semibold",b?"text-white":"text-gray-900"),children:s==="es"?"Actividad":"Activity"})}),jsx("div",{className:"flex-1 overflow-y-auto p-4",children:jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsx(MessageSquare,{className:y("w-10 h-10 mb-3",b?"text-[#3B4252]":"text-gray-300")}),jsx("p",{className:y("text-sm",b?"text-[#6B7280]":"text-gray-500"),children:s==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsx("div",{className:y("p-4 border-t",b?"border-white/10":"border-gray-200"),children:jsxs("div",{className:y("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",placeholder:s==="es"?"Escribe un comentario...":"Write a comment...",className:y("flex-1 bg-transparent text-sm outline-none",b?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400")}),jsx("button",{className:y("p-1.5 rounded transition-colors",b?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600"),children:jsx(Send,{className:"w-4 h-4"})})]})})]})]})]})})}function gs(){let[e,t]=useState(()=>dragStore.getState());useEffect(()=>dragStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{dragStore.setState(r);},[]);return [e,a]}function br({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:n=[],className:s,style:c,isLoading:p,error:i,children:u,availableTags:d=[],onCreateTag:l,attachmentsByCard:h,onUploadAttachments:b,onDeleteAttachment:m}){let[v,w]=gs(),[g,f]=useState(null),x=o?.theme||"dark",N=x==="dark"||x==="neutral",D=N?"dark":"",I=useCallback((le,z)=>{t.onCardUpdate?.(le,z);},[t]),k=useCallback((le,z)=>{t.onColumnUpdate?.(le,{title:z});},[t]),$=useCallback(le=>{t.onColumnDelete?.(le);},[t]),S=["todo","in-progress","completed"],C=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),H=useMemo(()=>{let le=new Map;return e.columns.forEach(z=>{let L=z.cardIds.map(W=>e.cards.find(E=>E.id===W)).filter(W=>W!==void 0).sort((W,E)=>W.position-E.position);le.set(z.id,L);}),le},[e.cards,e.columns]),B=useMemo(()=>e.cards.map(le=>({id:le.id,name:le.title,startDate:le.startDate?new Date(le.startDate):void 0,endDate:le.endDate?new Date(le.endDate):void 0,progress:le.progress||0,status:le.columnId,priority:le.priority?.toLowerCase(),dependencies:Array.isArray(le.dependencies)?le.dependencies.map(z=>typeof z=="string"?z:z.taskId):[]})),[e.cards]),J=useCallback(le=>{let{active:z}=le,L=e.cards.find(W=>W.id===z.id);L&&w({isDragging:true,draggedCardId:L.id,sourceColumnId:L.columnId,targetColumnId:L.columnId});},[e.cards,w]),ne=useCallback(le=>{let{active:z,over:L}=le;if(!L||!e.cards.find(q=>q.id===z.id))return;let E=null;L.data.current?.type==="column"?E=L.id:L.data.current?.type==="card"&&(E=e.cards.find(Z=>Z.id===L.id)?.columnId||null),E&&E!==v.targetColumnId&&w({...v,targetColumnId:E});},[e.cards,v,w]),xe=useCallback(async le=>{let{active:z,over:L}=le;if(w({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!L)return;let W=e.cards.find(U=>U.id===z.id);if(!W)return;let E,q;if(L.data.current?.type==="column"){E=L.id;let U=H.get(E)||[];q=Qn(U,0);}else {let U=e.cards.find(Fe=>Fe.id===L.id);if(!U)return;E=U.columnId;let ke=H.get(E)||[],Ne=ke.findIndex(Fe=>Fe.id===L.id);q=Qn(ke,Ne);}let Z=e.columns.find(U=>U.id===E);if(Z&&Z.wipLimit&&Z.wipLimitType==="hard"){let U=H.get(E)||[];if(W.columnId!==E&&U.length>=Z.wipLimit){t.onWipLimitExceeded?.(Z,W);return}}(W.columnId!==E||W.position!==q)&&await t.onCardMove?.(W.id,E,q);},[e.cards,e.columns,H,t,w]),Pe=useCallback(le=>{f(le),a?.(le);},[a]),Re=useCallback(le=>{t.onCardUpdate?.(le.id,le),f(le);},[t]);return p?jsx("div",{className:y("asakaa-board",D,s),style:c,children:jsx(lu,{columnCount:3})}):i?jsx("div",{className:y("asakaa-board",D,s),style:c,children:jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxs("div",{className:"text-center",children:[jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof i=="string"?i:i.message})]})})}):jsxs(Nl,{themeName:x,children:[jsxs(DndContext,{sensors:C,collisionDetection:closestCorners,onDragStart:J,onDragOver:ne,onDragEnd:xe,children:[jsxs("div",{className:y("asakaa-board",D,s),style:c,"data-theme":x,children:[e.columns.sort((le,z)=>le.position-z.position).map(le=>{let z=H.get(le.id)||[],L=!S.includes(le.id);return jsx(Zr,{column:le,cards:z,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:Pe,onCardUpdate:I,onColumnRename:k,onColumnDelete:$,isDeletable:L,availableUsers:n,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},le.id)}),u]}),jsx(DragOverlay,{children:v.draggedCardId?jsx(or,{card:e.cards.find(le=>le.id===v.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),jsx(ms,{task:g,isOpen:!!g,onClose:()=>f(null),onCardUpdate:Re,theme:N?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:n,availableTags:d,onCreateTag:l,attachments:g?h?.get(g.id)||[]:[],onUploadAttachments:b,onDeleteAttachment:m,availableTasks:B})]})}function lu({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 uu={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)"},gu={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)"},fu={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},hu={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function bu({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[n,s]=useState(false),c=useRef(null);useEffect(()=>{let i=u=>{c.current&&!c.current.contains(u.target)&&s(false);};return n&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]);let p=i=>{t(i),s(false);};return jsxs("div",{ref:c,className:"relative",children:[jsxs(motion.button,{onClick:()=>s(!n),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:n?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:n&&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:()=>p(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 yu({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[n,s]=useState(false),[c,p]=useState(null),i=useRef(null);if(useEffect(()=>{let h=b=>{i.current&&!i.current.contains(b.target)&&s(false);};return n&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[n]),!(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),l=async(h,b)=>{if(b){p(h);try{await b();}catch(m){console.error(`Export ${h} failed:`,m);}finally{p(null),s(false);}}};return jsxs("div",{ref:i,className:"relative",children:[jsxs(motion.button,{onClick:()=>s(!n),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:n?e.accent:e.bgSecondary,border:`1px solid ${n?e.accent:e.borderLight}`,color:n?"#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:n?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:n&&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,b)=>jsxs(motion.button,{onClick:()=>l(h.id,h.handler),disabled:c!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:b<d.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:c===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 vu({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 hs({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:n=false,onExportCSV:s,onExportJSON:c,onExportExcel:p,translations:i}){let u=r==="dark"?uu:gu,d={...o==="es"?fu:hu,...i},l=s||c||p;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:[l&&jsxs(Fragment,{children:[jsx(yu,{theme:u,t:d,onExportCSV:s,onExportJSON:c,onExportExcel:p}),t&&jsx("div",{className:"w-px h-6",style:{backgroundColor:u.borderLight}})]}),t&&(n?jsx(bu,{columns:e,onSelect:t,theme:u,t:d,createTaskLabel:a}):jsx(vu,{onClick:()=>t(),label:a||d.newTask}))]})})}function ys({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[n,s]=useState(false),[c,p]=useState(""),i=useCallback(()=>{let l=c.trim();l&&(e(l),p(""),s(false));},[c,e]),u=useCallback(l=>{l.key==="Enter"?(l.preventDefault(),i()):l.key==="Escape"&&(p(""),s(false));},[i]),d=useCallback(()=>{setTimeout(()=>{c.trim()||s(false);},150);},[c]);return n?jsx("div",{className:y("asakaa-add-column asakaa-add-column--editing",t),children:jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsx("input",{type:"text",value:c,onChange:l=>p(l.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:!c.trim(),className:"asakaa-add-column__submit",type:"button",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsx("button",{onClick:()=>{p(""),s(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:y("asakaa-add-column",t),children:jsxs("button",{onClick:()=>s(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 vs({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:n,disabled:s=false,theme:c="dark",locale:p="es"}){let[i,u]=useState(false),[d,l]=useState(false),[h,b]=useState(""),[m,v]=useState([]),[w,g]=useState(""),[f,x]=useState(""),[N,D]=useState(""),[I,k]=useState(false),[$,S]=useState(false),[C,H]=useState(false),B=useRef(null),J=useRef(null),ne={placeholder:o||(p==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:n||(p==="es"?"Agregar Tarea":"Add Task"),save:p==="es"?"Guardar":"Save",addAssignee:p==="es"?"Agregar asignado":"Add assignee",addDates:p==="es"?"Agregar fechas":"Add dates",addPriority:p==="es"?"Agregar prioridad":"Add priority",startDate:p==="es"?"Inicio":"Start",endDate:p==="es"?"Fin":"End",low:p==="es"?"Baja":"Low",medium:p==="es"?"Media":"Medium",high:p==="es"?"Alta":"High",urgent:p==="es"?"Urgente":"Urgent"},xe=useCallback(()=>{b(""),v([]),g(""),x(""),D(""),k(false),S(false),H(false),u(false);},[]);useEffect(()=>{i&&B.current&&B.current.focus();},[i]),useEffect(()=>{if(!i)return;let L=W=>{J.current&&!J.current.contains(W.target)&&(h.trim()||xe());};return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[i,h,xe]);let Pe=useCallback(async()=>{let L=h.trim();if(!(!L||d)){l(true);try{await t({name:L,columnId:e,assigneeIds:m.length>0?m:void 0,startDate:w?new Date(w):void 0,endDate:f?new Date(f):void 0,priority:N||void 0}),b(""),v([]),g(""),x(""),D(""),k(!1),S(!1),H(!1),B.current?.focus();}catch(W){console.error("Error creating card:",W);}finally{l(false);}}},[h,e,m,w,f,N,t,d]),Re=useCallback(L=>{L.key==="Enter"&&!L.shiftKey?(L.preventDefault(),Pe()):L.key==="Escape"&&xe();},[Pe,xe]),le=useCallback(L=>{v(W=>W.includes(L)?W.filter(E=>E!==L):[...W,L]);},[]),z=c==="dark";return i?jsxs("div",{ref:J,className:y("rounded-lg overflow-hidden shadow-lg",z?"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:L=>b(L.target.value),onKeyDown:Re,placeholder:ne.placeholder,disabled:d,className:y("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",z?"text-gray-100 placeholder-gray-500":"text-gray-800 placeholder-gray-400")}),jsxs("div",{className:"flex items-center gap-1 mt-3",children:[a.length>0&&jsxs("button",{onClick:()=>k(!I),className:y("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",I||m.length>0?"bg-emerald-500/20 text-emerald-400":z?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:ne.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"})]}),m.length>0&&jsx("span",{className:"ml-0.5",children:m.length})]}),jsx("button",{onClick:()=>S(!$),className:y("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",$||w||f?"bg-blue-500/20 text-blue-400":z?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:ne.addDates,children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]})}),jsx("button",{onClick:()=>H(!C),className:y("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",C||N?N==="urgent"?"bg-red-500/20 text-red-400":N==="high"?"bg-orange-500/20 text-orange-400":N==="medium"?"bg-yellow-500/20 text-yellow-400":N==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":z?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:ne.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:Pe,disabled:!h.trim()||d,className:y("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"}):ne.save})]})]}),I&&a.length>0&&jsx("div",{className:y("px-3 pb-3 pt-0","border-t",z?"border-[#3a3a4e]":"border-gray-200"),children:jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(L=>jsxs("button",{onClick:()=>le(L.id),className:y("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",m.includes(L.id)?"bg-emerald-500 text-white":z?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[L.avatar?jsx("img",{src:L.avatar,alt:L.name,className:"w-4 h-4 rounded-full"}):jsx("div",{className:y("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",m.includes(L.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:L.name.charAt(0).toUpperCase()}),jsx("span",{children:L.name.split(" ")[0]})]},L.id))})}),$&&jsx("div",{className:y("px-3 pb-3 pt-0","border-t",z?"border-[#3a3a4e]":"border-gray-200"),children:jsxs("div",{className:"grid grid-cols-2 gap-2 pt-3",children:[jsxs("div",{children:[jsx("label",{className:y("block text-[10px] uppercase tracking-wide mb-1",z?"text-gray-500":"text-gray-400"),children:ne.startDate}),jsx("input",{type:"date",value:w,onChange:L=>g(L.target.value),className:y("w-full px-2 py-1.5 rounded text-xs border",z?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxs("div",{children:[jsx("label",{className:y("block text-[10px] uppercase tracking-wide mb-1",z?"text-gray-500":"text-gray-400"),children:ne.endDate}),jsx("input",{type:"date",value:f,onChange:L=>x(L.target.value),className:y("w-full px-2 py-1.5 rounded text-xs border",z?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),C&&jsx("div",{className:y("px-3 pb-3 pt-0","border-t",z?"border-[#3a3a4e]":"border-gray-200"),children:jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(L=>jsx("button",{onClick:()=>D(N===L?"":L),className:y("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",N===L?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[L]} text-white`:z?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:ne[L]},L))})})]}):jsxs("button",{onClick:()=>u(true),disabled:s,className:y("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",z?"hover:bg-[#2a2a3e]":"hover:bg-gray-100",s&&"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:ne.buttonLabel})]})}var Co=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(br,{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(n=>n.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,n)=>{r.toBlob(s=>{s?o(s):n(new Error("Failed to create PNG blob"));},"image/png");})}};function ld(e={}){return new Co(e)}var to=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:n}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${n||"Component"}:`,a),console.error("Error Info:",r)),this.setState({errorInfo:r}),o)try{o(a,r);}catch(s){console.error("Error in error handler:",s);}}render(){let{hasError:a,error:r}=this.state,{children:o,fallback:n,componentName:s}=this.props;return a&&r?n?n(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:s?`Error in ${s}`:"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 xs(e,t){let a=r=>jsx(to,{...t,children:jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function ws({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:n,onGeneratePlan:s,onPredictRisks:c,onOpenAIUsage:p,shortcut:i="k",className:u=""}){let[d,l]=useState(false),[h,b]=useState(""),[m,v]=useState("home"),[w,g]=useState(""),[f,x]=useState("");useEffect(()=>{let k=$=>{($.metaKey||$.ctrlKey)&&$.key===i&&($.preventDefault(),l(S=>!S)),$.key==="Escape"&&(l(false),v("home"),b(""));};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[i]),useEffect(()=>{d||(v("home"),b(""),g(""),x(""));},[d]);let N=useCallback(()=>{l(false);},[]),D=useCallback(k=>{let[$,S]=k.split(":");switch($){case "create-card":v("create-card");break;case "create-card-in":g(S||"");break;case "navigate":S?(a?.(S),N()):v("navigate");break;case "search":r?.(h),N();break;case "priority":v("priority");break;case "set-priority":f&&S&&(o?.(f,S),N());break;case "assign":v("assign");break;case "assign-user":f&&S&&(n?.(f,S),N());break;case "ai":v("ai");break;case "ai-generate-plan":s?.(),N();break;case "ai-predict-risks":c?.(),N();break;case "ai-usage":p?.(),N();break;case "back":v("home");break;}},[h,f,t,a,r,o,n,s,c,p,N]),I=useCallback(()=>{w&&h.trim()&&(t?.(w,h.trim()),N());},[w,h,t,N]);return d?jsx(ot,{children:jsx("div",{className:"command-palette-overlay",onClick:N,children:jsx("div",{className:`command-palette ${u}`,onClick:k=>k.stopPropagation(),children:jsxs(Command,{value:h,onValueChange:b,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:m==="create-card"&&w?"Type card title and press Enter...":m==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:k=>{k.key==="Enter"&&m==="create-card"&&w&&I();}}),jsxs("div",{className:"command-palette-shortcut",children:[jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsx("kbd",{children:"K"})]})]}),jsxs(Command.List,{className:"command-palette-list",children:[jsx(Command.Empty,{className:"command-palette-empty",children:"No results found."}),m==="home"&&jsxs(Fragment,{children:[jsxs(Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxs(Command.Item,{value:"create-card",onSelect:D,className:"command-palette-item",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),jsx("path",{d:"M12 8v8m-4-4h8"})]}),jsx("span",{children:"Create Card"}),jsx("div",{className:"command-palette-item-shortcut",children:"C"})]}),jsxs(Command.Item,{value:"navigate",onSelect:D,className:"command-palette-item",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("polyline",{points:"12 16 16 12 12 8"}),jsx("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]}),jsx("span",{children:"Navigate to Card"}),jsx("div",{className:"command-palette-item-shortcut",children:"G"})]}),jsxs(Command.Item,{value:"search",onSelect:D,className:"command-palette-item",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"11",cy:"11",r:"8"}),jsx("path",{d:"m21 21-4.35-4.35"})]}),jsx("span",{children:"Search Cards"}),jsx("div",{className:"command-palette-item-shortcut",children:"/"})]})]}),jsx(Command.Group,{heading:"AI Features",className:"command-palette-group",children:jsxs(Command.Item,{value:"ai",onSelect:D,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),jsx("span",{children:"AI Commands"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsx(Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(k=>jsxs(Command.Item,{value:`navigate:${k.id}`,onSelect:D,className:"command-palette-item",children:[jsx("div",{className:"command-palette-item-dot",style:{background:k.priority==="URGENT"?"#EF4444":k.priority==="HIGH"?"#F59E0B":k.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsx("span",{children:k.title}),k.labels&&k.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:k.labels.slice(0,2).map($=>jsx("span",{className:"command-palette-item-label",children:$},$))})]},k.id))})]}),m==="create-card"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:D,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsx(Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(k=>jsxs(Command.Item,{value:`create-card-in:${k.id}`,onSelect:D,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"})}),jsx("span",{children:k.title}),jsxs("div",{className:"command-palette-item-count",children:[k.cardIds.length," cards"]})]},k.id))})]}),m==="navigate"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:D,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsx(Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(k=>{let $=e.columns.find(S=>S.id===k.columnId);return jsxs(Command.Item,{value:`navigate:${k.id}`,onSelect:D,className:"command-palette-item",keywords:[k.title,k.description||"",...k.labels||[]],children:[jsx("div",{className:"command-palette-item-dot",style:{background:k.priority==="URGENT"?"#EF4444":k.priority==="HIGH"?"#F59E0B":k.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxs("div",{className:"command-palette-item-content",children:[jsx("div",{children:k.title}),jsx("div",{className:"command-palette-item-meta",children:$?.title})]}),k.labels&&k.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:k.labels.slice(0,2).map(S=>jsx("span",{className:"command-palette-item-label",children:S},S))})]},k.id)})})]}),m==="ai"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:D,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsxs(Command.Group,{heading:"AI Features",className:"command-palette-group",children:[jsxs(Command.Item,{value:"ai-generate-plan",onSelect:D,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),jsx("span",{children:"Generate Project Plan"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxs(Command.Item,{value:"ai-predict-risks",onSelect:D,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsx("span",{children:"Predict Risks"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxs(Command.Item,{value:"ai-usage",onSelect:D,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),jsx("path",{d:"M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6"})]}),jsx("span",{children:"AI Usage & Costs"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]})]})]})]}),jsxs("div",{className:"command-palette-footer",children:[jsxs("div",{className:"command-palette-footer-hint",children:[jsx("kbd",{children:"\u2191"}),jsx("kbd",{children:"\u2193"}),jsx("span",{children:"Navigate"})]}),jsxs("div",{className:"command-palette-footer-hint",children:[jsx("kbd",{children:"Enter"}),jsx("span",{children:"Select"})]}),jsxs("div",{className:"command-palette-footer-hint",children:[jsx("kbd",{children:"Esc"}),jsx("span",{children:"Close"})]})]})]})})})}):null}function pd(e,t,a,r,o){let n=document.getElementById("attachment-lightbox-native");n&&n.remove();let s=document.createElement("div");s.id="attachment-lightbox-native",s.className="attachment-lightbox",s.style.cssText=`
|
|
6
6
|
position: fixed !important;
|
|
7
7
|
inset: 0 !important;
|
|
8
8
|
z-index: 2147483647 !important;
|
|
@@ -11,12 +11,12 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
11
11
|
justify-content: center !important;
|
|
12
12
|
background: rgba(0, 0, 0, 0.95) !important;
|
|
13
13
|
cursor: pointer !important;
|
|
14
|
-
`;let
|
|
14
|
+
`;let c=document.createElement("img");c.src=e,c.alt=t,c.className="attachment-lightbox-image",c.style.cssText=`
|
|
15
15
|
max-width: 92vw !important;
|
|
16
16
|
max-height: 92vh !important;
|
|
17
17
|
object-fit: contain !important;
|
|
18
18
|
cursor: default !important;
|
|
19
|
-
`,
|
|
19
|
+
`,c.onclick=d=>d.stopPropagation();let p=document.createElement("div");p.className="attachment-lightbox-hint",p.textContent="Click anywhere or press ESC to close",p.style.cssText=`
|
|
20
20
|
position: absolute !important;
|
|
21
21
|
bottom: 24px !important;
|
|
22
22
|
left: 50% !important;
|
|
@@ -24,7 +24,7 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
24
24
|
font-size: 12px !important;
|
|
25
25
|
color: rgba(255, 255, 255, 0.4) !important;
|
|
26
26
|
pointer-events: none !important;
|
|
27
|
-
`;let
|
|
27
|
+
`;let i=()=>{s.remove(),document.removeEventListener("keydown",u);},u=d=>{if(d.key==="Escape")i();else if(d.key==="ArrowLeft"&&a.length>1){let l=r>0?r-1:a.length-1;i(),o(l);}else if(d.key==="ArrowRight"&&a.length>1){let l=r<a.length-1?r+1:0;i(),o(l);}};if(s.onclick=i,document.addEventListener("keydown",u),a.length>1){let d=document.createElement("div");d.className="attachment-lightbox-dots",d.style.cssText=`
|
|
28
28
|
position: absolute !important;
|
|
29
29
|
bottom: 48px !important;
|
|
30
30
|
left: 50% !important;
|
|
@@ -34,15 +34,15 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
34
34
|
padding: 8px 12px !important;
|
|
35
35
|
background: rgba(0, 0, 0, 0.4) !important;
|
|
36
36
|
border-radius: 20px !important;
|
|
37
|
-
`,
|
|
37
|
+
`,d.onclick=b=>b.stopPropagation(),a.forEach((b,m)=>{let v=document.createElement("button");v.className=`attachment-lightbox-dot ${m===r?"active":""}`,v.style.cssText=`
|
|
38
38
|
width: 8px !important;
|
|
39
39
|
height: 8px !important;
|
|
40
40
|
border-radius: 50% !important;
|
|
41
|
-
background: ${
|
|
41
|
+
background: ${m===r?"white":"rgba(255, 255, 255, 0.3)"} !important;
|
|
42
42
|
border: none !important;
|
|
43
43
|
padding: 0 !important;
|
|
44
44
|
cursor: pointer !important;
|
|
45
|
-
`,
|
|
45
|
+
`,v.onclick=w=>{w.stopPropagation(),i(),o(m);},d.appendChild(v);});let l=document.createElement("button");l.className="attachment-lightbox-nav-area attachment-lightbox-nav-prev",l.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M15 18L9 12L15 6" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',l.style.cssText=`
|
|
46
46
|
position: absolute !important;
|
|
47
47
|
left: 0 !important;
|
|
48
48
|
top: 0 !important;
|
|
@@ -55,7 +55,7 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
55
55
|
border: none !important;
|
|
56
56
|
cursor: pointer !important;
|
|
57
57
|
opacity: 0.5 !important;
|
|
58
|
-
`,
|
|
58
|
+
`,l.onmouseenter=()=>{l.style.opacity="1";},l.onmouseleave=()=>{l.style.opacity="0.5";},l.onclick=b=>{b.stopPropagation();let m=r>0?r-1:a.length-1;i(),o(m);};let h=document.createElement("button");h.className="attachment-lightbox-nav-area attachment-lightbox-nav-next",h.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M9 18L15 12L9 6" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',h.style.cssText=`
|
|
59
59
|
position: absolute !important;
|
|
60
60
|
right: 0 !important;
|
|
61
61
|
top: 0 !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
|
-
`,i.onmouseenter=()=>{i.style.opacity="1";},i.onmouseleave=()=>{i.style.opacity="0.5";},i.onclick=w=>{w.stopPropagation();let g=r<a.length-1?r+1:0;l(),o(g);},s.appendChild(c),s.appendChild(d),s.appendChild(i);}s.appendChild(p),s.appendChild(m),document.body.appendChild(s),setTimeout(()=>{m.style.transition="opacity 0.5s ease",m.style.opacity="0";},2e3);}function Tu(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 Du(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 Ts(e){return e.startsWith("image/")}function qa({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:n=10}){let[s,p]=useState(false),[m,l]=useState(false),[u,c]=useState(null),d=useRef(null),i=useRef(e);i.current=e;let w=useCallback((k,L)=>{L.preventDefault(),L.stopPropagation();let N=i.current.filter(F=>Ts(F.type)),C=N.findIndex(F=>F.id===k.id),G=F=>{let J=i.current.filter(de=>Ts(de.type)),K=J[F];K&&ld(K.url,K.name,J,F,G);};ld(k.url,k.name,N,C,G);},[]),g=useCallback(k=>{let L=[],N=[];return e.length+k.length>n?(N.push(`Maximum ${n} files allowed`),{valid:L,errors:N}):(k.forEach(C=>{if(C.size/1048576>r){N.push(`${C.name} is too large (max ${r}MB)`);return}if(o&&!o.some(F=>C.type.match(F))){N.push(`${C.name} has invalid file type`);return}L.push(C);}),{valid:L,errors:N})},[e.length,n,r,o]),b=useCallback(async k=>{let{valid:L,errors:N}=g(k);if(N.length>0){c(N.join(", ")),setTimeout(()=>c(null),5e3);return}if(L.length!==0){l(true),c(null);try{await t?.(L);}catch(C){c(C instanceof Error?C.message:"Upload failed"),setTimeout(()=>c(null),5e3);}finally{l(false);}}},[g,t]),h=useCallback(k=>{k.preventDefault(),k.stopPropagation(),p(true);},[]),v=useCallback(k=>{k.preventDefault(),k.stopPropagation(),p(false);},[]),f=useCallback(k=>{k.preventDefault(),k.stopPropagation();},[]),x=useCallback(k=>{k.preventDefault(),k.stopPropagation(),p(false);let L=Array.from(k.dataTransfer.files);b(L);},[b]),T=useCallback(k=>{let L=k.target.files?Array.from(k.target.files):[];b(L),d.current&&(d.current.value="");},[b]),D=useCallback(()=>{d.current?.click();},[]),I=useCallback(k=>{confirm("Are you sure you want to delete this attachment?")&&a?.(k);},[a]);return jsxs("div",{className:"attachment-uploader",children:[jsxs("div",{className:`attachment-dropzone ${s?"dragging":""} ${m?"uploading":""}`,onDragEnter:h,onDragLeave:v,onDragOver:f,onDrop:x,onClick:D,children:[jsx("input",{ref:d,type:"file",multiple:true,onChange:T,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:s?"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,"/",n," 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(k=>jsxs("div",{className:"attachment-item",children:[jsx("div",{className:"attachment-preview",children:Ts(k.type)&&k.url?jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:L=>w(k,L),title:"Click to view full size",children:[jsx("img",{src:k.thumbnailUrl||k.url,alt:k.name,className:"attachment-thumbnail"}),jsx("div",{className:"attachment-thumbnail-overlay",children:jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M9 21H3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M21 3L14 10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M3 21L10 14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})]}):jsx("div",{className:"attachment-icon",children:Du(k.type)})}),jsxs("div",{className:"attachment-info",children:[jsx("a",{href:k.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:k.name,children:k.name}),jsxs("div",{className:"attachment-meta",children:[jsx("span",{className:"attachment-size",children:Tu(k.size)}),jsx("span",{className:"attachment-separator",children:"\u2022"}),jsx("span",{className:"attachment-date",children:new Date(k.uploadedAt).toLocaleDateString()})]})]}),jsx("button",{onClick:()=>I(k.id),className:"attachment-delete",title:"Delete attachment",type:"button",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},k.id))})]})}function Ds({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:n=[],comments:s=[],activities:p=[],aiInsights:m=[],attachments:l=[],onAddComment:u,onDeleteComment:c,onUploadAttachments:d,onDeleteAttachment:i,onSuggestAssignee:w,onGenerateSubtasks:g,onEstimateEffort:b,currentUserId:h="user-1"}){let[v,f]=useState("details"),[x,T]=useState(false),[D,I]=useState({}),[k,L]=useState(""),[N,C]=useState(false),[G,F]=useState({});if(!t||!e)return null;let J=useCallback(()=>{T(false),I({}),f("details"),L(""),F({}),a();},[a]),K=useCallback(()=>{r&&Object.keys(D).length>0&&(r(e.id,D),I({}),T(false));},[e.id,D,r]),de=useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),J());},[e.id,o,J]),ge=useCallback(()=>{u&&k.trim()&&(u(e.id,k.trim()),L(""));},[e.id,k,u]),Te=useCallback(async()=>{if(w){C(true);try{let P=await w(e);F(Q=>({...Q,assignees:P}));}catch(P){console.error("Failed to suggest assignee:",P);}finally{C(false);}}},[e,w]),Ce=useCallback(async()=>{if(g){C(true);try{let P=await g(e);F(Q=>({...Q,subtasks:P}));}catch(P){console.error("Failed to generate subtasks:",P);}finally{C(false);}}},[e,g]),z=useCallback(async()=>{if(b){C(true);try{let P=await b(e);F(Q=>({...Q,effort:P}));}catch(P){console.error("Failed to estimate effort:",P);}finally{C(false);}}},[e,b]),B={...e,...D},$=n.filter(P=>B.assignedUserIds?.includes(P.id));return jsx(it,{children:jsx("div",{className:"card-detail-overlay",onClick:J,children:jsxs("div",{className:"card-detail-modal",onClick:P=>P.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:B.priority==="URGENT"?"#EF4444":B.priority==="HIGH"?"#F59E0B":B.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),x?jsx("input",{type:"text",value:D.title??B.title,onChange:P=>I({...D,title:P.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsx("h2",{className:"card-detail-title",children:B.title})]}),jsxs("div",{className:"card-detail-header-actions",children:[x?jsxs(Fragment,{children:[jsx("button",{onClick:K,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsx("button",{onClick:()=>{T(false),I({});},className:"card-detail-btn",children:"Cancel"})]}):jsxs("button",{onClick:()=>T(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:de,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:J,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:()=>f("details"),className:`card-detail-tab ${v==="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:()=>f("comments"),className:`card-detail-tab ${v==="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",s.length>0&&jsx("span",{className:"card-detail-tab-badge",children:s.length})]}),jsxs("button",{onClick:()=>f("activity"),className:`card-detail-tab ${v==="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:()=>f("attachments"),className:`card-detail-tab ${v==="attachments"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",l.length>0&&jsx("span",{className:"card-detail-tab-badge",children:l.length})]}),jsxs("button",{onClick:()=>f("ai"),className:`card-detail-tab ${v==="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:[v==="details"&&jsxs("div",{className:"card-detail-details",children:[jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Description"}),x?jsx("textarea",{value:D.description??B.description??"",onChange:P=>I({...D,description:P.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsx("p",{className:"card-detail-text",children:B.description||"No description"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Assigned To"}),x?jsx("select",{multiple:true,value:D.assignedUserIds??B.assignedUserIds??[],onChange:P=>{let Q=Array.from(P.target.selectedOptions,ee=>ee.value);I({...D,assignedUserIds:Q});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:n.map(P=>jsx("option",{value:P.id,children:P.name},P.id))}):jsx("div",{className:"card-detail-users",children:$.length>0?$.map(P=>jsxs("div",{className:"card-detail-user",children:[jsx("div",{className:"card-detail-user-avatar",style:{background:P.color},children:P.initials}),jsx("span",{children:P.name})]},P.id)):jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Priority"}),x?jsxs("select",{value:D.priority??B.priority??"",onChange:P=>I({...D,priority:P.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:B.priority==="URGENT"?"#EF4444":B.priority==="HIGH"?"#F59E0B":B.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsx("span",{children:B.priority||"None"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Labels"}),jsx("div",{className:"card-detail-labels",children:B.labels&&B.labels.length>0?B.labels.map(P=>jsx("span",{className:"card-detail-label-tag",children:P},P)):jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxs("div",{className:"card-detail-section-row",children:[jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Start Date"}),x?jsx("input",{type:"date",value:D.startDate?new Date(D.startDate).toISOString().split("T")[0]:B.startDate?new Date(B.startDate).toISOString().split("T")[0]:"",onChange:P=>I({...D,startDate:P.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:B.startDate?new Date(B.startDate).toLocaleDateString():"Not set"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"End Date"}),x?jsx("input",{type:"date",value:D.endDate?new Date(D.endDate).toISOString().split("T")[0]:B.endDate?new Date(B.endDate).toISOString().split("T")[0]:"",onChange:P=>I({...D,endDate:P.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:B.endDate?new Date(B.endDate).toLocaleDateString():"Not set"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),x?jsx("input",{type:"number",min:"0",step:"0.5",value:D.estimatedTime??B.estimatedTime??"",onChange:P=>I({...D,estimatedTime:P.target.value?parseFloat(P.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsx("span",{className:"card-detail-text",children:B.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:B.dependencies&&B.dependencies.length>0?B.dependencies.map(P=>{let Q=typeof P=="string"?P:P.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:B.createdAt?new Date(B.createdAt).toLocaleString():"Unknown"})]})]}),v==="comments"&&jsxs("div",{className:"card-detail-comments",children:[jsxs("div",{className:"card-detail-comment-form",children:[jsx("textarea",{value:k,onChange:P=>L(P.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsx("button",{onClick:ge,disabled:!k.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsx("div",{className:"card-detail-comments-list",children:s.length>0?s.map(P=>{let Q=n.find(ee=>ee.id===P.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(P.createdAt).toLocaleString()})]})]}),c&&jsx("button",{onClick:()=>c(P.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:P.content})]},P.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"})]})})]}),v==="activity"&&jsx("div",{className:"card-detail-activity",children:p.length>0?jsx("div",{className:"card-detail-activity-list",children:p.map(P=>{let Q=n.find(ee=>ee.id===P.userId);return jsxs("div",{className:"card-detail-activity-item",children:[jsxs("div",{className:"card-detail-activity-icon",children:[P.type.includes("CREATED")&&"\u2795",P.type.includes("UPDATED")&&"\u270F\uFE0F",P.type.includes("MOVED")&&"\u27A1\uFE0F",P.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",P.type.includes("COMMENT")&&"\u{1F4AC}",P.type.includes("ASSIGNED")&&"\u{1F464}",P.type.includes("PRIORITY")&&"\u{1F3AF}",P.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",P.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"})," ",P.type.replace(/_/g," ").toLowerCase(),P.newValue&&jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsx("strong",{children:P.newValue})]})]}),jsx("div",{className:"card-detail-activity-time",children:new Date(P.timestamp).toLocaleString()})]})]},P.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"})]})}),v==="attachments"&&jsx("div",{className:"card-detail-attachments",children:jsx(qa,{cardId:e.id,attachments:l,onUpload:d?P=>d(e.id,P):void 0,onDelete:i,currentUserId:h,maxSizeMB:10,maxFiles:20})}),v==="ai"&&jsxs("div",{className:"card-detail-ai",children:[jsxs("div",{className:"card-detail-ai-actions",children:[jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxs("button",{onClick:Te,disabled:N||!w,className:"card-detail-ai-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("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:Ce,disabled:N||!g,className:"card-detail-ai-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("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:z,disabled:N||!b,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"]})]}),G.assignees&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Assignee Suggestions"}),G.assignees.map((P,Q)=>{let ee=n.find(H=>H.id===P.userId);return jsxs("div",{className:"card-detail-ai-suggestion",children:[ee&&jsx("div",{className:"card-detail-user-avatar",style:{background:ee.color},children:ee.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-ai-suggestion-name",children:ee?.name}),jsx("div",{className:"card-detail-ai-suggestion-reason",children:P.reasoning}),jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(P.confidence*100).toFixed(0),"%"]})]})]},Q)})]}),G.subtasks&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Suggested Subtasks"}),G.subtasks.map((P,Q)=>jsxs("div",{className:"card-detail-ai-subtask",children:[jsx("div",{className:"card-detail-ai-subtask-title",children:P.title}),P.description&&jsx("div",{className:"card-detail-ai-subtask-desc",children:P.description}),P.estimatedTime&&jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",P.estimatedTime,"h"]})]},Q))]}),G.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:[G.effort.hours," hours"]}),jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(G.effort.confidence*100).toFixed(0),"%"]})]})]}),m.length>0&&jsxs("div",{className:"card-detail-ai-insights",children:[jsx("h4",{children:"AI Insights"}),m.map(P=>jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${P.severity.toLowerCase()}`,children:[jsxs("div",{className:"card-detail-ai-insight-header",children:[jsx("span",{className:"card-detail-ai-insight-title",children:P.title}),jsx("span",{className:"card-detail-ai-insight-severity",children:P.severity})]}),jsx("p",{className:"card-detail-ai-insight-desc",children:P.description}),P.suggestedAction&&jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",P.suggestedAction]})]},P.id))]}),!G.assignees&&!G.subtasks&&!G.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 To({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:n=300,className:s=""}){let[p,m]=useState({top:0,left:0}),l=useRef(null),u=useCallback(()=>{if(!e.current)return {top:0,left:0};let c=e.current.getBoundingClientRect(),d=window.innerHeight,i=window.innerWidth,w=4,g=c.left;g+o>i-10&&(g=i-o-10),g<10&&(g=10);let b=d-c.bottom,h=c.top,v;return b>=n+w?v=c.bottom+w:h>=n+w?v=c.top-n-w:b>=h?v=c.bottom+w:v=Math.max(10,c.top-n-w),{top:v,left:g}},[e,o,n]);return useEffect(()=>{t&&m(u());},[t,u]),useEffect(()=>{if(!t)return;let c=i=>{let w=i.target;l.current&&!l.current.contains(w)&&e.current&&!e.current.contains(w)&&a();},d=setTimeout(()=>{document.addEventListener("mousedown",c);},0);return ()=>{clearTimeout(d),document.removeEventListener("mousedown",c);}},[t,a,e]),useEffect(()=>{if(!t)return;let c=d=>{d.key==="Escape"&&(d.preventDefault(),d.stopPropagation(),a());};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[t,a]),t?jsx(it,{children:jsx("div",{ref:l,className:`smart-popover ${s}`,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 Ve={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:"rgba(180, 185, 197, 0.25)",dependencyHover:"rgba(180, 185, 197, 0.45)",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:"rgba(75, 85, 99, 0.25)",dependencyHover:"rgba(75, 85, 99, 0.45)",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:"rgba(87, 83, 78, 0.25)",dependencyHover:"rgba(87, 83, 78, 0.4)",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 Fu=["LOW","MEDIUM","HIGH","URGENT"],Lu=["todo","in-progress","review","done"];function Es({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:n=[],comments:s=[],activities:p=[],onAddComment:m,onDeleteComment:l,currentUser:u,onAIGenerateDescription:c,onAICreateSubtasks:d,onAIFindSimilar:i,availableColumns:w=[],availableLabels:g=[],availableTags:b=[],onCreateTag:h,onUploadCoverImage:v,unsplashAccessKey:f,theme:x,onSubtasksChange:T,attachments:D=[],onUploadAttachments:I,onDeleteAttachment:k}){let L=Kr(),N=x||L?.themeName||"dark",[C,G]=useState(e),[F,J]=useState(false),[K,de]=useState(e?.subtasks||[]),[ge,Te]=useState(false),[Ce,z]=useState(""),[B,$]=useState(""),[P,Q]=useState("all"),[ee,H]=useState(false),[De,Ee]=useState(false),[Be,xe]=useState(false),[U,ae]=useState(false),[Me,_e]=useState(false),[qe,Ke]=useState(false),O=useRef(null),re=useRef(null),ce=useRef(null),fe=useRef(null),Ae=useRef(null),ot=useRef(null),kt=useRef(null),Le=useRef(null),ke=useRef(null),Ie=useRef(null),Zt=useRef(null),vt=useRef(null);useEffect(()=>{e&&!C?(G({...e}),de(e.subtasks||[])):e&&C&&e.id!==C.id&&(G({...e}),de(e.subtasks||[]));},[e,C]),useEffect(()=>{let R=W=>{let Ne=W.target;fe.current&&!fe.current.contains(Ne)&&H(false),Ae.current&&!Ae.current.contains(Ne)&&Ee(false),ot.current&&!ot.current.contains(Ne)&&xe(false),kt.current&&!kt.current.contains(Ne)&&ae(false);};if(ee||De||Be||U)return document.addEventListener("mousedown",R),()=>document.removeEventListener("mousedown",R)},[ee,De,Be,U]),useEffect(()=>{if(!t)return;let R=W=>{let Ne=W.target,et=Ne.tagName==="INPUT"||Ne.tagName==="TEXTAREA"||Ne.isContentEditable;if(W.key==="Escape"){W.preventDefault(),ee||De||Be||U||Me||qe?(H(false),Ee(false),xe(false),ae(false),_e(false),Ke(false)):et||a();return}if(et&&W.key!=="Escape")return;let $e=W.metaKey||W.ctrlKey;switch(W.key.toLowerCase()){case "s":W.preventDefault(),H(true);break;case "a":W.preventDefault(),xe(true);break;case "p":W.preventDefault(),Ee(true);break;case "l":W.preventDefault(),ae(true);break;case "d":$e||(W.preventDefault(),_e(true),setTimeout(()=>Le.current?.focus(),0));break;case "e":$e||(W.preventDefault(),Ke(true));break;case "i":W.preventDefault(),J(true),setTimeout(()=>re.current?.focus(),0);break;case "t":W.preventDefault(),Te(true);break;case "c":W.preventDefault(),ce.current?.focus();break}};return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[t,a,ee,De,Be,U,Me,qe]);let sa=useCallback(R=>{let W=R.currentTarget.textContent?.trim()||"";if(C&&W!==C.title){let Ne={...C,title:W};G(Ne),r?.(C.id,{title:W});}},[C,r]),Na=useCallback(R=>{R.key==="Enter"&&(R.preventDefault(),R.currentTarget.blur()),R.key==="Escape"&&(R.preventDefault(),R.currentTarget.textContent=C?.title||"",R.currentTarget.blur());},[C]),Oe=useCallback(()=>{C&&e&&C.description!==e.description&&r?.(C.id,{description:C.description}),J(false);},[C,e,r]),Ue=useCallback(R=>{if(C){let W={...C,columnId:R};G(W),r?.(C.id,{columnId:R}),H(false);}},[C,r]),qt=useCallback(R=>{if(C){let W={...C,priority:R};G(W),r?.(C.id,{priority:R}),Ee(false);}},[C,r]),he=useCallback(R=>{if(C){let W=C.assignedUserIds||[],Ne=W.includes(R)?W.filter($e=>$e!==R):[...W,R],et={...C,assignedUserIds:Ne};G(et),r?.(C.id,{assignedUserIds:Ne});}},[C,r]),Ge=useCallback(R=>{if(C){let W=C.labels||[],Ne=W.includes(R)?W.filter($e=>$e!==R):[...W,R],et={...C,labels:Ne};G(et),r?.(C.id,{labels:Ne});}},[C,r]),Fe=useCallback(R=>{if(C){let W={...C,tags:R};G(W),r?.(C.id,{tags:R});}},[C,r]),tt=useCallback(R=>{if(C){let W=R.target.value,Ne={...C,endDate:W};G(Ne),r?.(C.id,{endDate:W}),_e(false);}},[C,r]),Xe=useCallback(R=>{if(C){let W={...C,estimatedTime:parseFloat(R)||0};G(W),r?.(C.id,{estimatedTime:parseFloat(R)||0});}},[C,r]),wt=useCallback(()=>{if(Ce.trim()&&C){let R={id:`subtask-${Date.now()}`,title:Ce.trim(),completed:false,createdAt:new Date},W=[...K,R];de(W),z(""),Te(false),T?.(C.id,W);}},[Ce,K,C,T]),st=useCallback(R=>{let W=K.map(Ne=>Ne.id===R?{...Ne,completed:!Ne.completed,updatedAt:new Date}:Ne);de(W),C&&T?.(C.id,W);},[K,C,T]),Qe=useCallback(R=>{let W=K.filter(Ne=>Ne.id!==R);de(W),C&&T?.(C.id,W);},[K,C,T]),A=useCallback(()=>{B.trim()&&C&&m&&(m(C.id,B.trim()),$(""));},[B,C,m]),ue=useCallback(R=>{(R.metaKey||R.ctrlKey)&&R.key==="Enter"&&(R.preventDefault(),A());},[A]),_=R=>jsx(Mu,{remarkPlugins:[Au],rehypePlugins:[Iu],components:{a:({node:W,...Ne})=>jsx("a",{...Ne,target:"_blank",rel:"noopener noreferrer"})},children:R}),Z=p.filter(R=>P==="comments"?R.type.includes("COMMENT"):P==="history"?!R.type.includes("COMMENT"):true);if(!t||!e)return null;let ve=C||e,Y=n.filter(R=>ve.assignedUserIds?.includes(R.id)),ne=K.filter(R=>R.completed).length;return jsx(it,{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:R=>R.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":N,children:[jsxs("header",{className:"modal-v2-header",children:[jsx("h1",{id:"modal-title",ref:O,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:sa,onKeyDown:Na,children:ve.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:fe,children:[jsxs("button",{ref:ke,className:"modal-v2-field",onClick:()=>H(!ee),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M12 6v6l4 2"})]}),jsx("span",{children:"Status"}),jsx("kbd",{className:"modal-v2-shortcut",children:"S"})]}),jsx("div",{className:"modal-v2-field-value",children:ve.columnId||"No status"})]}),jsx(To,{triggerRef:ke,isOpen:ee,onClose:()=>H(false),width:250,estimatedHeight:200,children:(w.length>0?w:Lu.map(R=>({id:R,title:R}))).map(R=>jsx("button",{className:`modal-v2-popover-item ${ve.columnId===R.id?"active":""}`,onClick:()=>Ue(R.id),children:R.title},R.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:ot,children:[jsxs("button",{ref:Ie,className:"modal-v2-field",onClick:()=>xe(!Be),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsx("span",{children:"Assignees"}),jsx("kbd",{className:"modal-v2-shortcut",children:"A"})]}),jsx("div",{className:"modal-v2-field-value",children:Y.length>0?jsx("div",{className:"modal-v2-avatars",children:Y.map(R=>jsx("div",{className:"modal-v2-avatar",style:{background:R.color},title:R.name,children:R.initials},R.id))}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(To,{triggerRef:Ie,isOpen:Be,onClose:()=>xe(false),width:280,estimatedHeight:300,children:n.map(R=>jsxs("button",{className:`modal-v2-popover-item ${ve.assignedUserIds?.includes(R.id)?"active":""}`,onClick:()=>he(R.id),children:[jsx("div",{className:"modal-v2-avatar-small",style:{background:R.color},children:R.initials}),R.name,ve.assignedUserIds?.includes(R.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"})})]},R.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:Ae,children:[jsxs("button",{ref:Zt,className:"modal-v2-field",onClick:()=>Ee(!De),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:ve.priority||"None"})]}),jsxs(To,{triggerRef:Zt,isOpen:De,onClose:()=>Ee(false),width:180,estimatedHeight:220,children:[Fu.map(R=>jsx("button",{className:`modal-v2-popover-item priority-${R.toLowerCase()} ${ve.priority===R?"active":""}`,onClick:()=>qt(R),children:R},R)),jsx("button",{className:"modal-v2-popover-item",onClick:()=>qt(""),children:"None"})]})]}),b.length>0||h?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(ja,{selectedTags:ve.tags||[],availableTags:b,onChange:Fe,onCreateTag:h,theme:Ve[N]||Ve.dark})})]})}):jsxs("div",{className:"modal-v2-field-wrapper",ref:kt,children:[jsxs("button",{ref:vt,className:"modal-v2-field",onClick:()=>ae(!U),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:ve.labels&&ve.labels.length>0?jsx("span",{children:ve.labels.join(", ")}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(To,{triggerRef:vt,isOpen:U,onClose:()=>ae(false),width:220,estimatedHeight:200,children:(g.length>0?g:["Bug","Feature","Enhancement","Documentation"]).map(R=>jsxs("button",{className:`modal-v2-popover-item ${ve.labels?.includes(R)?"active":""}`,onClick:()=>Ge(R),children:[R,ve.labels?.includes(R)&&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"})})]},R))})]}),jsxs("button",{className:"modal-v2-field",onClick:()=>{_e(!Me),setTimeout(()=>Le.current?.showPicker?.(),0);},children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]}),jsx("span",{children:"Due Date"}),jsx("kbd",{className:"modal-v2-shortcut",children:"D"})]}),jsx("div",{className:"modal-v2-field-value",children:ve.endDate?new Date(ve.endDate).toLocaleDateString():"Not set"}),jsx("input",{ref:Le,type:"date",value:typeof ve.endDate=="string"?ve.endDate.split("T")[0]:ve.endDate?(()=>{let R=new Date(ve.endDate),W=R.getUTCFullYear(),Ne=String(R.getUTCMonth()+1).padStart(2,"0"),et=String(R.getUTCDate()).padStart(2,"0");return `${W}-${Ne}-${et}`})():"",onChange:tt,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxs("button",{className:"modal-v2-field",onClick:()=>Ke(!qe),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("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:ve.estimatedTime?`${ve.estimatedTime}h`:"Not set"})]}),qe&&jsx("div",{className:"modal-v2-popover",children:jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:ve.estimatedTime||"",onChange:R=>Xe(R.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>Ke(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"})]}),F?jsx("textarea",{className:"modal-v2-textarea",value:ve.description||"",onChange:R=>{if(C){let W={...C,description:R.target.value};G(W);}},onBlur:Oe,placeholder:"Add a detailed description...",autoFocus:true}):jsx("div",{className:"modal-v2-content",onClick:()=>J(true),children:ve.description?jsx("div",{className:"modal-v2-markdown",children:_(ve.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"}),K.length>0&&jsxs("span",{className:"modal-v2-count",children:[ne,"/",K.length]}),jsxs("button",{className:"modal-v2-add-button",onClick:()=>Te(true),children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add"]})]}),jsxs("div",{className:"modal-v2-subtasks",children:[K.map(R=>jsxs("div",{className:`modal-v2-subtask ${R.completed?"completed":""}`,children:[jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>st(R.id),children:R.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:R.title}),jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>Qe(R.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"})]})})]},R.id)),ge&&jsx("div",{className:"modal-v2-subtask-input-row",children:jsx("input",{type:"text",placeholder:"Subtask title...",value:Ce,onChange:R=>z(R.target.value),onKeyDown:R=>{R.key==="Enter"&&wt(),R.key==="Escape"&&(Te(false),z(""));},onBlur:wt,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(I||D.length>0)&&jsxs("section",{className:"modal-v2-section",children:[jsxs("div",{className:"modal-v2-section-header",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsx("h2",{children:"Attachments"}),D.length>0&&jsx("span",{className:"modal-v2-count",children:D.length})]}),jsx(qa,{cardId:ve.id,attachments:D,onUpload:I?R=>I(ve.id,R):void 0,onDelete:k,maxSizeMB:10,maxFiles:20})]}),jsxs("section",{className:"modal-v2-section",children:[jsxs("div",{className:"modal-v2-section-header",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsx("h2",{children:"Activity"}),jsxs("div",{className:"modal-v2-filters",children:[jsx("button",{className:`modal-v2-filter ${P==="all"?"active":""}`,onClick:()=>Q("all"),children:"All"}),jsx("button",{className:`modal-v2-filter ${P==="comments"?"active":""}`,onClick:()=>Q("comments"),children:"Comments"}),jsx("button",{className:`modal-v2-filter ${P==="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:ce,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:B,onChange:R=>$(R.target.value),onKeyDown:ue,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:A,disabled:!B.trim(),children:"Send"})]})]})]}),jsxs("div",{className:"modal-v2-timeline",children:[Z.map(R=>{let W=n.find(et=>et.id===R.userId);if(R.type.includes("COMMENT")){let et=s.find($e=>$e.id===R.metadata?.commentId);return et?jsxs("div",{className:"modal-v2-activity-item comment-item",children:[W&&jsx("div",{className:"modal-v2-avatar",style:{background:W.color},children:W.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:W?.name||"Unknown"}),jsx("span",{className:"modal-v2-activity-time",children:new Date(R.timestamp).toLocaleString()})]}),jsx("div",{className:"modal-v2-comment-body",children:et.content})]})]},R.id):null}return jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxs("div",{className:"modal-v2-history-icon",children:[R.type.includes("CREATED")&&"\u2795",R.type.includes("UPDATED")&&"\u270F\uFE0F",R.type.includes("MOVED")&&"\u27A1\uFE0F",R.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",R.type.includes("ASSIGNED")&&"\u{1F464}",R.type.includes("PRIORITY")&&"\u{1F3AF}",R.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:W?.name||"Unknown"})," ",R.type.replace(/_/g," ").toLowerCase(),R.newValue&&jsxs(Fragment,{children:[" to ",jsx("strong",{children:R.newValue})]})]}),jsx("span",{className:"modal-v2-activity-time",children:new Date(R.timestamp).toLocaleString()})]})]},R.id)}),Z.length===0&&jsxs("div",{className:"modal-v2-empty",children:[jsx("p",{children:"No activity yet"}),jsx("span",{children:"Activity will appear here"})]})]})]})]})})})}function Gu({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 Ms({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let n=e.map(s=>({...s,average:s.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: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:"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(Gu,{})}),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((s,p)=>s+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((s,p)=>s+p.completed,0)/e.length).toFixed(1)})]}),o&&e.some(s=>s.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((s,p)=>s+(p.planned||0),0)})]})]})]})}function Zu({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 As({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let n=r??(e[0]?.ideal||e[0]?.remaining||0),s=e[e.length-1]?.remaining||0,p=e[e.length-1]?.ideal||0,m=n>0?(n-s)/n*100:0,l=s<=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(Zu,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?jsxs(Fragment,{children:[jsx(Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsx(Area,{type:"monotone",dataKey:"remaining",stroke:l?"#10B981":"#EF4444",fill:l?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxs(Fragment,{children:[jsx(Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsx(Line,{type:"monotone",dataKey:"remaining",stroke:l?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:l?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxs("span",{className:"chart-stat-value",style:{color: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:l?"#10B981":"#EF4444"},children:s})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Status"}),jsx("span",{className:"chart-stat-badge",style:{background:l?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:l?"#10B981":"#EF4444"},children:l?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var ig={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},bd=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function lg({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:n}){let s=r+(o-r)*.5,p=e+s*Math.cos(-a*(Math.PI/180)),m=t+s*Math.sin(-a*(Math.PI/180));return n<.05?null:jsx("text",{x:p,y:m,fill:"white",textAnchor:p>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(n*100).toFixed(0)}%`})}function yd({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 Is({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let n=e.reduce((m,l)=>m+l.value,0),s=e.map(m=>({...m,totalValue:n,color:m.color||ig[m.name]||bd[e.indexOf(m)%bd.length]})),p=s.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:s,cx:"50%",cy:"50%",labelLine:false,label:o?lg:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:s.map((m,l)=>jsx(Cell,{fill:p[l]},`cell-${l}`))}),jsx(Tooltip,{content:jsx(yd,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(m,l)=>{let u=l.payload,c=n>0?(u.value/n*100).toFixed(0):"0";return `${m} (${u.value} - ${c}%)`}})]}):jsxs(BarChart,{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:"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(yd,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:s.map((m,l)=>jsx(Cell,{fill:p[l]},`cell-${l}`))})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:n})]}),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,l)=>l.value>m.value?l:m).name})]})]})]})}var nn=memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:n=[]})=>{let[s,p]=useState(false),[m,l]=useState(false),[u,c]=useState(false),[d,i]=useState(false);if(e.length===0)return null;let w=e.map(x=>x.id),g=x=>{r.onBulkUpdate?.(w,{priority:x}),p(false);},b=x=>{r.onBulkMove?.(w,x),l(false),a();},h=x=>{r.onBulkUpdate?.(w,{assignedUserIds:x}),c(false);},v=x=>{let T=new Set;e.forEach(I=>{I.labels?.forEach(k=>T.add(k));});let D=Array.from(new Set([...T,...x]));r.onBulkUpdate?.(w,{labels:D}),i(false);},f=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(w),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(!s),title:"Update priority",children:jsx("span",{className:"text-sm",children:"Priority"})}),s&&jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(x=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>g(x),children:[jsx("span",{className:y("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:()=>l(!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:()=>b(x.id),children:x.title},x.id))})]}),t.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>c(!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:()=>h([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))})]}),n.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!d),title:"Add labels",children:jsx("span",{className:"text-sm",children:"Labels"})}),d&&jsx("div",{className:"asakaa-bulk-menu",children:n.map(x=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>v([x]),children:x},x))})]}),jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:f,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"})})]})]})})});nn.displayName="BulkOperationsToolbar";function ug(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let n,s,p,m,l;switch(t){case "assignee":let u=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);u.length>0?u.forEach(i=>{let w=a?.find(g=>g.id===i);s=`assignee-${i}`,p=w?.name||`User ${i}`,m=w?.color,l=w?.avatar,r.has(s)||r.set(s,{id:s,title:p,groupValue:i,cardIds:[],color:m,icon:l}),r.get(s).cardIds.push(o.id);}):(s="assignee-unassigned",p="Unassigned",m="#6b7280",l="\u{1F464}",r.has(s)||r.set(s,{id:s,title:p,groupValue:null,cardIds:[],color:m,icon:l}),r.get(s).cardIds.push(o.id));break;case "priority":n=o.priority||"NONE",s=`priority-${n}`;let d={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[n];p=d.title,m=d.color,r.has(s)||r.set(s,{id:s,title:p,groupValue:n,cardIds:[],color:m}),r.get(s).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(i=>{s=`label-${i}`,p=i,m="#6b7280",r.has(s)||r.set(s,{id:s,title:p,groupValue:i,cardIds:[],color:m}),r.get(s).cardIds.push(o.id);}):(s="label-none",p="No Labels",m="#6b7280",r.has(s)||r.set(s,{id:s,title:p,groupValue:null,cardIds:[],color:m}),r.get(s).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,n)=>o.title.localeCompare(n.title))}function Fs({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[n,s]=useState(new Set),p=useMemo(()=>ug(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),m=useCallback(l=>{s(u=>{let c=new Set(u);return c.has(l)?c.delete(l):c.add(l),c});},[]);return t.groupBy==="none"||p.length===0?jsx(fr,{board:e,callbacks:r,availableUsers:a,className:o}):jsxs("div",{className:y("asakaa-swimlane-view",o),children:[p.map(l=>{let u=n.has(l.id),c=e.cards.filter(i=>l.cardIds.includes(i.id)),d={...e,cards:c};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(l.id),style:{borderLeft:l.color?`4px solid ${l.color}`:void 0},children:[jsxs("div",{className:"flex items-center gap-3",children:[l.icon&&jsx("span",{className:"text-2xl leading-none",children:l.icon}),jsx("h3",{className:"text-lg font-semibold",style:{color:l.color},children:l.title}),jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",l.cardIds.length," ",l.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":u?"Expand lane":"Collapse lane",children:u?"\u25B6":"\u25BC"})]}),!u&&jsx("div",{className:"asakaa-swimlane-content p-4",children:jsx(fr,{board:d,callbacks:r,availableUsers:a})})]},l.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 Ls=[{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 Bs({value:e,onChange:t,className:a}){let[r,o]=useState(false),n=useRef(null),s=useRef(null),p=Ls.find(l=>l.value===e)||Ls[0];useEffect(()=>{function l(u){n.current&&!n.current.contains(u.target)&&s.current&&!s.current.contains(u.target)&&o(false);}if(r)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]);let m=l=>{t(l),o(false);};return jsxs("div",{className:y("relative inline-block",a),children:[jsxs("button",{ref:s,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:y("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:n,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:Ls.map(l=>jsxs("button",{onClick:()=>m(l.value),className:y("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===l.value&&"bg-white/5"),children:[jsx("span",{className:"text-xl leading-none mt-0.5",children:l.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"font-semibold text-sm text-white",children:l.label}),e===l.value&&jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsx("p",{className:"text-xs text-white/60 mt-0.5",children:l.description})]})]},l.value))})]})]})}var Do=[{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 hg(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(l=>e.key===l||e.code===l))return false;let o=t.modifiers||{},n=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,s=o.shift?e.shiftKey:!e.shiftKey,p=o.alt?e.altKey:!e.altKey,m=o.meta?e.metaKey:true;return n&&s&&p&&m}function Cd(e={}){let{shortcuts:t=Do,enabled:a=true,preventDefault:r=true}=e,o=useRef(t),n=useRef(a);useEffect(()=>{o.current=t,n.current=a;},[t,a]);let s=useCallback(m=>{o.current=[...o.current,m];},[]),p=useCallback(m=>{o.current=o.current.filter(l=>l.action!==m);},[]);return useEffect(()=>{function m(l){if(!n.current)return;let u=l.target;if(!((u.tagName==="INPUT"||u.tagName==="TEXTAREA"||u.isContentEditable)&&l.key!=="Escape"&&!l.ctrlKey&&!l.metaKey)){for(let c of o.current)if(hg(l,c)){r&&l.preventDefault();let d=new CustomEvent("keyboard-action",{detail:c.action,bubbles:true,cancelable:true});window.dispatchEvent(d);break}}}return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[r]),{registerShortcut:s,unregisterShortcut:p,isEnabled:a}}function yg(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function vg(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 xg(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=vg(e),r=t?yg(t):"";return a?`${a} + ${r}`:r}function kg(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 Rs({shortcuts:e=Do,isOpen:t,onClose:a,className:r}){let[o,n]=useState(false);if(useEffect(()=>{n(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 s=kg(e);return jsxs("div",{className:y("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(s).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(l=>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:l.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:xg(l)})]},l.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 Os=[{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=b=>{b.stopPropagation();let m=r<a.length-1?r+1:0;i(),o(m);},s.appendChild(d),s.appendChild(l),s.appendChild(h);}s.appendChild(c),s.appendChild(p),document.body.appendChild(s),setTimeout(()=>{p.style.transition="opacity 0.5s ease",p.style.opacity="0";},2e3);}function Nu(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 Du(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 Ts(e){return e.startsWith("image/")}function er({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:n=10}){let[s,c]=useState(false),[p,i]=useState(false),[u,d]=useState(null),l=useRef(null),h=useRef(e);h.current=e;let b=useCallback((k,$)=>{$.preventDefault(),$.stopPropagation();let S=h.current.filter(B=>Ts(B.type)),C=S.findIndex(B=>B.id===k.id),H=B=>{let J=h.current.filter(xe=>Ts(xe.type)),ne=J[B];ne&&pd(ne.url,ne.name,J,B,H);};pd(k.url,k.name,S,C,H);},[]),m=useCallback(k=>{let $=[],S=[];return e.length+k.length>n?(S.push(`Maximum ${n} files allowed`),{valid:$,errors:S}):(k.forEach(C=>{if(C.size/1048576>r){S.push(`${C.name} is too large (max ${r}MB)`);return}if(o&&!o.some(B=>C.type.match(B))){S.push(`${C.name} has invalid file type`);return}$.push(C);}),{valid:$,errors:S})},[e.length,n,r,o]),v=useCallback(async k=>{let{valid:$,errors:S}=m(k);if(S.length>0){d(S.join(", ")),setTimeout(()=>d(null),5e3);return}if($.length!==0){i(true),d(null);try{await t?.($);}catch(C){d(C instanceof Error?C.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{i(false);}}},[m,t]),w=useCallback(k=>{k.preventDefault(),k.stopPropagation(),c(true);},[]),g=useCallback(k=>{k.preventDefault(),k.stopPropagation(),c(false);},[]),f=useCallback(k=>{k.preventDefault(),k.stopPropagation();},[]),x=useCallback(k=>{k.preventDefault(),k.stopPropagation(),c(false);let $=Array.from(k.dataTransfer.files);v($);},[v]),N=useCallback(k=>{let $=k.target.files?Array.from(k.target.files):[];v($),l.current&&(l.current.value="");},[v]),D=useCallback(()=>{l.current?.click();},[]),I=useCallback(k=>{confirm("Are you sure you want to delete this attachment?")&&a?.(k);},[a]);return jsxs("div",{className:"attachment-uploader",children:[jsxs("div",{className:`attachment-dropzone ${s?"dragging":""} ${p?"uploading":""}`,onDragEnter:w,onDragLeave:g,onDragOver:f,onDrop:x,onClick:D,children:[jsx("input",{ref:l,type:"file",multiple:true,onChange:N,style:{display:"none"},accept:o?.join(",")}),jsx("div",{className:"attachment-dropzone-content",children:p?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:s?"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,"/",n," 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(k=>jsxs("div",{className:"attachment-item",children:[jsx("div",{className:"attachment-preview",children:Ts(k.type)&&k.url?jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:$=>b(k,$),title:"Click to view full size",children:[jsx("img",{src:k.thumbnailUrl||k.url,alt:k.name,className:"attachment-thumbnail"}),jsx("div",{className:"attachment-thumbnail-overlay",children:jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M9 21H3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M21 3L14 10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M3 21L10 14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})]}):jsx("div",{className:"attachment-icon",children:Du(k.type)})}),jsxs("div",{className:"attachment-info",children:[jsx("a",{href:k.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:k.name,children:k.name}),jsxs("div",{className:"attachment-meta",children:[jsx("span",{className:"attachment-size",children:Nu(k.size)}),jsx("span",{className:"attachment-separator",children:"\u2022"}),jsx("span",{className:"attachment-date",children:new Date(k.uploadedAt).toLocaleDateString()})]})]}),jsx("button",{onClick:()=>I(k.id),className:"attachment-delete",title:"Delete attachment",type:"button",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},k.id))})]})}function Ns({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:n=[],comments:s=[],activities:c=[],aiInsights:p=[],attachments:i=[],onAddComment:u,onDeleteComment:d,onUploadAttachments:l,onDeleteAttachment:h,onSuggestAssignee:b,onGenerateSubtasks:m,onEstimateEffort:v,currentUserId:w="user-1"}){let[g,f]=useState("details"),[x,N]=useState(false),[D,I]=useState({}),[k,$]=useState(""),[S,C]=useState(false),[H,B]=useState({});if(!t||!e)return null;let J=useCallback(()=>{N(false),I({}),f("details"),$(""),B({}),a();},[a]),ne=useCallback(()=>{r&&Object.keys(D).length>0&&(r(e.id,D),I({}),N(false));},[e.id,D,r]),xe=useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),J());},[e.id,o,J]),Pe=useCallback(()=>{u&&k.trim()&&(u(e.id,k.trim()),$(""));},[e.id,k,u]),Re=useCallback(async()=>{if(b){C(true);try{let E=await b(e);B(q=>({...q,assignees:E}));}catch(E){console.error("Failed to suggest assignee:",E);}finally{C(false);}}},[e,b]),le=useCallback(async()=>{if(m){C(true);try{let E=await m(e);B(q=>({...q,subtasks:E}));}catch(E){console.error("Failed to generate subtasks:",E);}finally{C(false);}}},[e,m]),z=useCallback(async()=>{if(v){C(true);try{let E=await v(e);B(q=>({...q,effort:E}));}catch(E){console.error("Failed to estimate effort:",E);}finally{C(false);}}},[e,v]),L={...e,...D},W=n.filter(E=>L.assignedUserIds?.includes(E.id));return jsx(ot,{children:jsx("div",{className:"card-detail-overlay",onClick:J,children:jsxs("div",{className:"card-detail-modal",onClick:E=>E.stopPropagation(),children:[jsxs("div",{className:"card-detail-header",children:[jsxs("div",{className:"card-detail-header-left",children:[jsx("div",{className:"card-detail-priority-dot",style:{background:L.priority==="URGENT"?"#EF4444":L.priority==="HIGH"?"#F59E0B":L.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),x?jsx("input",{type:"text",value:D.title??L.title,onChange:E=>I({...D,title:E.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsx("h2",{className:"card-detail-title",children:L.title})]}),jsxs("div",{className:"card-detail-header-actions",children:[x?jsxs(Fragment,{children:[jsx("button",{onClick:ne,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsx("button",{onClick:()=>{N(false),I({});},className:"card-detail-btn",children:"Cancel"})]}):jsxs("button",{onClick:()=>N(true),className:"card-detail-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit"]}),jsxs("button",{onClick:xe,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:J,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:()=>f("details"),className:`card-detail-tab ${g==="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:()=>f("comments"),className:`card-detail-tab ${g==="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",s.length>0&&jsx("span",{className:"card-detail-tab-badge",children:s.length})]}),jsxs("button",{onClick:()=>f("activity"),className:`card-detail-tab ${g==="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",c.length>0&&jsx("span",{className:"card-detail-tab-badge",children:c.length})]}),jsxs("button",{onClick:()=>f("attachments"),className:`card-detail-tab ${g==="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:()=>f("ai"),className:`card-detail-tab ${g==="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:[g==="details"&&jsxs("div",{className:"card-detail-details",children:[jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Description"}),x?jsx("textarea",{value:D.description??L.description??"",onChange:E=>I({...D,description:E.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsx("p",{className:"card-detail-text",children:L.description||"No description"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Assigned To"}),x?jsx("select",{multiple:true,value:D.assignedUserIds??L.assignedUserIds??[],onChange:E=>{let q=Array.from(E.target.selectedOptions,Z=>Z.value);I({...D,assignedUserIds:q});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:n.map(E=>jsx("option",{value:E.id,children:E.name},E.id))}):jsx("div",{className:"card-detail-users",children:W.length>0?W.map(E=>jsxs("div",{className:"card-detail-user",children:[jsx("div",{className:"card-detail-user-avatar",style:{background:E.color},children:E.initials}),jsx("span",{children:E.name})]},E.id)):jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Priority"}),x?jsxs("select",{value:D.priority??L.priority??"",onChange:E=>I({...D,priority:E.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},children:[jsx("option",{value:"",children:"None"}),jsx("option",{value:"LOW",children:"LOW"}),jsx("option",{value:"MEDIUM",children:"MEDIUM"}),jsx("option",{value:"HIGH",children:"HIGH"}),jsx("option",{value:"URGENT",children:"URGENT"})]}):jsxs("div",{className:"card-detail-priority",children:[jsx("div",{className:"card-detail-priority-dot",style:{background:L.priority==="URGENT"?"#EF4444":L.priority==="HIGH"?"#F59E0B":L.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsx("span",{children:L.priority||"None"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Labels"}),jsx("div",{className:"card-detail-labels",children:L.labels&&L.labels.length>0?L.labels.map(E=>jsx("span",{className:"card-detail-label-tag",children:E},E)):jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxs("div",{className:"card-detail-section-row",children:[jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Start Date"}),x?jsx("input",{type:"date",value:D.startDate?new Date(D.startDate).toISOString().split("T")[0]:L.startDate?new Date(L.startDate).toISOString().split("T")[0]:"",onChange:E=>I({...D,startDate:E.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:L.startDate?new Date(L.startDate).toLocaleDateString():"Not set"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"End Date"}),x?jsx("input",{type:"date",value:D.endDate?new Date(D.endDate).toISOString().split("T")[0]:L.endDate?new Date(L.endDate).toISOString().split("T")[0]:"",onChange:E=>I({...D,endDate:E.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:L.endDate?new Date(L.endDate).toLocaleDateString():"Not set"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),x?jsx("input",{type:"number",min:"0",step:"0.5",value:D.estimatedTime??L.estimatedTime??"",onChange:E=>I({...D,estimatedTime:E.target.value?parseFloat(E.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsx("span",{className:"card-detail-text",children:L.estimatedTime||"Not estimated"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Dependencies"}),jsx("div",{className:"card-detail-dependencies",children:L.dependencies&&L.dependencies.length>0?L.dependencies.map(E=>{let q=typeof E=="string"?E:E.taskId;return jsxs("span",{className:"card-detail-dependency",children:["Card #",q.slice(-4)]},q)}):jsx("span",{className:"card-detail-empty",children:"No dependencies"})})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Created"}),jsx("span",{className:"card-detail-text",children:L.createdAt?new Date(L.createdAt).toLocaleString():"Unknown"})]})]}),g==="comments"&&jsxs("div",{className:"card-detail-comments",children:[jsxs("div",{className:"card-detail-comment-form",children:[jsx("textarea",{value:k,onChange:E=>$(E.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsx("button",{onClick:Pe,disabled:!k.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsx("div",{className:"card-detail-comments-list",children:s.length>0?s.map(E=>{let q=n.find(Z=>Z.id===E.authorId);return jsxs("div",{className:"card-detail-comment",children:[jsxs("div",{className:"card-detail-comment-header",children:[jsxs("div",{className:"card-detail-comment-author",children:[q&&jsx("div",{className:"card-detail-user-avatar",style:{background:q.color},children:q.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-comment-author-name",children:q?.name||"Unknown"}),jsx("div",{className:"card-detail-comment-time",children:new Date(E.createdAt).toLocaleString()})]})]}),d&&jsx("button",{onClick:()=>d(E.id),className:"card-detail-comment-delete",children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]}),jsx("p",{className:"card-detail-comment-content",children:E.content})]},E.id)}):jsxs("div",{className:"card-detail-empty-state",children:[jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsx("p",{children:"No comments yet"}),jsx("span",{children:"Be the first to comment"})]})})]}),g==="activity"&&jsx("div",{className:"card-detail-activity",children:c.length>0?jsx("div",{className:"card-detail-activity-list",children:c.map(E=>{let q=n.find(Z=>Z.id===E.userId);return jsxs("div",{className:"card-detail-activity-item",children:[jsxs("div",{className:"card-detail-activity-icon",children:[E.type.includes("CREATED")&&"\u2795",E.type.includes("UPDATED")&&"\u270F\uFE0F",E.type.includes("MOVED")&&"\u27A1\uFE0F",E.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",E.type.includes("COMMENT")&&"\u{1F4AC}",E.type.includes("ASSIGNED")&&"\u{1F464}",E.type.includes("PRIORITY")&&"\u{1F3AF}",E.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",E.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxs("div",{className:"card-detail-activity-content",children:[jsxs("div",{className:"card-detail-activity-text",children:[jsx("strong",{children:q?.name||"Unknown"})," ",E.type.replace(/_/g," ").toLowerCase(),E.newValue&&jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsx("strong",{children:E.newValue})]})]}),jsx("div",{className:"card-detail-activity-time",children:new Date(E.timestamp).toLocaleString()})]})]},E.id)})}):jsxs("div",{className:"card-detail-empty-state",children:[jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),jsx("p",{children:"No activity yet"}),jsx("span",{children:"Activity will appear here"})]})}),g==="attachments"&&jsx("div",{className:"card-detail-attachments",children:jsx(er,{cardId:e.id,attachments:i,onUpload:l?E=>l(e.id,E):void 0,onDelete:h,currentUserId:w,maxSizeMB:10,maxFiles:20})}),g==="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:Re,disabled:S||!b,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:le,disabled:S||!m,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:z,disabled:S||!v,className:"card-detail-ai-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),H.assignees&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Assignee Suggestions"}),H.assignees.map((E,q)=>{let Z=n.find(U=>U.id===E.userId);return jsxs("div",{className:"card-detail-ai-suggestion",children:[Z&&jsx("div",{className:"card-detail-user-avatar",style:{background:Z.color},children:Z.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-ai-suggestion-name",children:Z?.name}),jsx("div",{className:"card-detail-ai-suggestion-reason",children:E.reasoning}),jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(E.confidence*100).toFixed(0),"%"]})]})]},q)})]}),H.subtasks&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Suggested Subtasks"}),H.subtasks.map((E,q)=>jsxs("div",{className:"card-detail-ai-subtask",children:[jsx("div",{className:"card-detail-ai-subtask-title",children:E.title}),E.description&&jsx("div",{className:"card-detail-ai-subtask-desc",children:E.description}),E.estimatedTime&&jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",E.estimatedTime,"h"]})]},q))]}),H.effort&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Effort Estimate"}),jsxs("div",{className:"card-detail-ai-effort",children:[jsxs("div",{className:"card-detail-ai-effort-hours",children:[H.effort.hours," hours"]}),jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(H.effort.confidence*100).toFixed(0),"%"]})]})]}),p.length>0&&jsxs("div",{className:"card-detail-ai-insights",children:[jsx("h4",{children:"AI Insights"}),p.map(E=>jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${E.severity.toLowerCase()}`,children:[jsxs("div",{className:"card-detail-ai-insight-header",children:[jsx("span",{className:"card-detail-ai-insight-title",children:E.title}),jsx("span",{className:"card-detail-ai-insight-severity",children:E.severity})]}),jsx("p",{className:"card-detail-ai-insight-desc",children:E.description}),E.suggestedAction&&jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",E.suggestedAction]})]},E.id))]}),!H.assignees&&!H.subtasks&&!H.effort&&p.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 No({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:n=300,className:s=""}){let[c,p]=useState({top:0,left:0}),i=useRef(null),u=useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),l=window.innerHeight,h=window.innerWidth,b=4,m=d.left;m+o>h-10&&(m=h-o-10),m<10&&(m=10);let v=l-d.bottom,w=d.top,g;return v>=n+b?g=d.bottom+b:w>=n+b?g=d.top-n-b:v>=w?g=d.bottom+b:g=Math.max(10,d.top-n-b),{top:g,left:m}},[e,o,n]);return useEffect(()=>{t&&p(u());},[t,u]),useEffect(()=>{if(!t)return;let d=h=>{let b=h.target;i.current&&!i.current.contains(b)&&e.current&&!e.current.contains(b)&&a();},l=setTimeout(()=>{document.addEventListener("mousedown",d);},0);return ()=>{clearTimeout(l),document.removeEventListener("mousedown",d);}},[t,a,e]),useEffect(()=>{if(!t)return;let d=l=>{l.key==="Escape"&&(l.preventDefault(),l.stopPropagation(),a());};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),t?jsx(ot,{children:jsx("div",{ref:i,className:`smart-popover ${s}`,style:{position:"fixed",top:`${c.top}px`,left:`${c.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 Ve={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:"rgba(180, 185, 197, 0.25)",dependencyHover:"rgba(180, 185, 197, 0.45)",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:"rgba(75, 85, 99, 0.25)",dependencyHover:"rgba(75, 85, 99, 0.45)",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:"rgba(87, 83, 78, 0.25)",dependencyHover:"rgba(87, 83, 78, 0.4)",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 Lu=["LOW","MEDIUM","HIGH","URGENT"],Bu=["todo","in-progress","review","done"];function Es({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:n=[],comments:s=[],activities:c=[],onAddComment:p,onDeleteComment:i,currentUser:u,onAIGenerateDescription:d,onAICreateSubtasks:l,onAIFindSimilar:h,availableColumns:b=[],availableLabels:m=[],availableTags:v=[],onCreateTag:w,onUploadCoverImage:g,unsplashAccessKey:f,theme:x,onSubtasksChange:N,attachments:D=[],onUploadAttachments:I,onDeleteAttachment:k}){let $=qr(),S=x||$?.themeName||"dark",[C,H]=useState(e),[B,J]=useState(false),[ne,xe]=useState(e?.subtasks||[]),[Pe,Re]=useState(false),[le,z]=useState(""),[L,W]=useState(""),[E,q]=useState("all"),[Z,U]=useState(false),[ke,Ne]=useState(false),[Fe,ye]=useState(false),[tt,Ie]=useState(false),[st,it]=useState(false),[dt,O]=useState(false),F=useRef(null),K=useRef(null),ae=useRef(null),ge=useRef(null),Se=useRef(null),Ke=useRef(null),yt=useRef(null),Be=useRef(null),pe=useRef(null),Ee=useRef(null),jt=useRef(null),ut=useRef(null);useEffect(()=>{e&&!C?(H({...e}),xe(e.subtasks||[])):e&&C&&e.id!==C.id&&(H({...e}),xe(e.subtasks||[]));},[e,C]),useEffect(()=>{let R=Y=>{let V=Y.target;ge.current&&!ge.current.contains(V)&&U(false),Se.current&&!Se.current.contains(V)&&Ne(false),Ke.current&&!Ke.current.contains(V)&&ye(false),yt.current&&!yt.current.contains(V)&&Ie(false);};if(Z||ke||Fe||tt)return document.addEventListener("mousedown",R),()=>document.removeEventListener("mousedown",R)},[Z,ke,Fe,tt]),useEffect(()=>{if(!t)return;let R=Y=>{let V=Y.target,we=V.tagName==="INPUT"||V.tagName==="TEXTAREA"||V.isContentEditable;if(Y.key==="Escape"){Y.preventDefault(),Z||ke||Fe||tt||st||dt?(U(false),Ne(false),ye(false),Ie(false),it(false),O(false)):we||a();return}if(we&&Y.key!=="Escape")return;let Le=Y.metaKey||Y.ctrlKey;switch(Y.key.toLowerCase()){case "s":Y.preventDefault(),U(true);break;case "a":Y.preventDefault(),ye(true);break;case "p":Y.preventDefault(),Ne(true);break;case "l":Y.preventDefault(),Ie(true);break;case "d":Le||(Y.preventDefault(),it(true),setTimeout(()=>Be.current?.focus(),0));break;case "e":Le||(Y.preventDefault(),O(true));break;case "i":Y.preventDefault(),J(true),setTimeout(()=>K.current?.focus(),0);break;case "t":Y.preventDefault(),Re(true);break;case "c":Y.preventDefault(),ae.current?.focus();break}};return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[t,a,Z,ke,Fe,tt,st,dt]);let sa=useCallback(R=>{let Y=R.currentTarget.textContent?.trim()||"";if(C&&Y!==C.title){let V={...C,title:Y};H(V),r?.(C.id,{title:Y});}},[C,r]),Sa=useCallback(R=>{R.key==="Enter"&&(R.preventDefault(),R.currentTarget.blur()),R.key==="Escape"&&(R.preventDefault(),R.currentTarget.textContent=C?.title||"",R.currentTarget.blur());},[C]),He=useCallback(()=>{C&&e&&C.description!==e.description&&r?.(C.id,{description:C.description}),J(false);},[C,e,r]),$e=useCallback(R=>{if(C){let Y={...C,columnId:R};H(Y),r?.(C.id,{columnId:R}),U(false);}},[C,r]),ia=useCallback(R=>{if(C){let Y={...C,priority:R};H(Y),r?.(C.id,{priority:R}),Ne(false);}},[C,r]),fe=useCallback(R=>{if(C){let Y=C.assignedUserIds||[],V=Y.includes(R)?Y.filter(Le=>Le!==R):[...Y,R],we={...C,assignedUserIds:V};H(we),r?.(C.id,{assignedUserIds:V});}},[C,r]),Oe=useCallback(R=>{if(C){let Y=C.labels||[],V=Y.includes(R)?Y.filter(Le=>Le!==R):[...Y,R],we={...C,labels:V};H(we),r?.(C.id,{labels:V});}},[C,r]),Ae=useCallback(R=>{if(C){let Y={...C,tags:R};H(Y),r?.(C.id,{tags:R});}},[C,r]),Ge=useCallback(R=>{if(C){let Y=R.target.value,V={...C,endDate:Y};H(V),r?.(C.id,{endDate:Y}),it(false);}},[C,r]),_e=useCallback(R=>{if(C){let Y={...C,estimatedTime:parseFloat(R)||0};H(Y),r?.(C.id,{estimatedTime:parseFloat(R)||0});}},[C,r]),kt=useCallback(()=>{if(le.trim()&&C){let R={id:`subtask-${Date.now()}`,title:le.trim(),completed:false,createdAt:new Date},Y=[...ne,R];xe(Y),z(""),Re(false),N?.(C.id,Y);}},[le,ne,C,N]),rt=useCallback(R=>{let Y=ne.map(V=>V.id===R?{...V,completed:!V.completed,updatedAt:new Date}:V);xe(Y),C&&N?.(C.id,Y);},[ne,C,N]),Qe=useCallback(R=>{let Y=ne.filter(V=>V.id!==R);xe(Y),C&&N?.(C.id,Y);},[ne,C,N]),ct=useCallback(()=>{L.trim()&&C&&p&&(p(C.id,L.trim()),W(""));},[L,C,p]),Ht=useCallback(R=>{(R.metaKey||R.ctrlKey)&&R.key==="Enter"&&(R.preventDefault(),ct());},[ct]),Q=R=>jsx(Au,{remarkPlugins:[Fu],rehypePlugins:[Iu],components:{a:({node:Y,...V})=>jsx("a",{...V,target:"_blank",rel:"noopener noreferrer"})},children:R}),oe=c.filter(R=>E==="comments"?R.type.includes("COMMENT"):E==="history"?!R.type.includes("COMMENT"):true);if(!t||!e)return null;let T=C||e,ee=n.filter(R=>T.assignedUserIds?.includes(R.id)),ie=ne.filter(R=>R.completed).length;return jsx(ot,{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:R=>R.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":S,children:[jsxs("header",{className:"modal-v2-header",children:[jsx("h1",{id:"modal-title",ref:F,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:sa,onKeyDown:Sa,children:T.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:ge,children:[jsxs("button",{ref:pe,className:"modal-v2-field",onClick:()=>U(!Z),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:T.columnId||"No status"})]}),jsx(No,{triggerRef:pe,isOpen:Z,onClose:()=>U(false),width:250,estimatedHeight:200,children:(b.length>0?b:Bu.map(R=>({id:R,title:R}))).map(R=>jsx("button",{className:`modal-v2-popover-item ${T.columnId===R.id?"active":""}`,onClick:()=>$e(R.id),children:R.title},R.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:Ke,children:[jsxs("button",{ref:Ee,className:"modal-v2-field",onClick:()=>ye(!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:"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:ee.length>0?jsx("div",{className:"modal-v2-avatars",children:ee.map(R=>jsx("div",{className:"modal-v2-avatar",style:{background:R.color},title:R.name,children:R.initials},R.id))}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(No,{triggerRef:Ee,isOpen:Fe,onClose:()=>ye(false),width:280,estimatedHeight:300,children:n.map(R=>jsxs("button",{className:`modal-v2-popover-item ${T.assignedUserIds?.includes(R.id)?"active":""}`,onClick:()=>fe(R.id),children:[jsx("div",{className:"modal-v2-avatar-small",style:{background:R.color},children:R.initials}),R.name,T.assignedUserIds?.includes(R.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"})})]},R.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:Se,children:[jsxs("button",{ref:jt,className:"modal-v2-field",onClick:()=>Ne(!ke),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:T.priority||"None"})]}),jsxs(No,{triggerRef:jt,isOpen:ke,onClose:()=>Ne(false),width:180,estimatedHeight:220,children:[Lu.map(R=>jsx("button",{className:`modal-v2-popover-item priority-${R.toLowerCase()} ${T.priority===R?"active":""}`,onClick:()=>ia(R),children:R},R)),jsx("button",{className:"modal-v2-popover-item",onClick:()=>ia(""),children:"None"})]})]}),v.length>0||w?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(Xa,{selectedTags:T.tags||[],availableTags:v,onChange:Ae,onCreateTag:w,theme:Ve[S]||Ve.dark})})]})}):jsxs("div",{className:"modal-v2-field-wrapper",ref:yt,children:[jsxs("button",{ref:ut,className:"modal-v2-field",onClick:()=>Ie(!tt),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:T.labels&&T.labels.length>0?jsx("span",{children:T.labels.join(", ")}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(No,{triggerRef:ut,isOpen:tt,onClose:()=>Ie(false),width:220,estimatedHeight:200,children:(m.length>0?m:["Bug","Feature","Enhancement","Documentation"]).map(R=>jsxs("button",{className:`modal-v2-popover-item ${T.labels?.includes(R)?"active":""}`,onClick:()=>Oe(R),children:[R,T.labels?.includes(R)&&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"})})]},R))})]}),jsxs("button",{className:"modal-v2-field",onClick:()=>{it(!st),setTimeout(()=>Be.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:T.endDate?new Date(T.endDate).toLocaleDateString():"Not set"}),jsx("input",{ref:Be,type:"date",value:typeof T.endDate=="string"?T.endDate.split("T")[0]:T.endDate?(()=>{let R=new Date(T.endDate),Y=R.getUTCFullYear(),V=String(R.getUTCMonth()+1).padStart(2,"0"),we=String(R.getUTCDate()).padStart(2,"0");return `${Y}-${V}-${we}`})():"",onChange:Ge,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxs("button",{className:"modal-v2-field",onClick:()=>O(!dt),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:T.estimatedTime?`${T.estimatedTime}h`:"Not set"})]}),dt&&jsx("div",{className:"modal-v2-popover",children:jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:T.estimatedTime||"",onChange:R=>_e(R.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>O(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:T.description||"",onChange:R=>{if(C){let Y={...C,description:R.target.value};H(Y);}},onBlur:He,placeholder:"Add a detailed description...",autoFocus:true}):jsx("div",{className:"modal-v2-content",onClick:()=>J(true),children:T.description?jsx("div",{className:"modal-v2-markdown",children:Q(T.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"}),ne.length>0&&jsxs("span",{className:"modal-v2-count",children:[ie,"/",ne.length]}),jsxs("button",{className:"modal-v2-add-button",onClick:()=>Re(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:[ne.map(R=>jsxs("div",{className:`modal-v2-subtask ${R.completed?"completed":""}`,children:[jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>rt(R.id),children:R.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:R.title}),jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>Qe(R.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"})]})})]},R.id)),Pe&&jsx("div",{className:"modal-v2-subtask-input-row",children:jsx("input",{type:"text",placeholder:"Subtask title...",value:le,onChange:R=>z(R.target.value),onKeyDown:R=>{R.key==="Enter"&&kt(),R.key==="Escape"&&(Re(false),z(""));},onBlur:kt,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(I||D.length>0)&&jsxs("section",{className:"modal-v2-section",children:[jsxs("div",{className:"modal-v2-section-header",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsx("h2",{children:"Attachments"}),D.length>0&&jsx("span",{className:"modal-v2-count",children:D.length})]}),jsx(er,{cardId:T.id,attachments:D,onUpload:I?R=>I(T.id,R):void 0,onDelete:k,maxSizeMB:10,maxFiles:20})]}),jsxs("section",{className:"modal-v2-section",children:[jsxs("div",{className:"modal-v2-section-header",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsx("h2",{children:"Activity"}),jsxs("div",{className:"modal-v2-filters",children:[jsx("button",{className:`modal-v2-filter ${E==="all"?"active":""}`,onClick:()=>q("all"),children:"All"}),jsx("button",{className:`modal-v2-filter ${E==="comments"?"active":""}`,onClick:()=>q("comments"),children:"Comments"}),jsx("button",{className:`modal-v2-filter ${E==="history"?"active":""}`,onClick:()=>q("history"),children:"History"})]})]}),jsxs("div",{className:"modal-v2-comment-input",children:[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:ae,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:L,onChange:R=>W(R.target.value),onKeyDown:Ht,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:ct,disabled:!L.trim(),children:"Send"})]})]})]}),jsxs("div",{className:"modal-v2-timeline",children:[oe.map(R=>{let Y=n.find(we=>we.id===R.userId);if(R.type.includes("COMMENT")){let we=s.find(Le=>Le.id===R.metadata?.commentId);return we?jsxs("div",{className:"modal-v2-activity-item comment-item",children:[Y&&jsx("div",{className:"modal-v2-avatar",style:{background:Y.color},children:Y.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:Y?.name||"Unknown"}),jsx("span",{className:"modal-v2-activity-time",children:new Date(R.timestamp).toLocaleString()})]}),jsx("div",{className:"modal-v2-comment-body",children:we.content})]})]},R.id):null}return jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxs("div",{className:"modal-v2-history-icon",children:[R.type.includes("CREATED")&&"\u2795",R.type.includes("UPDATED")&&"\u270F\uFE0F",R.type.includes("MOVED")&&"\u27A1\uFE0F",R.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",R.type.includes("ASSIGNED")&&"\u{1F464}",R.type.includes("PRIORITY")&&"\u{1F3AF}",R.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:Y?.name||"Unknown"})," ",R.type.replace(/_/g," ").toLowerCase(),R.newValue&&jsxs(Fragment,{children:[" to ",jsx("strong",{children:R.newValue})]})]}),jsx("span",{className:"modal-v2-activity-time",children:new Date(R.timestamp).toLocaleString()})]})]},R.id)}),oe.length===0&&jsxs("div",{className:"modal-v2-empty",children:[jsx("p",{children:"No activity yet"}),jsx("span",{children:"Activity will appear here"})]})]})]})]})})})}function _u({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 Ms({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let n=e.map(s=>({...s,average:s.average??e.reduce((c,p)=>c+p.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: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:"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(_u,{})}),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((s,c)=>s+c.completed,0)})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((s,c)=>s+c.completed,0)/e.length).toFixed(1)})]}),o&&e.some(s=>s.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((s,c)=>s+(c.planned||0),0)})]})]})]})}function Qu({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 As({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let n=r??(e[0]?.ideal||e[0]?.remaining||0),s=e[e.length-1]?.remaining||0,c=e[e.length-1]?.ideal||0,p=n>0?(n-s)/n*100:0,i=s<=c;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(Qu,{})}),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:p>=50?"#10B981":"#F59E0B"},children:[p.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:s})]}),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 lg={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},xd=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function dg({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:n}){let s=r+(o-r)*.5,c=e+s*Math.cos(-a*(Math.PI/180)),p=t+s*Math.sin(-a*(Math.PI/180));return n<.05?null:jsx("text",{x:c,y:p,fill:"white",textAnchor:c>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(n*100).toFixed(0)}%`})}function kd({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 Fs({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let n=e.reduce((p,i)=>p+i.value,0),s=e.map(p=>({...p,totalValue:n,color:p.color||lg[p.name]||xd[e.indexOf(p)%xd.length]})),c=s.map(p=>p.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:s,cx:"50%",cy:"50%",labelLine:false,label:o?dg:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:s.map((p,i)=>jsx(Cell,{fill:c[i]},`cell-${i}`))}),jsx(Tooltip,{content:jsx(kd,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(p,i)=>{let u=i.payload,d=n>0?(u.value/n*100).toFixed(0):"0";return `${p} (${u.value} - ${d}%)`}})]}):jsxs(BarChart,{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:"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(kd,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:s.map((p,i)=>jsx(Cell,{fill:c[i]},`cell-${i}`))})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:n})]}),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((p,i)=>i.value>p.value?i:p).name})]})]})]})}var dn=memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:n=[]})=>{let[s,c]=useState(false),[p,i]=useState(false),[u,d]=useState(false),[l,h]=useState(false);if(e.length===0)return null;let b=e.map(x=>x.id),m=x=>{r.onBulkUpdate?.(b,{priority:x}),c(false);},v=x=>{r.onBulkMove?.(b,x),i(false),a();},w=x=>{r.onBulkUpdate?.(b,{assignedUserIds:x}),d(false);},g=x=>{let N=new Set;e.forEach(I=>{I.labels?.forEach(k=>N.add(k));});let D=Array.from(new Set([...N,...x]));r.onBulkUpdate?.(b,{labels:D}),h(false);},f=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(b),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:()=>c(!s),title:"Update priority",children:jsx("span",{className:"text-sm",children:"Priority"})}),s&&jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(x=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>m(x),children:[jsx("span",{className:y("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(!p),title:"Move to column",children:jsx("span",{className:"text-sm",children:"Move"})}),p&&jsx("div",{className:"asakaa-bulk-menu",children:o.map(x=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>v(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:()=>w([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))})]}),n.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>h(!l),title:"Add labels",children:jsx("span",{className:"text-sm",children:"Labels"})}),l&&jsx("div",{className:"asakaa-bulk-menu",children:n.map(x=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>g([x]),children:x},x))})]}),jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:f,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"})})]})]})})});dn.displayName="BulkOperationsToolbar";function gg(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let n,s,c,p,i;switch(t){case "assignee":let u=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);u.length>0?u.forEach(h=>{let b=a?.find(m=>m.id===h);s=`assignee-${h}`,c=b?.name||`User ${h}`,p=b?.color,i=b?.avatar,r.has(s)||r.set(s,{id:s,title:c,groupValue:h,cardIds:[],color:p,icon:i}),r.get(s).cardIds.push(o.id);}):(s="assignee-unassigned",c="Unassigned",p="#6b7280",i="\u{1F464}",r.has(s)||r.set(s,{id:s,title:c,groupValue:null,cardIds:[],color:p,icon:i}),r.get(s).cardIds.push(o.id));break;case "priority":n=o.priority||"NONE",s=`priority-${n}`;let l={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"}}[n];c=l.title,p=l.color,r.has(s)||r.set(s,{id:s,title:c,groupValue:n,cardIds:[],color:p}),r.get(s).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(h=>{s=`label-${h}`,c=h,p="#6b7280",r.has(s)||r.set(s,{id:s,title:c,groupValue:h,cardIds:[],color:p}),r.get(s).cardIds.push(o.id);}):(s="label-none",c="No Labels",p="#6b7280",r.has(s)||r.set(s,{id:s,title:c,groupValue:null,cardIds:[],color:p}),r.get(s).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,n)=>o.title.localeCompare(n.title))}function Is({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[n,s]=useState(new Set),c=useMemo(()=>gg(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),p=useCallback(i=>{s(u=>{let d=new Set(u);return d.has(i)?d.delete(i):d.add(i),d});},[]);return t.groupBy==="none"||c.length===0?jsx(br,{board:e,callbacks:r,availableUsers:a,className:o}):jsxs("div",{className:y("asakaa-swimlane-view",o),children:[c.map(i=>{let u=n.has(i.id),d=e.cards.filter(h=>i.cardIds.includes(h.id)),l={...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&&p(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(br,{board:l,callbacks:r,availableUsers:a})})]},i.id)}),c.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 Ls=[{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 Bs({value:e,onChange:t,className:a}){let[r,o]=useState(false),n=useRef(null),s=useRef(null),c=Ls.find(i=>i.value===e)||Ls[0];useEffect(()=>{function i(u){n.current&&!n.current.contains(u.target)&&s.current&&!s.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);};return jsxs("div",{className:y("relative inline-block",a),children:[jsxs("button",{ref:s,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:c.icon}),jsx("span",{children:c.label}),jsx("svg",{className:y("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:n,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:Ls.map(i=>jsxs("button",{onClick:()=>p(i.value),className:y("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 Do=[{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 bg(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||{},n=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,s=o.shift?e.shiftKey:!e.shiftKey,c=o.alt?e.altKey:!e.altKey,p=o.meta?e.metaKey:true;return n&&s&&c&&p}function Dd(e={}){let{shortcuts:t=Do,enabled:a=true,preventDefault:r=true}=e,o=useRef(t),n=useRef(a);useEffect(()=>{o.current=t,n.current=a;},[t,a]);let s=useCallback(p=>{o.current=[...o.current,p];},[]),c=useCallback(p=>{o.current=o.current.filter(i=>i.action!==p);},[]);return useEffect(()=>{function p(i){if(!n.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(bg(i,d)){r&&i.preventDefault();let l=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(l);break}}}return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[r]),{registerShortcut:s,unregisterShortcut:c,isEnabled:a}}function vg(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function xg(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 kg(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=xg(e),r=t?vg(t):"";return a?`${a} + ${r}`:r}function wg(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 Rs({shortcuts:e=Do,isOpen:t,onClose:a,className:r}){let[o,n]=useState(false);if(useEffect(()=>{n(true);},[]),useEffect(()=>{function c(p){p.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[t,a]),!o||!t)return null;let s=wg(e);return jsxs("div",{className:y("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(s).map(([c,p])=>p.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"}),c]}),jsx("div",{className:"space-y-3",children:p.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:kg(i)})]},i.action))})]},c))})}),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 Os=[{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,48 +108,48 @@ 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 zs({templates:e,onSelectTemplate:t,className:a}){let[r,o]=useState(false),n=useRef(null),s=useRef(null);useEffect(()=>{function l(u){n.current&&!n.current.contains(u.target)&&s.current&&!s.current.contains(u.target)&&o(false);}if(r)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]);let p=l=>{t(l),o(false);},m=e.reduce((l,u)=>{let c=u.category||"Other";return l[c]||(l[c]=[]),l[c].push(u),l},{});return jsxs("div",{className:y("relative inline-block",a),children:[jsxs("button",{ref:s,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",l.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",l.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsx("span",{children:"Templates"}),jsx("svg",{className:y("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:n,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(([l,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:l})}),jsx("div",{children:u.map(c=>jsxs("button",{onClick:()=>p(c),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{className:"text-2xl leading-none mt-0.5",children:c.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:c.name}),c.description&&jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:c.description})]})]},c.id))})]},l)),e.length===0&&jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function Us({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:n}){let[s,p]=useState("export"),[m,l]=useState("json"),[u,c]=useState(null),d=useRef(null);if(!t)return null;let i=async()=>{let g=o?.current||void 0,b=await yl(e,m,g);vl(b,m);},w=async g=>{let b=g.target.files?.[0];if(b){try{let h=await wl(b),v=b.name.endsWith(".json")?"json":"csv",f=kl(h,v);c(f),f.success&&r&&r(f,h);}catch(h){c({success:false,errors:[`Failed to read file: ${h instanceof Error?h.message:"Unknown error"}`]});}d.current&&(d.current.value="");}};return jsxs("div",{className:y("fixed inset-0 z-[9999] flex items-center justify-center",n),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:y("flex-1 px-6 py-4 font-semibold transition-colors",s==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsx("button",{onClick:()=>p("import"),className:y("flex-1 px-6 py-4 font-semibold transition-colors",s==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxs("div",{className:"p-6",children:[s==="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(g=>jsxs("button",{onClick:()=>l(g),className:y("p-4 rounded-lg border-2 transition-all text-center",m===g?"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:[g==="json"&&"\u{1F4C4}",g==="csv"&&"\u{1F4CA}",g==="pdf"&&"\u{1F4DD}"]}),jsx("div",{className:"font-semibold uppercase text-xs",children:g})]},g))})]}),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:i,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"})]}),s==="import"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsx("input",{ref:d,type:"file",accept:".json,.csv",onChange:w,className:"hidden"}),jsxs("button",{onClick:()=>d.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),u&&jsxs("div",{className:y("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:y("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((g,b)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",g]},b))})]})]})]})]})]})}var Ng=["URGENT","HIGH","MEDIUM","LOW"],Sg=[{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"}],Eg=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Ws({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:n,onFilterOverdue:s,onFilterHighPriority:p,availableUsers:m=[],availableLabels:l=[],availableColumns:u=[],showQuickFilters:c=true,compact:d=false,groupBy:i="none",onGroupByChange:w}){let[g,b]=useState(true),h=useCallback(D=>{a({search:D.target.value});},[a]),v=useCallback(D=>{a({dateFilter:D.target.value});},[a]),f=useCallback(D=>{r({by:D.target.value});},[r]),x=useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),T=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxs("div",{className:`filter-bar ${d?"filter-bar--compact":""} ${g?"filter-bar--collapsed":""}`,children:[jsxs("div",{className:"filter-bar__header",onClick:()=>b(!g),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:g?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:D=>{D.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:D=>{D.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:g?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsx("polyline",{points:"6 9 12 15 18 9"})}),jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),T&&jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!g&&jsxs("div",{className:"filter-bar__content",children:[c&&jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsx("span",{className:"filter-bar__label",children:"Quick:"}),n&&jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),s&&jsx("button",{onClick:s,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:h,className:"filter-bar__search"})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.dateFilter,onChange:v,className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Dates"}),jsx("option",{value:"overdue",children:"Overdue"}),jsx("option",{value:"today",children:"Today"}),jsx("option",{value:"this-week",children:"This Week"})]})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.priorities[0]||"all",onChange:D=>{let I=D.target.value;a({priorities:I==="all"?[]:[I]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Priorities"}),Ng.map(D=>jsx("option",{value:D,children:D},D))]})}),m.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.assignees[0]||"all",onChange:D=>{let I=D.target.value;a({assignees:I==="all"?[]:[I]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Assignees"}),m.map(D=>jsx("option",{value:D.id,children:D.name},D.id))]})}),l.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.labels[0]||"all",onChange:D=>{let I=D.target.value;a({labels:I==="all"?[]:[I]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Labels"}),l.map(D=>jsx("option",{value:D,children:D},D))]})}),jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsx("select",{value:t.by,onChange:f,className:"filter-bar__select filter-bar__select--sm",children:Sg.map(D=>jsx("option",{value:D.value,children:D.label},D.value))}),t.by!=="none"&&jsx("button",{onClick:x,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),w&&jsx("div",{className:"filter-bar__field",children:jsx("select",{value:i,onChange:D=>w(D.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Eg.map(D=>jsx("option",{value:D.value,children:D.label},D.value))})}),T&&jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Hs({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:n,onExportGanttExcel:s,onExportGanttPNG:p,onExportGanttCSV:m}){let[l,u]=useState(false),c=useRef(null);useEffect(()=>{let i=w=>{c.current&&!c.current.contains(w.target)&&u(false);};return l&&document.addEventListener("mousedown",i),()=>{document.removeEventListener("mousedown",i);}},[l]);let d=i=>{i(),u(false);};return jsxs("div",{className:y("relative",r),ref:c,children:[jsxs("button",{onClick:()=>u(!l),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":l,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"3"}),jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsx("span",{children:"Config"})]}),l&&jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxs("button",{onClick:()=>d(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxs(Fragment,{children:[jsxs("button",{onClick:()=>d(async()=>await 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:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxs("button",{onClick:()=>d(async()=>await 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:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxs("button",{onClick:()=>d(async()=>await 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:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxs("button",{onClick:()=>d(()=>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:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxs("button",{onClick:()=>d(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"5"}),jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxs("button",{onClick:()=>d(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:i=>{i.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 Gs={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"}},_s={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"}},Vs={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"}},Lr={dark:Gs,light:_s,neutral:Vs},ln="dark";var dn=createContext(void 0),zg="asakaa-theme";function Nd({children:e,defaultTheme:t=ln,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}),n=useCallback(p=>{o(p),typeof window<"u"&&localStorage.setItem(a,p);},[a]);useEffect(()=>{if(typeof window>"u")return;let p=document.documentElement,m=Lr[r];Object.entries(m.colors).forEach(([u,c])=>{c&&p.style.setProperty(`--theme-${$g(u)}`,c);}),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,c])=>{let d=m.colors[u];d&&p.style.setProperty(c,d);}),p.setAttribute("data-theme",r),p.classList.remove("theme-dark","theme-light","theme-neutral"),p.classList.add(`theme-${r}`);},[r]);let s={theme:r,setTheme:n,themes:Lr};return jsx(dn.Provider,{value:s,children:e})}function ro(){let e=useContext(dn);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function $g(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function js({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=ro();return e?jsxs("div",{className:y("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(Lr).map(([n,s])=>jsxs("button",{onClick:()=>{o(n),t();},className:y("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===n?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===n?"var(--theme-accent-primary)20":"transparent"},children:[jsx("div",{className:"text-3xl",children:s.emoji}),jsxs("div",{className:"text-left flex-1",children:[jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:s.displayName}),jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[n==="dark"&&"Default dark theme with Linear-inspired colors",n==="light"&&"Clean light theme with high contrast",n==="neutral"&&"Monochrome zen theme"]})]}),r===n&&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"})})]},n))})]})]}):null}function Sd(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return Ve[e]||Ve.dark;let t=document.documentElement,a=getComputedStyle(t),r=(n,s)=>a.getPropertyValue(n).trim()||s;return {bgPrimary:r("--theme-bg-primary",Ve[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",Ve[e].bgSecondary),bgGrid:r("--theme-bg-card",Ve[e].bgGrid),bgWeekend:r("--theme-bg-hover",Ve[e].bgWeekend),border:r("--theme-border-primary",Ve[e].border),borderLight:r("--theme-border-subtle",Ve[e].borderLight),textPrimary:r("--theme-text-primary",Ve[e].textPrimary),textSecondary:r("--theme-text-secondary",Ve[e].textSecondary),textTertiary:r("--theme-text-tertiary",Ve[e].textTertiary),accent:r("--theme-accent-primary",Ve[e].accent),accentHover:r("--theme-accent-hover",Ve[e].accentHover),accentLight:r("--theme-accent-primary",Ve[e].accentLight),taskBarPrimary:r("--theme-accent-primary",Ve[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",Ve[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",Ve[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",Ve[e].dependency),dependencyHover:r("--theme-border-secondary",Ve[e].dependencyHover),criticalPath:r("--theme-error",Ve[e].criticalPath),criticalPathLight:r("--theme-error",Ve[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",Ve[e].today):e==="neutral"?r("--theme-text-primary",Ve[e].today):r("--theme-error",Ve[e].today),todayLight:e==="light"?r("--theme-accent-primary",Ve[e].todayLight):e==="neutral"?r("--theme-text-primary",Ve[e].todayLight):r("--theme-error",Ve[e].todayLight),milestone:r("--theme-warning",Ve[e].milestone),milestoneLight:r("--theme-warning",Ve[e].milestoneLight),statusTodo:r("--theme-text-tertiary",Ve[e].statusTodo),statusInProgress:r("--theme-accent-primary",Ve[e].statusInProgress),statusCompleted:r("--theme-success",Ve[e].statusCompleted),hoverBg:r("--theme-bg-hover",Ve[e].hoverBg),focusRing:r("--theme-accent-primary",Ve[e].focusRing)}}var cn={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"},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"}},Ed={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"},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"}},Ks={en:cn,es:Ed};function Pd(e){return Ks[e]||Ks.en}function Ys(e,t){let a=Pd(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 no=createContext(cn);function No(){return useContext(no)}function af({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:n,onExportMSProject:s}){let[p,m]=useState(false),[l,u]=useState(null),c=useRef(null),d=No();if(useEffect(()=>{let b=h=>{c.current&&!c.current.contains(h.target)&&m(false);};return p&&document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[p]),!(t||a||r||o||n||s))return null;let w=[{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:n},{id:"msproject",label:"MS Project",description:"XML",icon:jsx(FolderKanban,{className:"w-4 h-4"}),handler:s}].filter(b=>b.handler),g=async(b,h)=>{if(h){u(b);try{await h();}catch(v){console.error(`Export ${b} failed:`,v);}finally{u(null),m(false);}}};return jsxs("div",{ref:c,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:d.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:w.map((b,h)=>jsxs(motion.button,{onClick:()=>g(b.id,b.handler),disabled:l!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:h<w.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:h*.03},children:[jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:l===b.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-4 h-4"})}):b.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:b.label}),jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:b.description})]})]},b.id))})})})]})}function rf({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(n=>{let s=t===n.value;return jsxs(motion.button,{onClick:()=>a(n.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:s?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500,zIndex:s?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[s&&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}}),n.icon&&jsx("span",{className:"relative z-10",style:{color:s?"#FFFFFF":r.textTertiary},children:n.icon}),jsx("span",{className:"relative z-10",style:{color:s?"#FFFFFF":r.textTertiary},children:n.label})]},n.value)})})}function of({options:e,value:t,onChange:a,theme:r}){return jsx("div",{className:"inline-flex items-center gap-1",children:e.map(o=>{let n=t===o.value;return jsxs(motion.button,{onClick:()=>a(o.value),className:"relative px-3 py-1.5 text-xs transition-all",style:{color:n?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:n?600:500},whileHover:{color:n?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsx("span",{children:o.label}),n&&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 nf({theme:e,value:t,onChange:a}){let[r,o]=useState(false),n=useRef(null),s=No();useEffect(()=>{let l=u=>{n.current&&!n.current.contains(u.target)&&o(false);};return r&&document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]);let p=[{value:"compact",label:s.toolbar.compact||"Compact"},{value:"comfortable",label:s.toolbar.normal||"Normal"},{value:"spacious",label:s.toolbar.spacious||"Spacious"}],m=p.find(l=>l.value===t)?.label||"Normal";return jsxs("div",{ref:n,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:`${s.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((l,u)=>{let c=t===l.value;return jsxs(motion.button,{onClick:()=>{a(l.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:c?e.accentLight:"transparent",borderBottom:u<p.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:c?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:c?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:c?600:500},children:l.label}),c&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},l.value)})})})})]})}function pn({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:n,onThemeChange:s,rowDensity:p,onRowDensityChange:m,showThemeSelector:l=false,showCreateTaskButton:u=false,createTaskLabel:c,onCreateTask:d,onExportPNG:i,onExportPDF:w,onExportExcel:g,onExportCSV:b,onExportJSON:h,onExportMSProject:v}){let f=No(),x=i||w||g||b||h||v,T=[{value:"day",label:f.toolbar.day},{value:"week",label:f.toolbar.week},{value:"month",label:f.toolbar.month}],D=[{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(of,{options:T,value:t,onChange:I=>a(I),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(nf,{theme:e,value:p,onChange:m})]}),jsxs("div",{className:"flex items-center gap-3",children:[u&&d&&jsxs(Fragment,{children:[jsxs(motion.button,{onClick:d,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:c||f.toolbar.createTask})]}),(x||l)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),x&&jsxs(Fragment,{children:[jsx(af,{theme:e,onExportPNG:i,onExportPDF:w,onExportExcel:g,onExportCSV:b,onExportJSON:h,onExportMSProject:v}),l&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),l&&jsx(rf,{options:D,value:n,onChange:I=>s(I),theme:e})]})]})}function mn({columns:e,onToggleColumn:t,theme:a}){let[r,o]=useState(false),[n,s]=useState({x:0,y:0}),p=useRef(null),m=useRef(null);useEffect(()=>{if(!r)return;let u=c=>{p.current&&!p.current.contains(c.target)&&o(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r]);let l=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();s({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(it,{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:`${n.x}px`,top:`${n.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),l.map(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:c=>{c.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:c=>{c.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 so({isOpen:e,x:t,y:a,items:r,onClose:o,theme:n}){let s=useRef(null),[p,m]=useState({x:t,y:a});if(useEffect(()=>{if(!e)return;let u=200,c=r.length*36+8,d=8,i=window.innerWidth,w=window.innerHeight,g=t,b=a;t+u+d>i&&(g=t-u,g<d&&(g=d)),a+c+d>w&&(b=w-c-d,b<d&&(b=d)),m({x:g,y:b});},[e,t,a,r.length]),useEffect(()=>{if(!e)return;let u=d=>{s.current&&!s.current.contains(d.target)&&o();},c=d=>{d.key==="Escape"&&o();};return document.addEventListener("mousedown",u),document.addEventListener("keydown",c),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",c);}},[e,o]),!e)return null;let l=u=>u.startsWith("#")&&(u.length===7||u.length===4)?u:n.bgPrimary?.includes("1")||n.bgPrimary?.includes("2")||n.textPrimary?.toLowerCase().includes("fff")||n.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsx(AnimatePresence,{children:jsx(motion.div,{ref:s,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:l(n.bgSecondary),border:`1px solid ${n.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:n.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?n.textTertiary:n.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:u.disabled?"not-allowed":"pointer",opacity:u.disabled?.5:1},onMouseEnter:c=>{u.disabled||(c.currentTarget.style.backgroundColor=n.hoverBg);},onMouseLeave:c=>{c.currentTarget.style.backgroundColor="transparent";},children:[u.icon&&jsx("span",{style:{color:n.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:n.textTertiary}})]})]},u.id))})})})}var Et={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 Hd({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:n,onTaskMove:s,onTaskIndent:p,onTaskOutdent:m,onTaskRename:l,onTaskToggleExpand:u,onOpenTaskModal:c,enableKeyboard:d=true}){let i=useRef(false),w=useCallback(f=>{i.current=f;},[]),g=useCallback(f=>{let x=[],T=D=>{for(let I of D)x.push(I),I.subtasks&&I.subtasks.length>0&&I.isExpanded&&T(I.subtasks);};return T(f),x},[]),b=useCallback(()=>{let f=g(e);for(let x of f)if(t.has(x.id))return x;return null},[e,t,g]),h=useCallback((f,x)=>{let T=g(e);if(T.length===0)return;let D=b();if(!D){a(T[0].id,false);return}let I=T.findIndex(N=>N.id===D.id);if(I===-1)return;let k=f==="up"?I-1:I+1;if(k<0||k>=T.length)return;let L=T[k];a(L.id,x);},[e,b,g,a]),v=useCallback(f=>{if(!d)return;let x=f.target;if(x.tagName==="INPUT"||x.tagName==="TEXTAREA"||x.isContentEditable||i.current){f.key==="Escape"&&(x.blur(),i.current=false);return}let I=navigator.platform.toUpperCase().indexOf("MAC")>=0?f.metaKey:f.ctrlKey,k=Array.from(t),L=b();if(f.key==="ArrowUp"){f.preventDefault(),h("up",f.shiftKey);return}if(f.key==="ArrowDown"){f.preventDefault(),h("down",f.shiftKey);return}if(L&&(f.key==="ArrowRight"||f.key==="ArrowLeft")){L.subtasks&&L.subtasks.length>0&&(f.preventDefault(),(f.key==="ArrowRight"&&!L.isExpanded||f.key==="ArrowLeft"&&L.isExpanded)&&u(L.id));return}if(f.altKey&&(f.key==="ArrowUp"||f.key==="ArrowDown")){k.length>0&&(f.preventDefault(),s(k,f.key==="ArrowUp"?"up":"down"));return}if(f.key==="Tab"&&!f.shiftKey){k.length>0&&(f.preventDefault(),p(k));return}if(f.key==="Tab"&&f.shiftKey){k.length>0&&(f.preventDefault(),m(k));return}if(f.key==="Enter"&&!f.shiftKey&&!I){L&&(f.preventDefault(),r(L.id,"below"));return}if(f.key==="Enter"&&f.shiftKey&&!I){L&&(f.preventDefault(),r(L.id,"above"));return}if(f.key==="Enter"&&I){L&&(f.preventDefault(),c(L.id));return}if(f.key==="F2"){L&&(f.preventDefault(),l(L.id));return}if(f.key==="Delete"||f.key==="Backspace"&&I){k.length>0&&(f.preventDefault(),o(k));return}if(f.key==="d"&&I&&!f.shiftKey){k.length>0&&(f.preventDefault(),n(k));return}},[d,t,b,h,r,o,n,s,p,m,l,u,c]);return useEffect(()=>{if(d)return window.addEventListener("keydown",v),()=>{window.removeEventListener("keydown",v);}},[d,v]),{setIsEditing:w}}function _d(){let[e,t]=useState(new Set),[a,r]=useState(null),o=useCallback(c=>{t(new Set([c])),r(c);},[]),n=useCallback(c=>{t(d=>{let i=new Set(d);return i.has(c)?i.delete(c):i.add(c),i}),r(c);},[]),s=useCallback((c,d)=>{if(!a){o(c);return}let i=d.indexOf(a),w=d.indexOf(c);if(i===-1||w===-1){o(c);return}let g=Math.min(i,w),b=Math.max(i,w),h=d.slice(g,b+1);t(new Set(h)),r(c);},[a,o]),p=useCallback((c,d,i,w)=>{w?s(c,d):i?n(c):o(c);},[o,n,s]),m=useCallback((c,d)=>{d?t(i=>{let w=new Set(i);return w.add(c),w}):o(c);},[o]),l=useCallback(()=>{t(new Set),r(null);},[]),u=useCallback(c=>e.has(c),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:n,selectTaskRange:s,handleTaskClick:p,handleKeyboardSelection:m,clearSelection:l,isTaskSelected:u}}function io(e){let t=[],a=(r,o,n=0)=>{for(let s=0;s<r.length;s++){let p={...r[s],parentId:o,level:n,position:s};t.push(p),p.subtasks&&p.subtasks.length>0&&p.isExpanded&&a(p.subtasks,p.id,n+1);}};return a(e),t}function Vd(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Vd(a.subtasks,t);if(r)return r}}return null}function Js(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=Js(a.subtasks,t);if(r)return r}return null}function Zs(e,t){if(t.length===0)return e;let a=io(e),r=t[0],o=a.findIndex(c=>c.id===r);if(o<=0)return e;let n=a[o-1],s=(c,d)=>{let i=[];return {tasks:c.filter(g=>{if(d.has(g.id))return i.push(g),false;if(g.subtasks){let b=s(g.subtasks,d);g.subtasks=b.tasks,i.push(...b.removed);}return true}),removed:i}},p=(c,d,i)=>c.map(w=>w.id===d?{...w,subtasks:[...w.subtasks||[],...i],isExpanded:true}:w.subtasks?{...w,subtasks:p(w.subtasks,d,i)}:w),m=new Set(t),{tasks:l,removed:u}=s(e,m);return p(l,n.id,u)}function Qs(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=Js(a,r);if(!o)continue;let n=Js(a,o.id),s=(l,u,c)=>{for(let d=0;d<l.length;d++){let i=l[d];if(i.id===u&&i.subtasks){let w=i.subtasks.findIndex(g=>g.id===c);if(w!==-1){let[g]=i.subtasks.splice(w,1);return g}}if(i.subtasks){let w=s(i.subtasks,u,c);if(w)return w}}return null},p=(l,u,c)=>{let d=l.findIndex(i=>i.id===u);if(d!==-1)return l.splice(d+1,0,c),l;for(let i of l)i.subtasks&&p(i.subtasks,u,c);return l},m=s(a,o.id,r);m&&(n&&n.subtasks?p(n.subtasks,o.id,m):p(a,o.id,m));}return a}function ei(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],n=(s,p,m)=>{let l=s.findIndex(c=>c.id===p);if(l===-1){for(let c of s)if(c.subtasks&&n(c.subtasks,p,m))return true;return false}let u=m==="up"?l-1:l+1;return u<0||u>=s.length?false:([s[l],s[u]]=[s[u],s[l]],true)};return n(r,o,a),r}function ti(e,t){let a=new Set(t),r=o=>o.filter(n=>!a.has(n.id)).map(n=>n.subtasks?{...n,subtasks:r(n.subtasks)}:n);return r(e)}function ai(e,t){let a=[...e];for(let r of t){let o=s=>{let p=s.findIndex(u=>u.id===r);if(p===-1){for(let u of s)if(u.subtasks&&o(u.subtasks))return true;return false}let m=s[p],l={...m,id:`${m.id}-copy-${Date.now()}`,name:`${m.name} (Copy)`,subtasks:m.subtasks?n(m.subtasks):void 0};return s.splice(p+1,0,l),true},n=s=>s.map(p=>({...p,id:`${p.id}-copy-${Date.now()}`,subtasks:p.subtasks?n(p.subtasks):void 0}));o(a);}return a}function jd(e,t,a){let r=[...e],o=new Date,n=new Date(o);n.setDate(n.getDate()+7);let s={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:n,color:"#6366F1"},p=m=>{let l=m.findIndex(c=>c.id===t);if(l===-1){for(let c of m)if(c.subtasks&&p(c.subtasks))return true;return false}let u=a==="above"?l:l+1;return m.splice(u,0,s),true};return p(r),{tasks:r,newTask:s}}function ri(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:ri(r.subtasks,t,a)}:r)}function oi(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:oi(a.subtasks,t)}:a)}function ni(e,t){let a=u=>{for(let c of u){if(c.id===t)return c;if(c.subtasks){let d=a(c.subtasks);if(d)return d}}return null},r=a(e),o=new Date,n=new Date(o);n.setDate(n.getDate()+7);let s=r?.startDate||o,p=r?.endDate||n,m={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(s),endDate:new Date(p),color:r?.color||"#3B82F6"},l=u=>u.map(c=>{if(c.id===t){let d=c.subtasks||[];return {...c,subtasks:[...d,m],isExpanded:true}}return c.subtasks?{...c,subtasks:l(c.subtasks)}:c});return {tasks:l(e),newTask:m}}function Kd(e,t,a,r){if(t===a)return e;let o=Vd(e,t);if(!o)return e;if(a){let p=(m,l)=>{if(!m.subtasks)return false;for(let u of m.subtasks)if(u.id===l||p(u,l))return true;return false};if(p(o,a))return e}let n=p=>p.filter(m=>m.id!==t).map(m=>m.subtasks&&m.subtasks.length>0?{...m,subtasks:n(m.subtasks)}:m),s=n(e);if(a===null){let p=r!==void 0?r:s.length;s.splice(p,0,{...o,parentId:void 0});}else {let p=m=>m.map(l=>{if(l.id===a){let u=l.subtasks||[],c=r!==void 0?r:u.length,d=[...u];return d.splice(c,0,{...o,parentId:a}),{...l,subtasks:d,isExpanded:true}}return l.subtasks&&l.subtasks.length>0?{...l,subtasks:p(l.subtasks)}:l});s=p(s);}return s}function fn({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:n,onTaskDblClick:s,onTaskContextMenu:p,onTaskToggle:m,scrollTop:l,columns:u,onToggleColumn:c,onColumnResize:d,onTaskUpdate:i,onTaskIndent:w,onTaskOutdent:g,onTaskMove:b,onMultiTaskDelete:h,onTaskDuplicate:v,onTaskCreate:f,onTaskRename:x,onCreateSubtask:T,onOpenTaskModal:D,onDeleteRequest:I,onTaskReparent:k}){let L=useContext(no),[N,C]=useState(null),[G,F]=useState(null),[J,K]=useState(""),de=useRef(null),[ge,Te]=useState(null),[Ce,z]=useState(0),[B,$]=useState(0),[P,Q]=useState({isOpen:false,x:0,y:0,type:"header"}),[ee,H]=useState(null),[De,Ee]=useState(null),[Be,xe]=useState(null),U=useRef(0),ae=5,Me=useRef(false),[_e,qe]=useState(null),[Ke,O]=useState(false),[re,ce]=useState(null),[fe,Ae]=useState(false),ot=useRef(null);useEffect(()=>{function _(Z){ot.current&&!ot.current.contains(Z.target)&&Ae(false);}if(fe)return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[fe]),useEffect(()=>{G&&de.current&&(de.current.focus(),de.current.select());},[G]),useEffect(()=>{if(!ge)return;let _=ve=>{let Y=ve.clientX-Ce,ne=B+Y;d?.(ge,ne);},Z=()=>{Te(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",_),document.addEventListener("mouseup",Z),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",_),document.removeEventListener("mouseup",Z),document.body.style.cursor="",document.body.style.userSelect="";}},[ge,Ce,B,d]);let{selectedTaskIds:kt,handleTaskClick:Le,isTaskSelected:ke}=_d(),{setIsEditing:Ie}=Hd({tasks:e,selectedTaskIds:kt,onTaskSelect:(_,Z)=>{let Y=io(e).map(ne=>ne.id);Le(_,Y,Z||false,false);},onTaskCreate:f||(()=>{}),onTaskDelete:h||(()=>{}),onTaskDuplicate:v||(()=>{}),onTaskMove:b||(()=>{}),onTaskIndent:w||(()=>{}),onTaskOutdent:g||(()=>{}),onTaskRename:_=>{let Z=io(e).find(ve=>ve.id===_);Z&&Ue(Z);},onTaskToggleExpand:m||(()=>{}),onOpenTaskModal:_=>{let Z=io(e).find(ve=>ve.id===_);Z&&D&&D(Z);},enableKeyboard:true}),Zt=(_,Z=0)=>{let ve=[];for(let Y of _)ve.push({task:Y,level:Z}),Y.subtasks&&Y.subtasks.length>0&&Y.isExpanded&&ve.push(...Zt(Y.subtasks,Z+1));return ve},vt=Zt(e),sa=48,Na=Math.max(vt.length*a,600-sa),Oe=_=>!_.startDate||!_.endDate?"-":`${Math.ceil((_.endDate.getTime()-_.startDate.getTime())/(1e3*60*60*24))}d`,Ue=_=>{F(_.id),K(_.name),Ie(true);},qt=_=>{J.trim()&&J!==e.find(Z=>Z.id===_)?.name&&x?.(_,J.trim()),F(null),K(""),Ie(false);},he=()=>{F(null),K(""),Ie(false);},Ge=(_,Z)=>{Z.stopPropagation(),T?.(_.id);},Fe=(_,Z)=>{Z.preventDefault(),U.current=Z.clientY,H(_),Me.current=false,O(false),qe({x:Z.clientX,y:Z.clientY});},tt=_=>{if(!ee||(Math.abs(_.clientY-U.current)>ae&&!Me.current&&(Me.current=true,O(true)),qe({x:_.clientX,y:_.clientY}),!Me.current))return;let ve=document.querySelectorAll("[data-task-row]"),Y=null,ne=null;ve.forEach(R=>{let W=R.getBoundingClientRect(),Ne=R.getAttribute("data-task-row");if(Ne&&Ne!==ee&&_.clientY>=W.top&&_.clientY<=W.bottom){Y=Ne;let et=_.clientY-W.top,$e=W.height;et<$e*.25?ne="above":et>$e*.75?ne="below":ne="child";}}),Ee(Y),xe(ne);},Xe=()=>{if(Me.current&&ee&&De&&Be){if(Be==="child")k?.(ee,De);else if(Be==="above"||Be==="below"){let _=(Y,ne,R=null)=>{for(let W of Y){if(W.id===ne)return R;if(W.subtasks){let Ne=_(W.subtasks,ne,W.id);if(Ne!==void 0)return Ne}}},Z=_(e,De,null),ve=(Y,ne)=>{let R=Y.findIndex(W=>W.id===ne);return Be==="below"?R+1:R};if(Z===null){let Y=ve(e,De);k?.(ee,null,Y);}else {let Y=vt.find(ne=>ne.task.id===Z)?.task;if(Y?.subtasks){let ne=ve(Y.subtasks,De);k?.(ee,Z,ne);}}}}H(null),Ee(null),xe(null),qe(null),Me.current=false,O(false);};useEffect(()=>{if(ee)return document.addEventListener("mousemove",tt),document.addEventListener("mouseup",Xe),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",tt),document.removeEventListener("mouseup",Xe),document.body.style.cursor="",document.body.style.userSelect="";}},[ee,De,Be]);let wt=(_,Z,ve)=>{switch(_.id){case "name":let Y=G===Z.id,ne=N===Z.id;return jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${ve*20}px`},children:[k&&jsx("div",{className:"cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-white/10 transition-all flex-shrink-0",style:{color:t.textTertiary,opacity:ne?1:.3},onMouseDown:se=>Fe(Z.id,se),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),Z.subtasks&&Z.subtasks.length>0?jsx("button",{onClick:se=>{se.stopPropagation(),m?.(Z.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:Z.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:Z.color||"#3B82F6",opacity:Z.parentId?.6:1,borderColor:Z.isMilestone?t.accent:"transparent",borderWidth:Z.isMilestone?"2px":"0px"},title:Z.isMilestone?"Milestone":Z.parentId?"Subtask":"Task"})}),Y?jsx("input",{ref:de,type:"text",value:J,onChange:se=>K(se.target.value),onKeyDown:se=>{se.key==="Enter"?qt(Z.id):se.key==="Escape"&&he();},onBlur:()=>qt(Z.id),className:"flex-1 px-2 py-1 rounded border outline-none",style:{backgroundColor:t.bgPrimary,borderColor:t.accent,color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:"13px",fontWeight:500},onClick:se=>se.stopPropagation()}):jsxs(Fragment,{children:[jsx("span",{className:"flex-1",style:{color:Z.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:Z.parentId?"13px":"14px",fontWeight:Z.isMilestone?600:Z.parentId?400:600,letterSpacing:Z.parentId?"0":"-0.01em"},title:Z.name,children:Z.name}),ne&&!Y&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:se=>se.stopPropagation(),children:[jsx("button",{onClick:se=>Ge(Z,se),className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Create subtask",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx("button",{onClick:se=>{se.stopPropagation(),Ue(Z);},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 W=_.id==="startDate"?"startDate":"endDate",Ne=Z[W],et=re?.taskId===Z.id&&re?.field===W,$e=se=>se?(typeof se=="string"?new Date(se):se).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:se=>se.stopPropagation(),children:[jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors hover:bg-white/5",style:{color:t.textSecondary},onClick:se=>{if(et)ce(null);else {let Mt=se.currentTarget.getBoundingClientRect();ce({taskId:Z.id,field:W,month:Ne?typeof Ne=="string"?new Date(Ne):Ne:new Date,position:{top:Mt.bottom+4,left:Mt.left}});}},children:[jsx(Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsx("span",{children:$e(Ne)})]}),et&&typeof document<"u"&&createPortal(jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>ce(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:re?.position.top,left:re?.position.left},onClick:se=>se.stopPropagation(),children:[jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let se=new Date,Mt=new Date(se);Mt.setDate(se.getDate()+1);let aa=new Date(se);aa.setDate(se.getDate()+7);let _r=new Date(se);return _r.setDate(se.getDate()+14),[{label:"Hoy",date:se},{label:"Ma\xF1ana",date:Mt},{label:"Pr\xF3xima semana",date:aa},{label:"2 semanas",date:_r}].map((ir,Qa)=>jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:Tr=>Tr.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Tr=>Tr.currentTarget.style.backgroundColor="transparent",onClick:()=>{i?.(Z.id,{[W]:ir.date}),ce(null);},children:ir.label},Qa))})(),jsx("div",{style:{borderTop:`1px solid ${t.border}`,margin:"0.25rem 0"}}),jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:se=>se.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:se=>se.currentTarget.style.backgroundColor="transparent",onClick:()=>{i?.(Z.id,{[W]:void 0}),ce(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:()=>ce(se=>se?{...se,month:new Date(se.month.getFullYear(),se.month.getMonth()-1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronLeft,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})}),jsx("span",{className:"text-xs font-medium",style:{color:t.textPrimary},children:re?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>ce(se=>se?{...se,month:new Date(se.month.getFullYear(),se.month.getMonth()+1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:["D","L","M","M","J","V","S"].map((se,Mt)=>jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:se},Mt))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let se=re?.month||new Date,Mt=se.getFullYear(),aa=se.getMonth(),_r=new Date(Mt,aa,1).getDay(),Ho=new Date(Mt,aa+1,0).getDate(),ir=new Date,Qa=[];for(let Ut=_r-1;Ut>=0;Ut--)Qa.push({day:new Date(Mt,aa,-Ut).getDate(),date:new Date(Mt,aa-1,new Date(Mt,aa,-Ut).getDate()),isCurrentMonth:false});for(let Ut=1;Ut<=Ho;Ut++)Qa.push({day:Ut,date:new Date(Mt,aa,Ut),isCurrentMonth:true});let Tr=42-Qa.length;for(let Ut=1;Ut<=Tr;Ut++)Qa.push({day:Ut,date:new Date(Mt,aa+1,Ut),isCurrentMonth:false});return Qa.map((Ut,uo)=>{let jn=Ut.date.toDateString()===ir.toDateString(),go=(Ne?typeof Ne=="string"?new Date(Ne):Ne:null)?.toDateString()===Ut.date.toDateString();return jsx("button",{type:"button",className:"w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",style:{color:Ut.isCurrentMonth?go?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:go?"#3B82F6":"transparent",boxShadow:jn&&!go?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{i?.(Z.id,{[W]:Ut.date}),ce(null);},children:Ut.day},uo)})})()})]})]})]}),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(Z)})});case "assignees":let mt=r.filter(se=>Z.assignees?.some(Mt=>Mt.name===se.name||Mt.initials===se.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:se=>se.stopPropagation(),children:jsx(Mr,{assignedUsers:mt,availableUsers:r,onChange:se=>{let Mt=se.map(aa=>({id:aa.id,name:aa.name,initials:aa.initials,color:aa.color}));i?.(Z.id,{assignees:Mt.length>0?Mt:void 0});}})});case "status":return jsx("div",{className:"flex items-center justify-center w-full",onClick:se=>se.stopPropagation(),children:jsx(Wl,{status:Z.status||"todo",onChange:se=>{i?.(Z.id,{status:se,progress:se==="completed"?100:Z.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:`${Z.progress}%`,backgroundColor:Z.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:[Z.progress,"%"]})]});case "priority":let Re={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},ut={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},$t=Re[Z.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:se=>se.stopPropagation(),children:jsx(Er,{priority:$t,onChange:se=>{se&&i?.(Z.id,{priority:ut[se]||"medium"});}})});default:return null}},st=_=>[{id:"hide",label:"Hide Column",icon:Et.Hide,onClick:()=>c(_),disabled:_==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Et.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Et.SortDesc,onClick:()=>{}}],Qe=_=>_.subtasks&&_.subtasks.length>0?[{id:"addSubtask",label:L?.contextMenu?.addSubtask||"Add Subtask",icon:Et.Add,onClick:()=>{T?.(_.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:L?.contextMenu?.deleteTask||"Delete Task",icon:Et.Delete,onClick:()=>{I?I(_.id,_.name):h?.([_.id]);}}]:[{id:"edit",label:L?.contextMenu?.editTask||"Edit Task",icon:Et.Pencil,onClick:()=>{s?.(_);}},{id:"addSubtask",label:L?.contextMenu?.addSubtask||"Add Subtask",icon:Et.Add,onClick:()=>{T?.(_.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:L?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Et.MarkIncomplete,onClick:()=>{i?.(_.id,{status:"todo",progress:0});},disabled:_.status==="todo"},{id:"setInProgress",label:L?.contextMenu?.setInProgress||"Set In Progress",icon:Et.SetInProgress,onClick:()=>{i?.(_.id,{status:"in-progress"});},disabled:_.status==="in-progress"},{id:"markComplete",label:L?.contextMenu?.markComplete||"Mark Complete",icon:Et.MarkComplete,onClick:()=>{i?.(_.id,{status:"completed",progress:100});},disabled:_.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:L?.contextMenu?.splitTask||"Split Task",icon:Et.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:L?.contextMenu?.deleteTask||"Delete Task",icon:Et.Delete,onClick:()=>{I?I(_.id,_.name):h?.([_.id]);}}],A=u.filter(_=>_.visible),ue=A.reduce((_,Z)=>_+Z.width,0);return jsxs("div",{className:"h-full",style:{backgroundColor:t.bgPrimary,minWidth:ue},children:[jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${sa}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsx("div",{className:"flex items-center flex-1 min-w-0",children:A.map((_,Z)=>{let ve=Z===A.length-1,Y=_.id==="name";return jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${Y?"":"justify-center"}`,style:{width:`${_.width}px`,minWidth:`${_.minWidth??(Y?200:60)}px`,maxWidth:`${_.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:ve?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:ne=>{ne.preventDefault(),Q({isOpen:true,x:ne.clientX,y:ne.clientY,type:"header",columnId:_.id});},onMouseEnter:ne=>{ne.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:ne=>{ne.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:ge===_.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:ne=>{ne.preventDefault(),ne.stopPropagation(),Te(_.id),z(ne.clientX),$(_.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(mn,{columns:u,onToggleColumn:c,theme:t}),jsx("button",{onClick:()=>Ae(!fe),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"})}),fe&&jsxs("div",{ref:ot,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:()=>Ae(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:Na},children:vt.map(({task:_,level:Z},ve)=>{let Y=ke(_.id),ne=De===_.id,R=ne&&Be==="above",W=ne&&Be==="below",Ne=ne&&Be==="child",et={};return Ne&&(et.backgroundColor=`${t.accent}15`,et.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":_.id,className:`flex items-center cursor-pointer group ${ee===_.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:Y?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:Y?t.accentLight:Ne?`${t.accent}15`:ve%2===0?t.bgPrimary:t.bgGrid,...et},onMouseEnter:()=>C(_.id),onMouseLeave:()=>C(null),onClick:$e=>{let Re=io(e).map(se=>se.id),$t=navigator.platform.toUpperCase().indexOf("MAC")>=0?$e.metaKey:$e.ctrlKey;Le(_.id,Re,$t,$e.shiftKey),n?.(_);},onDoubleClick:$e=>{$e.stopPropagation(),s?.(_);},onContextMenu:$e=>{$e.preventDefault(),Q({isOpen:true,x:$e.clientX,y:$e.clientY,type:"task",task:_}),p?.(_,$e);},whileHover:{backgroundColor:Y?t.accentLight:t.hoverBg},children:[R&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),W&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),A.map(($e,mt)=>{let Re=mt===A.length-1,ut=$e.id==="name";return jsx("div",{className:`px-4 flex items-center ${ut?"justify-start":"justify-center"}`,style:{width:`${$e.width}px`,minWidth:`${$e.minWidth??(ut?200:60)}px`,maxWidth:`${$e.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:Re?"none":`1px solid ${N===_.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:wt($e,_,ut?Z:0)},`${_.id}-${$e.id}`)})]},_.id)})}),jsx(so,{isOpen:P.isOpen,x:P.x,y:P.y,items:P.type==="header"&&P.columnId?st(P.columnId):P.type==="task"&&P.task?Qe(P.task):[],onClose:()=>Q({...P,isOpen:false}),theme:t}),Ke&&_e&&ee&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:_e.x+12,top:_e.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let _=vt.find(Z=>Z.task.id===ee)?.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 Zd(e,t){let[a,r]=useState("none"),[o,n]=useState(0),[s,p]=useState(e),[m,l]=useState(t),[u,c]=useState(null),[d,i]=useState(null),[w,g]=useState(null),[b,h]=useState(null),[v,f]=useState(0),[x,T]=useState(0),[D,I]=useState(null),[k,L]=useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:n,ghostX:s,setGhostX:p,ghostWidth:m,setGhostWidth:l,connectionLine:u,setConnectionLine:c,hoveredTaskId:d,setHoveredTaskId:i,activeZone:w,setActiveZone:g,draggedSegmentIndex:b,setDraggedSegmentIndex:h,draggedSegmentStartX:v,setDraggedSegmentStartX:f,segmentDragOffsetX:x,setSegmentDragOffsetX:T,hoveredSegmentIndex:D,setHoveredSegmentIndex:I,isHovered:k,setIsHovered:L,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(J,K)=>{r("none"),c(null),i(null),p(J),l(K),T(0),h(null),f(0);}}}function hn({task:e,x:t,y:a,width:r,theme:o,dayWidth:n,startDate:s,templates:p,onClick:m,onDoubleClick:l,onContextMenu:u,onDateChange:c,onDependencyCreate:d,allTaskPositions:i=[],onDragMove:w,onHoverChange:g}){let b=Zd(t,r),h=useRef(null),{dragMode:v,setDragMode:f,dragOffset:x,setDragOffset:T,ghostX:D,setGhostX:I,ghostWidth:k,setGhostWidth:L,connectionLine:N,setConnectionLine:C,hoveredTaskId:G,setHoveredTaskId:F,activeZone:J,setActiveZone:K,draggedSegmentIndex:de,setDraggedSegmentIndex:ge,draggedSegmentStartX:Te,setDraggedSegmentStartX:Ce,segmentDragOffsetX:z,setSegmentDragOffsetX:B,hoveredSegmentIndex:$,setHoveredSegmentIndex:P,isHovered:Q,setIsHovered:ee,isDragging:H,isResizing:De,isConnecting:Ee,resetDragState:Be}=b,xe=32,U=8,ae=e.endDate&&e.endDate<new Date&&e.progress<100,Me=e.isCriticalPath,_e=o.name==="neutral"||o.today==="#1C1917",qe=e.status==="completed"||e.progress===100,Ke={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},re=e.isCriticalPath||ae?"#DC2626":e.color?e.color:e.priority&&Ke[e.priority]?Ke[e.priority]:o.taskBarPrimary,fe=(he=>he>=80?20:he>=60?15:he>=50?12:10)(r),Ae=r<50,ot=r<40;useEffect(()=>{if(g)if(Q&&!H&&!e.segments){let he=a<100;g({task:e,x:t,y:a,width:r,height:xe,showBelow:he});}else g(null);},[Q,H,e,t,a,r,xe,g]);let kt=he=>he.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Le=()=>{let he=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${he} day${he!==1?"s":""}`},ke=he=>Math.round(he/n)*n,Ie=he=>{let Ge=Math.round(he/n),Fe=new Date(s);return Fe.setDate(Fe.getDate()+Ge),Fe},Zt=(he,Ge)=>{for(let Fe of i){if(Fe.id===e.id)continue;let tt=5;if(he>=Fe.x-tt&&he<=Fe.x+Fe.width+tt&&Ge>=Fe.y-tt&&Ge<=Fe.y+Fe.height+tt)return Fe.id}return null},vt=useCallback((he,Ge,Fe)=>{he.preventDefault(),he.stopPropagation();let tt=h.current?.ownerSVGElement;if(!tt)return;let Xe=tt.createSVGPoint();Xe.x=he.clientX,Xe.y=he.clientY;let wt=Xe.matrixTransform(tt.getScreenCTM()?.inverse()),st=Fe!==void 0?Fe:t,Qe=Ge;if(!Qe){let A=wt.x-st;he.shiftKey?(Qe="connect",C({x:t+r,y:a+xe/2})):he.ctrlKey||he.metaKey?Qe="move":he.altKey?Qe=A<r/2?"resize-start":"resize-end":ot?A<r/2?Qe="move":Qe="resize-end":Ae?A<=fe/2?Qe="resize-start":A>=r-fe/2?Qe="resize-end":Qe="move":A<=fe?Qe="resize-start":A>=r-fe?Qe="resize-end":Qe="move";}f(Qe),ee(false),K(null),Qe==="move"?T(wt.x-st):Qe==="connect"?C({x:t+r,y:a+xe/2}):T(0),I(st),L(r);},[t,r,a,xe]),sa=useCallback(he=>{if(v==="none")return;let Ge=h.current?.ownerSVGElement;if(!Ge)return;let Fe=Ge.createSVGPoint();Fe.x=he.clientX,Fe.y=he.clientY;let tt=Fe.matrixTransform(Ge.getScreenCTM()?.inverse());if(v==="connect"){C({x:tt.x,y:tt.y});let Xe=Zt(tt.x,tt.y);F(Xe);}else if(v==="move"){let Xe=tt.x-x,wt=ke(Xe);I(wt),L(r);let st=Math.round((wt-t)/n);if(w?.(e.id,st,true),e.segments&&e.segments.length>0&&de!==null){let Qe=wt-Te;B(Qe);}}else if(v==="resize-start"){let Xe=tt.x,wt=ke(Xe),st=t+r-wt;st>=n&&(I(wt),L(st));}else if(v==="resize-end"){let Xe=tt.x,st=ke(Xe)-t;st>=n&&L(st);}},[v,t,r,n,x,e,ke,de,Te,Zt,F,C,I,L,B,w]),Na=useCallback(()=>{if(v!=="none"){if(v==="connect")G&&d&&d(e,G),C(null),F(null);else {let he=e.endDate.getTime()-e.startDate.getTime(),Ge,Fe,tt=true;if(v==="move"){if(Ge=Ie(D),Fe=new Date(Ge.getTime()+he),e.segments&&e.segments.length>0&&de!==null){let Xe=Math.round(z/n),wt=e.segments.map((ue,_)=>{if(_===de){let Z=new Date(ue.startDate),ve=new Date(ue.endDate);return Z.setDate(Z.getDate()+Xe),ve.setDate(ve.getDate()+Xe),{startDate:Z,endDate:ve}}return ue}),st=wt.flatMap(ue=>[ue.startDate,ue.endDate]),Qe=new Date(Math.min(...st.map(ue=>ue.getTime()))),A=new Date(Math.max(...st.map(ue=>ue.getTime())));c?.({...e,segments:wt},Qe,A),Be(t,r);return}}else v==="resize-start"?(Ge=Ie(D),Fe=e.endDate,Ge>Fe&&(console.warn("Invalid date range: start date must be before or equal to end date"),tt=false)):v==="resize-end"?(Ge=e.startDate,Fe=Ie(D+k),Fe<Ge&&(console.warn("Invalid date range: end date must be after or equal to start date"),tt=false)):tt=false;tt&&Ge&&Fe&&(Fe.getTime()<Ge.getTime()?console.warn("Invalid date range: end date cannot be before start date"):c?.(e,Ge,Fe));}w?.(e.id,0,false),Be(t,r);}},[v,D,k,e,c,G,d,t,r,n,Ie,z,de,Be,w]);useEffect(()=>{if(v==="none")return;let he=Fe=>{sa(Fe);},Ge=()=>{Na();};return window.addEventListener("mousemove",he),window.addEventListener("mouseup",Ge),()=>{window.removeEventListener("mousemove",he),window.removeEventListener("mouseup",Ge);}},[v,sa,Na]);let Oe=H&&!Ee?D:t,Ue=H&&!Ee?k:r,qt=p.taskClass(e);return jsxs("g",{ref:h,onMouseEnter:()=>!H&&ee(true),onMouseLeave:()=>{H||(ee(false),K(null));},onClick:()=>!H&&m?.(e),onDoubleClick:he=>{H||(he.stopPropagation(),l?.(e));},onContextMenu:he=>{he.preventDefault(),u?.(e,he);},children:[Q&&!H&&!Ae&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:fe,height:xe,fill:J==="resize-start"?o.accent:"transparent",opacity:J==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>K("resize-start"),onMouseDown:he=>vt(he,"resize-start")}),jsx("rect",{x:t+fe,y:a,width:r-fe*2,height:xe,fill:J==="move"?o.accent:"transparent",opacity:J==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>K("move"),onMouseDown:he=>vt(he,"move")}),jsx("rect",{x:t+r-fe,y:a,width:fe,height:xe,fill:J==="resize-end"?o.accent:"transparent",opacity:J==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>K("resize-end"),onMouseDown:he=>vt(he,"resize-end")})]}),Q&&!H&&ot&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:r/2,height:xe,fill:J==="move"?o.accent:"transparent",opacity:J==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>K("move"),onMouseDown:he=>vt(he,"move")}),jsx("rect",{x:t+r/2,y:a,width:r/2,height:xe,fill:J==="resize-end"?o.accent:"transparent",opacity:J==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>K("resize-end"),onMouseDown:he=>vt(he,"resize-end")}),Q&&jsx(motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+xe-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),H&&!Ee&&!e.segments&&jsx(motion.rect,{x:D,y:a,width:k,height:xe,rx:U,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:xe,rx:U,fill:re,"data-task-class":qt,initial:{opacity:0,scale:.95},animate:{opacity:H&&!Ee?.15:e.parentId?.6:Q?.9:.8,scale:Q&&!H?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:he=>vt(he),style:{cursor:H?Ee?"crosshair":De?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsx("rect",{x:Oe,y:a,width:Ue*(e.progress/100),height:xe,rx:U,fill:re,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((he,Ge)=>{let Fe=(he.startDate.getTime()-s.getTime())/864e5*n,Xe=(he.endDate.getTime()-s.getTime())/(1e3*60*60*24)*n-Fe+n,wt=H&&v==="move"&&de===Ge,st=$===Ge,Qe=wt?Fe+z:Fe;return jsxs("g",{onMouseEnter:()=>!H&&P(Ge),onMouseLeave:()=>!H&&P(null),children:[jsx(motion.rect,{x:Qe,y:a,width:Xe,height:xe,rx:U,fill:re,initial:{opacity:0,scale:.95},animate:{opacity:wt||e.parentId?.6:st?.9:.8,scale:st&&!H?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:A=>{A.stopPropagation(),ge(Ge),Ce(Fe),vt(A,void 0,Fe);},style:{cursor:H?Ee?"crosshair":De?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsx("rect",{x:Qe,y:a,width:Xe*(e.progress/100),height:xe,rx:U,fill:re,opacity:1,style:{pointerEvents:"none"}})]},`segment-${Ge}`)}),_e&&(ae||Me)&&!e.segments&&jsxs(Fragment,{children:[Me&&!ae&&jsx("rect",{x:Oe,y:a,width:Ue,height:xe,rx:U,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),ae&&jsx("rect",{x:Oe,y:a,width:Ue,height:xe,rx:U,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),Ue>60&&!e.segments&&(()=>{let he=p.taskLabel(e),Ge=typeof he=="string"?he:e.name,Fe=Ge.length>Math.floor(Ue/8)?`${Ge.substring(0,Math.floor(Ue/8))}...`:Ge;return jsx("text",{x:Oe+12,y:a+xe/2,dominantBaseline:"middle",fill:qe?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:qe?"line-through":"none"},children:Fe})})(),Ue>100&&e.progress>0&&e.progress<100&&!H&&!e.segments&&jsxs("text",{x:Oe+Ue-12,y:a+xe/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||De)&&!Ee&&!e.segments&&jsxs(Fragment,{children:[jsxs("g",{style:{pointerEvents:"all"},children:[jsx("rect",{x:Ae?Oe-15:Oe-10,y:a-5,width:Ae?25:20,height:xe+10,fill:"transparent",onMouseDown:he=>vt(he,"resize-start"),style:{cursor:"ew-resize"}}),jsx(motion.rect,{x:Ae?Oe-8:Oe-3,y:a+6,width:Ae?8:6,height:Ae?xe-12:xe-16,rx:3,fill:v==="resize-start"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:v==="resize-start"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]}),jsxs("g",{style:{pointerEvents:"all"},children:[jsx("rect",{x:Oe+Ue-10,y:a-5,width:Ae?25:20,height:xe+10,fill:"transparent",onMouseDown:he=>vt(he,"resize-end"),style:{cursor:"ew-resize"}}),jsx(motion.rect,{x:Ae?Oe+Ue:Oe+Ue-3,y:a+6,width:Ae?8:6,height:Ae?xe-12:xe-16,rx:3,fill:v==="resize-end"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:v==="resize-end"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]})]}),jsx(AnimatePresence,{children:Q&&!H&&!e.segments&&jsxs(motion.g,{style:{pointerEvents:"all"},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsx(motion.circle,{cx:t+r+8,cy:a+xe/2,r:6,fill:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},exit:{scale:0},transition:{duration:.2,type:"spring",stiffness:400,damping:25},onMouseDown:he=>{he.stopPropagation(),vt(he,"connect");},style:{cursor:"crosshair"}}),jsx("text",{x:t+r+20,y:a+xe/2,dominantBaseline:"middle",fill:o.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),Ee&&N&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:t+r,y1:a+xe/2,x2:N.x,y2:N.y,stroke:G?o.statusCompleted:o.accent,strokeWidth:G?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:G?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:N.x,cy:N.y,r:G?8:6,fill:G?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),G&&jsx(motion.text,{x:N.x+15,y:N.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:N.x+10},animate:{opacity:1,x:N.x+15},transition:{duration:.2},children:"Connect"})]}),(Q||H)&&!Ee&&!e.segments&&jsx(motion.rect,{x:Oe-2,y:a-2,width:Ue+4,height:xe+4,rx:U+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"}}),De&&jsxs(Fragment,{children:[jsx("line",{x1:D,y1:0,x2:D,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsx("line",{x1:D+k,y1:0,x2:D+k,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:Q&&!H&&!e.segments&&!g&&(()=>{let Fe=a<100,tt=Fe?a+xe+13:a-82-13,Xe=Fe?`M ${Oe+Ue/2-6} ${a+xe+3} L ${Oe+Ue/2} ${a+xe+13} L ${Oe+Ue/2+6} ${a+xe+3}`:`M ${Oe+Ue/2-6} ${a-13} L ${Oe+Ue/2} ${a-3} L ${Oe+Ue/2+6} ${a-13}`,wt=tt+22,st=tt+40,Qe=tt+55,A=tt+70,ue=Fe?tt+82-5:a-18;return jsxs(motion.g,{initial:{opacity:0,y:Fe?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:Fe?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:Xe,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsx("rect",{x:Oe+Ue/2-120,y:tt,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:wt,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:st,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:Oe+Ue/2-70,y:st,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:kt(e.startDate)}),jsx("text",{x:Oe+Ue/2-110,y:Qe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:Oe+Ue/2-70,y:Qe,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:kt(e.endDate)}),jsx("text",{x:Oe+Ue/2+10,y:st,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:Oe+Ue/2+65,y:st,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Le()}),jsx("text",{x:Oe+Ue/2+10,y:Qe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:Oe+Ue/2+65,y:Qe,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:A,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:Oe+Ue/2-50,y:A,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(_=>_.name).join(", ").substring(0,30),e.assignees.map(_=>_.name).join(", ").length>30?"...":""]})]}),!Fe&&jsx("text",{x:Oe+Ue/2,y:ue,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:ot?"Left: move \u2022 Right: resize":Ae?"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 tc({tooltipData:e,theme:t}){if(!e)return null;let {task:a,x:r,y:o,width:n,height:s,showBelow:p}=e,m=82,l=13,u=p?o+s+l:o-m-l,c=p?`M ${r+n/2-6} ${o+s+3} L ${r+n/2} ${o+s+13} L ${r+n/2+6} ${o+s+3}`:`M ${r+n/2-6} ${o-13} L ${r+n/2} ${o-3} L ${r+n/2+6} ${o-13}`,d=u+22,i=u+40,w=u+55,g=u+70,b=x=>x.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),h=()=>{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:c,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsx("rect",{x:r+n/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+n/2,y:d,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+n/2-110,y:i,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:r+n/2-70,y:i,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.startDate?b(a.startDate):"N/A"}),jsx("text",{x:r+n/2-110,y:w,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:r+n/2-70,y:w,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?b(a.endDate):"N/A"}),jsx("text",{x:r+n/2+10,y:i,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:r+n/2+65,y:i,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:h()}),jsx("text",{x:r+n/2+10,y:w,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:r+n/2+65,y:w,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+n/2-110,y:g,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:r+n/2-50,y:g,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 vn({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:n,onHoverChange:s}){let[p,m]=useState(false),l=a-e,u=r-t,c=e+l/2,d=`M ${e} ${t} C ${c} ${t}, ${c} ${r}, ${a} ${r}`,i=6,w=Math.atan2(u,l),g=a-i*Math.cos(w-Math.PI/6),b=r-i*Math.sin(w-Math.PI/6),h=a-i*Math.cos(w+Math.PI/6),v=r-i*Math.sin(w+Math.PI/6),f=o.dependency;useEffect(()=>{s&&n&&s(p?{x1:e,y1:t,x2:a,y2:r,onDelete:n}:null);},[p,e,t,a,r,n,s]);let x=!n&&!s;return jsxs("g",{onMouseEnter:()=>!x&&m(true),onMouseLeave:()=>!x&&m(false),style:{pointerEvents:x?"none":"auto"},children:[!x&&jsx("path",{d,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsx(motion.path,{d,fill:"none",stroke:f,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:p&&s?0:p?1:.8,strokeWidth:p?2.5:2},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2},strokeWidth:{duration:.2}}}),jsx(motion.path,{d:`M ${a} ${r} L ${g} ${b} M ${a} ${r} L ${h} ${v}`,fill:"none",stroke:f,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:p&&s?0:p?1:.8,scale:p?1.1:1,strokeWidth:p?2.5:2},transition:{duration:.2}}),jsx(motion.circle,{cx:a,cy:r,r:3,fill:f,initial:{scale:0},animate:{scale:p&&s?0:p?1.3:1,opacity:p&&s?0:p?1:.8},transition:{scale:{delay:.3,duration:.15},opacity:{duration:.2}}}),p&&n&&!s&&jsxs(motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:T=>{T.stopPropagation(),n();},style:{cursor:"pointer"},children:[jsx("circle",{cx:c,cy:(t+r)/2,r:10,fill:o.bgSecondary,stroke:o.error||"#ef4444",strokeWidth:2}),jsx("line",{x1:c-4,y1:(t+r)/2-4,x2:c+4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsx("line",{x1:c+4,y1:(t+r)/2-4,x2:c-4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})}function kn({task:e,x:t,y:a,theme:r,onClick:o}){let[n,s]=useState(false),p=16,m=l=>l.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxs("g",{onMouseEnter:()=>s(true),onMouseLeave:()=>s(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:n?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:n?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),n&&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:n&&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 pe={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=l=>{l.forEach(u=>{u.dependencies&&r.set(u.id,u.dependencies),u.subtasks&&o(u.subtasks);});};o(e);let n=r.get(a)||[];r.set(a,[...n,t]);let s=new Set,p=new Set,m=l=>{if(!s.has(l)){s.add(l),p.add(l);let u=r.get(l)||[];for(let c of u){if(!s.has(c)&&m(c))return true;if(p.has(c))return true}}return p.delete(l),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=pe.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=pe.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let n=pe.findTaskById(e,o);if(n)a.unshift(n),o=n.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=pe.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let n=[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(n.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=
|
|
111
|
+
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function zs({templates:e,onSelectTemplate:t,className:a}){let[r,o]=useState(false),n=useRef(null),s=useRef(null);useEffect(()=>{function i(u){n.current&&!n.current.contains(u.target)&&s.current&&!s.current.contains(u.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let c=i=>{t(i),o(false);},p=e.reduce((i,u)=>{let d=u.category||"Other";return i[d]||(i[d]=[]),i[d].push(u),i},{});return jsxs("div",{className:y("relative inline-block",a),children:[jsxs("button",{ref:s,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:y("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:n,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(p).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:()=>c(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:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:l=>{l.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 Us({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:n}){let[s,c]=useState("export"),[p,i]=useState("json"),[u,d]=useState(null),l=useRef(null);if(!t)return null;let h=async()=>{let m=o?.current||void 0,v=await yl(e,p,m);vl(v,p);},b=async m=>{let v=m.target.files?.[0];if(v){try{let w=await wl(v),g=v.name.endsWith(".json")?"json":"csv",f=kl(w,g);d(f),f.success&&r&&r(f,w);}catch(w){d({success:false,errors:[`Failed to read file: ${w instanceof Error?w.message:"Unknown error"}`]});}l.current&&(l.current.value="");}};return jsxs("div",{className:y("fixed inset-0 z-[9999] flex items-center justify-center",n),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:()=>c("export"),className:y("flex-1 px-6 py-4 font-semibold transition-colors",s==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsx("button",{onClick:()=>c("import"),className:y("flex-1 px-6 py-4 font-semibold transition-colors",s==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxs("div",{className:"p-6",children:[s==="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(m=>jsxs("button",{onClick:()=>i(m),className:y("p-4 rounded-lg border-2 transition-all text-center",p===m?"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:[m==="json"&&"\u{1F4C4}",m==="csv"&&"\u{1F4CA}",m==="pdf"&&"\u{1F4DD}"]}),jsx("div",{className:"font-semibold uppercase text-xs",children:m})]},m))})]}),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"})]}),s==="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:l,type:"file",accept:".json,.csv",onChange:b,className:"hidden"}),jsxs("button",{onClick:()=>l.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:y("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:y("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((m,v)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",m]},v))})]})]})]})]})]})}var Sg=["URGENT","HIGH","MEDIUM","LOW"],Eg=[{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"}],Pg=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Ws({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:n,onFilterOverdue:s,onFilterHighPriority:c,availableUsers:p=[],availableLabels:i=[],availableColumns:u=[],showQuickFilters:d=true,compact:l=false,groupBy:h="none",onGroupByChange:b}){let[m,v]=useState(true),w=useCallback(D=>{a({search:D.target.value});},[a]),g=useCallback(D=>{a({dateFilter:D.target.value});},[a]),f=useCallback(D=>{r({by:D.target.value});},[r]),x=useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),N=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxs("div",{className:`filter-bar ${l?"filter-bar--compact":""} ${m?"filter-bar--collapsed":""}`,children:[jsxs("div",{className:"filter-bar__header",onClick:()=>v(!m),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:m?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:D=>{D.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:D=>{D.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:m?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsx("polyline",{points:"6 9 12 15 18 9"})}),jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),N&&jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!m&&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:"}),n&&jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),s&&jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),c&&jsx("button",{onClick:c,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxs("div",{className:"filter-bar__main",children:[jsx("div",{className:"filter-bar__field",children:jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:w,className:"filter-bar__search"})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.dateFilter,onChange:g,className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Dates"}),jsx("option",{value:"overdue",children:"Overdue"}),jsx("option",{value:"today",children:"Today"}),jsx("option",{value:"this-week",children:"This Week"})]})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.priorities[0]||"all",onChange:D=>{let I=D.target.value;a({priorities:I==="all"?[]:[I]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Priorities"}),Sg.map(D=>jsx("option",{value:D,children:D},D))]})}),p.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.assignees[0]||"all",onChange:D=>{let I=D.target.value;a({assignees:I==="all"?[]:[I]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Assignees"}),p.map(D=>jsx("option",{value:D.id,children:D.name},D.id))]})}),i.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.labels[0]||"all",onChange:D=>{let I=D.target.value;a({labels:I==="all"?[]:[I]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Labels"}),i.map(D=>jsx("option",{value:D,children:D},D))]})}),jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsx("select",{value:t.by,onChange:f,className:"filter-bar__select filter-bar__select--sm",children:Eg.map(D=>jsx("option",{value:D.value,children:D.label},D.value))}),t.by!=="none"&&jsx("button",{onClick:x,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),b&&jsx("div",{className:"filter-bar__field",children:jsx("select",{value:h,onChange:D=>b(D.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Pg.map(D=>jsx("option",{value:D.value,children:D.label},D.value))})}),N&&jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Hs({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:n,onExportGanttExcel:s,onExportGanttPNG:c,onExportGanttCSV:p}){let[i,u]=useState(false),d=useRef(null);useEffect(()=>{let h=b=>{d.current&&!d.current.contains(b.target)&&u(false);};return i&&document.addEventListener("mousedown",h),()=>{document.removeEventListener("mousedown",h);}},[i]);let l=h=>{h(),u(false);};return jsxs("div",{className:y("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:()=>l(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:()=>l(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:"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:()=>l(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:"12",y1:"18",x2:"12",y2:"12"}),jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxs("button",{onClick:()=>l(async()=>await c?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter: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:()=>l(()=>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("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:()=>l(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:()=>l(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 Gs={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"}},_s={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"}},Vs={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"}},Or={dark:Gs,light:_s,neutral:Vs},pn="dark";var mn=createContext(void 0),$g="asakaa-theme";function Pd({children:e,defaultTheme:t=pn,storageKey:a=$g}){let[r,o]=useState(()=>{if(typeof window<"u"){let c=localStorage.getItem(a);if(c&&(c==="dark"||c==="light"||c==="neutral"))return c}return t}),n=useCallback(c=>{o(c),typeof window<"u"&&localStorage.setItem(a,c);},[a]);useEffect(()=>{if(typeof window>"u")return;let c=document.documentElement,p=Or[r];Object.entries(p.colors).forEach(([u,d])=>{d&&c.style.setProperty(`--theme-${Ug(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 l=p.colors[u];l&&c.style.setProperty(d,l);}),c.setAttribute("data-theme",r),c.classList.remove("theme-dark","theme-light","theme-neutral"),c.classList.add(`theme-${r}`);},[r]);let s={theme:r,setTheme:n,themes:Or};return jsx(mn.Provider,{value:s,children:e})}function no(){let e=useContext(mn);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Ug(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function js({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=no();return e?jsxs("div",{className:y("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(Or).map(([n,s])=>jsxs("button",{onClick:()=>{o(n),t();},className:y("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===n?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===n?"var(--theme-accent-primary)20":"transparent"},children:[jsx("div",{className:"text-3xl",children:s.emoji}),jsxs("div",{className:"text-left flex-1",children:[jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:s.displayName}),jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[n==="dark"&&"Default dark theme with Linear-inspired colors",n==="light"&&"Clean light theme with high contrast",n==="neutral"&&"Monochrome zen theme"]})]}),r===n&&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"})})]},n))})]})]}):null}function Md(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return Ve[e]||Ve.dark;let t=document.documentElement,a=getComputedStyle(t),r=(n,s)=>a.getPropertyValue(n).trim()||s;return {bgPrimary:r("--theme-bg-primary",Ve[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",Ve[e].bgSecondary),bgGrid:r("--theme-bg-card",Ve[e].bgGrid),bgWeekend:r("--theme-bg-hover",Ve[e].bgWeekend),border:r("--theme-border-primary",Ve[e].border),borderLight:r("--theme-border-subtle",Ve[e].borderLight),textPrimary:r("--theme-text-primary",Ve[e].textPrimary),textSecondary:r("--theme-text-secondary",Ve[e].textSecondary),textTertiary:r("--theme-text-tertiary",Ve[e].textTertiary),accent:r("--theme-accent-primary",Ve[e].accent),accentHover:r("--theme-accent-hover",Ve[e].accentHover),accentLight:r("--theme-accent-primary",Ve[e].accentLight),taskBarPrimary:r("--theme-accent-primary",Ve[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",Ve[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",Ve[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",Ve[e].dependency),dependencyHover:r("--theme-border-secondary",Ve[e].dependencyHover),criticalPath:r("--theme-error",Ve[e].criticalPath),criticalPathLight:r("--theme-error",Ve[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",Ve[e].today):e==="neutral"?r("--theme-text-primary",Ve[e].today):r("--theme-error",Ve[e].today),todayLight:e==="light"?r("--theme-accent-primary",Ve[e].todayLight):e==="neutral"?r("--theme-text-primary",Ve[e].todayLight):r("--theme-error",Ve[e].todayLight),milestone:r("--theme-warning",Ve[e].milestone),milestoneLight:r("--theme-warning",Ve[e].milestoneLight),statusTodo:r("--theme-text-tertiary",Ve[e].statusTodo),statusInProgress:r("--theme-accent-primary",Ve[e].statusInProgress),statusCompleted:r("--theme-success",Ve[e].statusCompleted),hoverBg:r("--theme-bg-hover",Ve[e].hoverBg),focusRing:r("--theme-accent-primary",Ve[e].focusRing)}}var un={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"},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"}},Ad={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"},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"}},Ks={en:un,es:Ad};function Fd(e){return Ks[e]||Ks.en}function Ys(e,t){let a=Fd(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 io=createContext(un);function So(){return useContext(io)}function rf({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:n,onExportMSProject:s}){let[c,p]=useState(false),[i,u]=useState(null),d=useRef(null),l=So();if(useEffect(()=>{let v=w=>{d.current&&!d.current.contains(w.target)&&p(false);};return c&&document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[c]),!(t||a||r||o||n||s))return null;let b=[{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:n},{id:"msproject",label:"MS Project",description:"XML",icon:jsx(FolderKanban,{className:"w-4 h-4"}),handler:s}].filter(v=>v.handler),m=async(v,w)=>{if(w){u(v);try{await w();}catch(g){console.error(`Export ${v} failed:`,g);}finally{u(null),p(false);}}};return jsxs("div",{ref:d,className:"relative",children:[jsxs(motion.button,{onClick:()=>p(!c),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:c?e.accent:e.bgSecondary,border:`1px solid ${c?e.accent:e.borderLight}`,color:c?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:l.toolbar.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:c?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:c&&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:b.map((v,w)=>jsxs(motion.button,{onClick:()=>m(v.id,v.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:w<b.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:w*.03},children:[jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===v.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-4 h-4"})}):v.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:v.label}),jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:v.description})]})]},v.id))})})})]})}function of({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(n=>{let s=t===n.value;return jsxs(motion.button,{onClick:()=>a(n.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:s?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500,zIndex:s?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[s&&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}}),n.icon&&jsx("span",{className:"relative z-10",style:{color:s?"#FFFFFF":r.textTertiary},children:n.icon}),jsx("span",{className:"relative z-10",style:{color:s?"#FFFFFF":r.textTertiary},children:n.label})]},n.value)})})}function nf({options:e,value:t,onChange:a,theme:r}){return jsx("div",{className:"inline-flex items-center gap-1",children:e.map(o=>{let n=t===o.value;return jsxs(motion.button,{onClick:()=>a(o.value),className:"relative px-3 py-1.5 text-xs transition-all",style:{color:n?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:n?600:500},whileHover:{color:n?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsx("span",{children:o.label}),n&&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 sf({theme:e,value:t,onChange:a}){let[r,o]=useState(false),n=useRef(null),s=So();useEffect(()=>{let i=u=>{n.current&&!n.current.contains(u.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let c=[{value:"compact",label:s.toolbar.compact||"Compact"},{value:"comfortable",label:s.toolbar.normal||"Normal"},{value:"spacious",label:s.toolbar.spacious||"Spacious"}],p=c.find(i=>i.value===t)?.label||"Normal";return jsxs("div",{ref:n,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:`${s.toolbar.density||"Density"}: ${p}`,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:c.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<c.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 gn({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:n,onThemeChange:s,rowDensity:c,onRowDensityChange:p,showThemeSelector:i=false,showCreateTaskButton:u=false,createTaskLabel:d,onCreateTask:l,onExportPNG:h,onExportPDF:b,onExportExcel:m,onExportCSV:v,onExportJSON:w,onExportMSProject:g}){let f=So(),x=h||b||m||v||w||g,N=[{value:"day",label:f.toolbar.day},{value:"week",label:f.toolbar.week},{value:"month",label:f.toolbar.month}],D=[{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(nf,{options:N,value:t,onChange:I=>a(I),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(sf,{theme:e,value:c,onChange:p})]}),jsxs("div",{className:"flex items-center gap-3",children:[u&&l&&jsxs(Fragment,{children:[jsxs(motion.button,{onClick:l,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||f.toolbar.createTask})]}),(x||i)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),x&&jsxs(Fragment,{children:[jsx(rf,{theme:e,onExportPNG:h,onExportPDF:b,onExportExcel:m,onExportCSV:v,onExportJSON:w,onExportMSProject:g}),i&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsx(of,{options:D,value:n,onChange:I=>s(I),theme:e})]})]})}function fn({columns:e,onToggleColumn:t,theme:a}){let[r,o]=useState(false),[n,s]=useState({x:0,y:0}),c=useRef(null),p=useRef(null);useEffect(()=>{if(!r)return;let u=d=>{c.current&&!c.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:p,onClick:()=>{if(!r&&p.current){let u=p.current.getBoundingClientRect();s({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(ot,{children:jsx(motion.div,{ref:c,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${n.x}px`,top:`${n.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 lo({isOpen:e,x:t,y:a,items:r,onClose:o,theme:n}){let s=useRef(null),[c,p]=useState({x:t,y:a});if(useEffect(()=>{if(!e)return;let u=200,d=r.length*36+8,l=8,h=window.innerWidth,b=window.innerHeight,m=t,v=a;t+u+l>h&&(m=t-u,m<l&&(m=l)),a+d+l>b&&(v=b-d-l,v<l&&(v=l)),p({x:m,y:v});},[e,t,a,r.length]),useEffect(()=>{if(!e)return;let u=l=>{s.current&&!s.current.contains(l.target)&&o();},d=l=>{l.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:n.bgPrimary?.includes("1")||n.bgPrimary?.includes("2")||n.textPrimary?.toLowerCase().includes("fff")||n.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsx(AnimatePresence,{children:jsx(motion.div,{ref:s,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${c.x}px`,top:`${c.y}px`,backgroundColor:i(n.bgSecondary),border:`1px solid ${n.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:n.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?n.textTertiary:n.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=n.hoverBg);},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[u.icon&&jsx("span",{style:{color:n.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:n.textTertiary}})]})]},u.id))})})})}var St={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 Vd({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:n,onTaskMove:s,onTaskIndent:c,onTaskOutdent:p,onTaskRename:i,onTaskToggleExpand:u,onOpenTaskModal:d,enableKeyboard:l=true}){let h=useRef(false),b=useCallback(f=>{h.current=f;},[]),m=useCallback(f=>{let x=[],N=D=>{for(let I of D)x.push(I),I.subtasks&&I.subtasks.length>0&&I.isExpanded&&N(I.subtasks);};return N(f),x},[]),v=useCallback(()=>{let f=m(e);for(let x of f)if(t.has(x.id))return x;return null},[e,t,m]),w=useCallback((f,x)=>{let N=m(e);if(N.length===0)return;let D=v();if(!D){a(N[0].id,false);return}let I=N.findIndex(S=>S.id===D.id);if(I===-1)return;let k=f==="up"?I-1:I+1;if(k<0||k>=N.length)return;let $=N[k];a($.id,x);},[e,v,m,a]),g=useCallback(f=>{if(!l)return;let x=f.target;if(x.tagName==="INPUT"||x.tagName==="TEXTAREA"||x.isContentEditable||h.current){f.key==="Escape"&&(x.blur(),h.current=false);return}let I=navigator.platform.toUpperCase().indexOf("MAC")>=0?f.metaKey:f.ctrlKey,k=Array.from(t),$=v();if(f.key==="ArrowUp"){f.preventDefault(),w("up",f.shiftKey);return}if(f.key==="ArrowDown"){f.preventDefault(),w("down",f.shiftKey);return}if($&&(f.key==="ArrowRight"||f.key==="ArrowLeft")){$.subtasks&&$.subtasks.length>0&&(f.preventDefault(),(f.key==="ArrowRight"&&!$.isExpanded||f.key==="ArrowLeft"&&$.isExpanded)&&u($.id));return}if(f.altKey&&(f.key==="ArrowUp"||f.key==="ArrowDown")){k.length>0&&(f.preventDefault(),s(k,f.key==="ArrowUp"?"up":"down"));return}if(f.key==="Tab"&&!f.shiftKey){k.length>0&&(f.preventDefault(),c(k));return}if(f.key==="Tab"&&f.shiftKey){k.length>0&&(f.preventDefault(),p(k));return}if(f.key==="Enter"&&!f.shiftKey&&!I){$&&(f.preventDefault(),r($.id,"below"));return}if(f.key==="Enter"&&f.shiftKey&&!I){$&&(f.preventDefault(),r($.id,"above"));return}if(f.key==="Enter"&&I){$&&(f.preventDefault(),d($.id));return}if(f.key==="F2"){$&&(f.preventDefault(),i($.id));return}if(f.key==="Delete"||f.key==="Backspace"&&I){k.length>0&&(f.preventDefault(),o(k));return}if(f.key==="d"&&I&&!f.shiftKey){k.length>0&&(f.preventDefault(),n(k));return}},[l,t,v,w,r,o,n,s,c,p,i,u,d]);return useEffect(()=>{if(l)return window.addEventListener("keydown",g),()=>{window.removeEventListener("keydown",g);}},[l,g]),{setIsEditing:b}}function Kd(){let[e,t]=useState(new Set),[a,r]=useState(null),o=useCallback(d=>{t(new Set([d])),r(d);},[]),n=useCallback(d=>{t(l=>{let h=new Set(l);return h.has(d)?h.delete(d):h.add(d),h}),r(d);},[]),s=useCallback((d,l)=>{if(!a){o(d);return}let h=l.indexOf(a),b=l.indexOf(d);if(h===-1||b===-1){o(d);return}let m=Math.min(h,b),v=Math.max(h,b),w=l.slice(m,v+1);t(new Set(w)),r(d);},[a,o]),c=useCallback((d,l,h,b)=>{b?s(d,l):h?n(d):o(d);},[o,n,s]),p=useCallback((d,l)=>{l?t(h=>{let b=new Set(h);return b.add(d),b}):o(d);},[o]),i=useCallback(()=>{t(new Set),r(null);},[]),u=useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:n,selectTaskRange:s,handleTaskClick:c,handleKeyboardSelection:p,clearSelection:i,isTaskSelected:u}}function co(e){let t=[],a=(r,o,n=0)=>{for(let s=0;s<r.length;s++){let c={...r[s],parentId:o,level:n,position:s};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,n+1);}};return a(e),t}function Yd(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Yd(a.subtasks,t);if(r)return r}}return null}function Js(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=Js(a.subtasks,t);if(r)return r}return null}function Zs(e,t){if(t.length===0)return e;let a=co(e),r=t[0],o=a.findIndex(d=>d.id===r);if(o<=0)return e;let n=a[o-1],s=(d,l)=>{let h=[];return {tasks:d.filter(m=>{if(l.has(m.id))return h.push(m),false;if(m.subtasks){let v=s(m.subtasks,l);m.subtasks=v.tasks,h.push(...v.removed);}return true}),removed:h}},c=(d,l,h)=>d.map(b=>b.id===l?{...b,subtasks:[...b.subtasks||[],...h],isExpanded:true}:b.subtasks?{...b,subtasks:c(b.subtasks,l,h)}:b),p=new Set(t),{tasks:i,removed:u}=s(e,p);return c(i,n.id,u)}function Qs(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=Js(a,r);if(!o)continue;let n=Js(a,o.id),s=(i,u,d)=>{for(let l=0;l<i.length;l++){let h=i[l];if(h.id===u&&h.subtasks){let b=h.subtasks.findIndex(m=>m.id===d);if(b!==-1){let[m]=h.subtasks.splice(b,1);return m}}if(h.subtasks){let b=s(h.subtasks,u,d);if(b)return b}}return null},c=(i,u,d)=>{let l=i.findIndex(h=>h.id===u);if(l!==-1)return i.splice(l+1,0,d),i;for(let h of i)h.subtasks&&c(h.subtasks,u,d);return i},p=s(a,o.id,r);p&&(n&&n.subtasks?c(n.subtasks,o.id,p):c(a,o.id,p));}return a}function ei(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],n=(s,c,p)=>{let i=s.findIndex(d=>d.id===c);if(i===-1){for(let d of s)if(d.subtasks&&n(d.subtasks,c,p))return true;return false}let u=p==="up"?i-1:i+1;return u<0||u>=s.length?false:([s[i],s[u]]=[s[u],s[i]],true)};return n(r,o,a),r}function ti(e,t){let a=new Set(t),r=o=>o.filter(n=>!a.has(n.id)).map(n=>n.subtasks?{...n,subtasks:r(n.subtasks)}:n);return r(e)}function ai(e,t){let a=[...e];for(let r of t){let o=s=>{let c=s.findIndex(u=>u.id===r);if(c===-1){for(let u of s)if(u.subtasks&&o(u.subtasks))return true;return false}let p=s[c],i={...p,id:`${p.id}-copy-${Date.now()}`,name:`${p.name} (Copy)`,subtasks:p.subtasks?n(p.subtasks):void 0};return s.splice(c+1,0,i),true},n=s=>s.map(c=>({...c,id:`${c.id}-copy-${Date.now()}`,subtasks:c.subtasks?n(c.subtasks):void 0}));o(a);}return a}function qd(e,t,a){let r=[...e],o=new Date,n=new Date(o);n.setDate(n.getDate()+7);let s={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:n,color:"#6366F1"},c=p=>{let i=p.findIndex(d=>d.id===t);if(i===-1){for(let d of p)if(d.subtasks&&c(d.subtasks))return true;return false}let u=a==="above"?i:i+1;return p.splice(u,0,s),true};return c(r),{tasks:r,newTask:s}}function ri(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:ri(r.subtasks,t,a)}:r)}function oi(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:oi(a.subtasks,t)}:a)}function ni(e,t){let a=u=>{for(let d of u){if(d.id===t)return d;if(d.subtasks){let l=a(d.subtasks);if(l)return l}}return null},r=a(e),o=new Date,n=new Date(o);n.setDate(n.getDate()+7);let s=r?.startDate||o,c=r?.endDate||n,p={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(s),endDate:new Date(c),color:r?.color||"#3B82F6"},i=u=>u.map(d=>{if(d.id===t){let l=d.subtasks||[];return {...d,subtasks:[...l,p],isExpanded:true}}return d.subtasks?{...d,subtasks:i(d.subtasks)}:d});return {tasks:i(e),newTask:p}}function Xd(e,t,a,r){if(t===a)return e;let o=Yd(e,t);if(!o)return e;if(a){let c=(p,i)=>{if(!p.subtasks)return false;for(let u of p.subtasks)if(u.id===i||c(u,i))return true;return false};if(c(o,a))return e}let n=c=>c.filter(p=>p.id!==t).map(p=>p.subtasks&&p.subtasks.length>0?{...p,subtasks:n(p.subtasks)}:p),s=n(e);if(a===null){let c=r!==void 0?r:s.length;s.splice(c,0,{...o,parentId:void 0});}else {let c=p=>p.map(i=>{if(i.id===a){let u=i.subtasks||[],d=r!==void 0?r:u.length,l=[...u];return l.splice(d,0,{...o,parentId:a}),{...i,subtasks:l,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:c(i.subtasks)}:i});s=c(s);}return s}function yn({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:n,onTaskDblClick:s,onTaskContextMenu:c,onTaskToggle:p,scrollTop:i,columns:u,onToggleColumn:d,onColumnResize:l,onTaskUpdate:h,onTaskIndent:b,onTaskOutdent:m,onTaskMove:v,onMultiTaskDelete:w,onTaskDuplicate:g,onTaskCreate:f,onTaskRename:x,onCreateSubtask:N,onOpenTaskModal:D,onDeleteRequest:I,onTaskReparent:k}){let $=useContext(io),[S,C]=useState(null),[H,B]=useState(null),[J,ne]=useState(""),xe=useRef(null),[Pe,Re]=useState(null),[le,z]=useState(0),[L,W]=useState(0),[E,q]=useState({isOpen:false,x:0,y:0,type:"header"}),[Z,U]=useState(null),[ke,Ne]=useState(null),[Fe,ye]=useState(null),tt=useRef(0),Ie=5,st=useRef(false),[it,dt]=useState(null),[O,F]=useState(false),[K,ae]=useState(null),[ge,Se]=useState(false),Ke=useRef(null);useEffect(()=>{function Q(oe){Ke.current&&!Ke.current.contains(oe.target)&&Se(false);}if(ge)return document.addEventListener("mousedown",Q),()=>document.removeEventListener("mousedown",Q)},[ge]),useEffect(()=>{H&&xe.current&&(xe.current.focus(),xe.current.select());},[H]),useEffect(()=>{if(!Pe)return;let Q=T=>{let ee=T.clientX-le,ie=L+ee;l?.(Pe,ie);},oe=()=>{Re(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",Q),document.addEventListener("mouseup",oe),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Q),document.removeEventListener("mouseup",oe),document.body.style.cursor="",document.body.style.userSelect="";}},[Pe,le,L,l]);let{selectedTaskIds:yt,handleTaskClick:Be,isTaskSelected:pe}=Kd(),{setIsEditing:Ee}=Vd({tasks:e,selectedTaskIds:yt,onTaskSelect:(Q,oe)=>{let ee=co(e).map(ie=>ie.id);Be(Q,ee,oe||false,false);},onTaskCreate:f||(()=>{}),onTaskDelete:w||(()=>{}),onTaskDuplicate:g||(()=>{}),onTaskMove:v||(()=>{}),onTaskIndent:b||(()=>{}),onTaskOutdent:m||(()=>{}),onTaskRename:Q=>{let oe=co(e).find(T=>T.id===Q);oe&&$e(oe);},onTaskToggleExpand:p||(()=>{}),onOpenTaskModal:Q=>{let oe=co(e).find(T=>T.id===Q);oe&&D&&D(oe);},enableKeyboard:true}),jt=(Q,oe=0)=>{let T=[];for(let ee of Q)T.push({task:ee,level:oe}),ee.subtasks&&ee.subtasks.length>0&&ee.isExpanded&&T.push(...jt(ee.subtasks,oe+1));return T},ut=jt(e),sa=48,Sa=Math.max(ut.length*a,600-sa),He=Q=>!Q.startDate||!Q.endDate?"-":`${Math.ceil((Q.endDate.getTime()-Q.startDate.getTime())/(1e3*60*60*24))}d`,$e=Q=>{B(Q.id),ne(Q.name),Ee(true);},ia=Q=>{J.trim()&&J!==e.find(oe=>oe.id===Q)?.name&&x?.(Q,J.trim()),B(null),ne(""),Ee(false);},fe=()=>{B(null),ne(""),Ee(false);},Oe=(Q,oe)=>{oe.stopPropagation(),N?.(Q.id);},Ae=(Q,oe)=>{oe.preventDefault(),tt.current=oe.clientY,U(Q),st.current=false,F(false),dt({x:oe.clientX,y:oe.clientY});},Ge=Q=>{if(!Z||(Math.abs(Q.clientY-tt.current)>Ie&&!st.current&&(st.current=true,F(true)),dt({x:Q.clientX,y:Q.clientY}),!st.current))return;let T=document.querySelectorAll("[data-task-row]"),ee=null,ie=null;T.forEach(R=>{let Y=R.getBoundingClientRect(),V=R.getAttribute("data-task-row");if(V&&V!==Z&&Q.clientY>=Y.top&&Q.clientY<=Y.bottom){ee=V;let we=Q.clientY-Y.top,Le=Y.height;we<Le*.25?ie="above":we>Le*.75?ie="below":ie="child";}}),Ne(ee),ye(ie);},_e=()=>{if(st.current&&Z&&ke&&Fe){if(Fe==="child")k?.(Z,ke);else if(Fe==="above"||Fe==="below"){let Q=(ee,ie,R=null)=>{for(let Y of ee){if(Y.id===ie)return R;if(Y.subtasks){let V=Q(Y.subtasks,ie,Y.id);if(V!==void 0)return V}}},oe=Q(e,ke,null),T=(ee,ie)=>{let R=ee.findIndex(Y=>Y.id===ie);return Fe==="below"?R+1:R};if(oe===null){let ee=T(e,ke);k?.(Z,null,ee);}else {let ee=ut.find(ie=>ie.task.id===oe)?.task;if(ee?.subtasks){let ie=T(ee.subtasks,ke);k?.(Z,oe,ie);}}}}U(null),Ne(null),ye(null),dt(null),st.current=false,F(false);};useEffect(()=>{if(Z)return document.addEventListener("mousemove",Ge),document.addEventListener("mouseup",_e),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Ge),document.removeEventListener("mouseup",_e),document.body.style.cursor="",document.body.style.userSelect="";}},[Z,ke,Fe]);let kt=(Q,oe,T)=>{switch(Q.id){case "name":let ee=H===oe.id,ie=S===oe.id;return jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${T*20}px`},children:[k&&jsx("div",{className:"cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-white/10 transition-all flex-shrink-0",style:{color:t.textTertiary,opacity:ie?1:.3},onMouseDown:re=>Ae(oe.id,re),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),oe.subtasks&&oe.subtasks.length>0?jsx("button",{onClick:re=>{re.stopPropagation(),p?.(oe.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:oe.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:oe.color||"#3B82F6",opacity:oe.parentId?.6:1,borderColor:oe.isMilestone?t.accent:"transparent",borderWidth:oe.isMilestone?"2px":"0px"},title:oe.isMilestone?"Milestone":oe.parentId?"Subtask":"Task"})}),ee?jsx("input",{ref:xe,type:"text",value:J,onChange:re=>ne(re.target.value),onKeyDown:re=>{re.key==="Enter"?ia(oe.id):re.key==="Escape"&&fe();},onBlur:()=>ia(oe.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:re=>re.stopPropagation()}):jsxs(Fragment,{children:[jsx("span",{className:"flex-1",style:{color:oe.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:oe.parentId?"13px":"14px",fontWeight:oe.isMilestone?600:oe.parentId?400:600,letterSpacing:oe.parentId?"0":"-0.01em"},title:oe.name,children:oe.name}),ie&&!ee&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:re=>re.stopPropagation(),children:[jsx("button",{onClick:re=>Oe(oe,re),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:re=>{re.stopPropagation(),$e(oe);},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 Y=Q.id==="startDate"?"startDate":"endDate",V=oe[Y],we=K?.taskId===oe.id&&K?.field===Y,Le=re=>re?(typeof re=="string"?new Date(re):re).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:re=>re.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:re=>{if(we)ae(null);else {let Ce=re.currentTarget.getBoundingClientRect();ae({taskId:oe.id,field:Y,month:V?typeof V=="string"?new Date(V):V:new Date,position:{top:Ce.bottom+4,left:Ce.left}});}},children:[jsx(Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsx("span",{children:Le(V)})]}),we&&typeof document<"u"&&createPortal(jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>ae(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:K?.position.top,left:K?.position.left},onClick:re=>re.stopPropagation(),children:[jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let re=new Date,Ce=new Date(re);Ce.setDate(re.getDate()+1);let Je=new Date(re);Je.setDate(re.getDate()+7);let At=new Date(re);return At.setDate(re.getDate()+14),[{label:"Hoy",date:re},{label:"Ma\xF1ana",date:Ce},{label:"Pr\xF3xima semana",date:Je},{label:"2 semanas",date:At}].map((dr,rr)=>jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:Dr=>Dr.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Dr=>Dr.currentTarget.style.backgroundColor="transparent",onClick:()=>{h?.(oe.id,{[Y]:dr.date}),ae(null);},children:dr.label},rr))})(),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:re=>re.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:re=>re.currentTarget.style.backgroundColor="transparent",onClick:()=>{h?.(oe.id,{[Y]:void 0}),ae(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:()=>ae(re=>re?{...re,month:new Date(re.month.getFullYear(),re.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:K?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>ae(re=>re?{...re,month:new Date(re.month.getFullYear(),re.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((re,Ce)=>jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:re},Ce))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let re=K?.month||new Date,Ce=re.getFullYear(),Je=re.getMonth(),At=new Date(Ce,Je,1).getDay(),Oa=new Date(Ce,Je+1,0).getDate(),dr=new Date,rr=[];for(let Ut=At-1;Ut>=0;Ut--)rr.push({day:new Date(Ce,Je,-Ut).getDate(),date:new Date(Ce,Je-1,new Date(Ce,Je,-Ut).getDate()),isCurrentMonth:false});for(let Ut=1;Ut<=Oa;Ut++)rr.push({day:Ut,date:new Date(Ce,Je,Ut),isCurrentMonth:true});let Dr=42-rr.length;for(let Ut=1;Ut<=Dr;Ut++)rr.push({day:Ut,date:new Date(Ce,Je+1,Ut),isCurrentMonth:false});return rr.map((Ut,fo)=>{let Kn=Ut.date.toDateString()===dr.toDateString(),ho=(V?typeof V=="string"?new Date(V):V:null)?.toDateString()===Ut.date.toDateString();return jsx("button",{type:"button",className:"w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",style:{color:Ut.isCurrentMonth?ho?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:ho?"#3B82F6":"transparent",boxShadow:Kn&&!ho?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{h?.(oe.id,{[Y]:Ut.date}),ae(null);},children:Ut.day},fo)})})()})]})]})]}),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:He(oe)})});case "assignees":let Me=r.filter(re=>oe.assignees?.some(Ce=>Ce.name===re.name||Ce.initials===re.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:re=>re.stopPropagation(),children:jsx(Fr,{assignedUsers:Me,availableUsers:r,onChange:re=>{let Ce=re.map(Je=>({id:Je.id,name:Je.name,initials:Je.initials,color:Je.color}));h?.(oe.id,{assignees:Ce.length>0?Ce:void 0});}})});case "status":return jsx("div",{className:"flex items-center justify-center w-full",onClick:re=>re.stopPropagation(),children:jsx(Wl,{status:oe.status||"todo",onChange:re=>{h?.(oe.id,{status:re,progress:re==="completed"?100:oe.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:`${oe.progress}%`,backgroundColor:oe.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:[oe.progress,"%"]})]});case "priority":let Kt={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},$t={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},Qt=Kt[oe.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:re=>re.stopPropagation(),children:jsx(Mr,{priority:Qt,onChange:re=>{re&&h?.(oe.id,{priority:$t[re]||"medium"});}})});default:return null}},rt=Q=>[{id:"hide",label:"Hide Column",icon:St.Hide,onClick:()=>d(Q),disabled:Q==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:St.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:St.SortDesc,onClick:()=>{}}],Qe=Q=>Q.subtasks&&Q.subtasks.length>0?[{id:"addSubtask",label:$?.contextMenu?.addSubtask||"Add Subtask",icon:St.Add,onClick:()=>{N?.(Q.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:$?.contextMenu?.deleteTask||"Delete Task",icon:St.Delete,onClick:()=>{I?I(Q.id,Q.name):w?.([Q.id]);}}]:[{id:"edit",label:$?.contextMenu?.editTask||"Edit Task",icon:St.Pencil,onClick:()=>{s?.(Q);}},{id:"addSubtask",label:$?.contextMenu?.addSubtask||"Add Subtask",icon:St.Add,onClick:()=>{N?.(Q.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:$?.contextMenu?.markIncomplete||"Mark Incomplete",icon:St.MarkIncomplete,onClick:()=>{h?.(Q.id,{status:"todo",progress:0});},disabled:Q.status==="todo"},{id:"setInProgress",label:$?.contextMenu?.setInProgress||"Set In Progress",icon:St.SetInProgress,onClick:()=>{h?.(Q.id,{status:"in-progress"});},disabled:Q.status==="in-progress"},{id:"markComplete",label:$?.contextMenu?.markComplete||"Mark Complete",icon:St.MarkComplete,onClick:()=>{h?.(Q.id,{status:"completed",progress:100});},disabled:Q.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:$?.contextMenu?.splitTask||"Split Task",icon:St.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:$?.contextMenu?.deleteTask||"Delete Task",icon:St.Delete,onClick:()=>{I?I(Q.id,Q.name):w?.([Q.id]);}}],ct=u.filter(Q=>Q.visible),Ht=ct.reduce((Q,oe)=>Q+oe.width,0);return jsxs("div",{className:"h-full",style:{backgroundColor:t.bgPrimary,minWidth:Ht},children:[jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${sa}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsx("div",{className:"flex items-center flex-1 min-w-0",children:ct.map((Q,oe)=>{let T=oe===ct.length-1,ee=Q.id==="name";return jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${ee?"":"justify-center"}`,style:{width:`${Q.width}px`,minWidth:`${Q.minWidth??(ee?200:60)}px`,maxWidth:`${Q.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:T?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:ie=>{ie.preventDefault(),q({isOpen:true,x:ie.clientX,y:ie.clientY,type:"header",columnId:Q.id});},onMouseEnter:ie=>{ie.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:ie=>{ie.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:Q.label,children:Q.label}),Q.resizable&&jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:Pe===Q.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:ie=>{ie.preventDefault(),ie.stopPropagation(),Re(Q.id),z(ie.clientX),W(Q.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"}})})]},Q.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(fn,{columns:u,onToggleColumn:d,theme:t}),jsx("button",{onClick:()=>Se(!ge),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"})}),ge&&jsxs("div",{ref:Ke,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:Q=>Q.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:()=>Se(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:Sa},children:ut.map(({task:Q,level:oe},T)=>{let ee=pe(Q.id),ie=ke===Q.id,R=ie&&Fe==="above",Y=ie&&Fe==="below",V=ie&&Fe==="child",we={};return V&&(we.backgroundColor=`${t.accent}15`,we.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":Q.id,className:`flex items-center cursor-pointer group ${Z===Q.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:ee?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:ee?t.accentLight:V?`${t.accent}15`:T%2===0?t.bgPrimary:t.bgGrid,...we},onMouseEnter:()=>C(Q.id),onMouseLeave:()=>C(null),onClick:Le=>{let Kt=co(e).map(re=>re.id),Qt=navigator.platform.toUpperCase().indexOf("MAC")>=0?Le.metaKey:Le.ctrlKey;Be(Q.id,Kt,Qt,Le.shiftKey),n?.(Q);},onDoubleClick:Le=>{Le.stopPropagation(),s?.(Q);},onContextMenu:Le=>{Le.preventDefault(),q({isOpen:true,x:Le.clientX,y:Le.clientY,type:"task",task:Q}),c?.(Q,Le);},whileHover:{backgroundColor:ee?t.accentLight:t.hoverBg},children:[R&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Y&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),ct.map((Le,Me)=>{let Kt=Me===ct.length-1,$t=Le.id==="name";return jsx("div",{className:`px-4 flex items-center ${$t?"justify-start":"justify-center"}`,style:{width:`${Le.width}px`,minWidth:`${Le.minWidth??($t?200:60)}px`,maxWidth:`${Le.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:Kt?"none":`1px solid ${S===Q.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:kt(Le,Q,$t?oe:0)},`${Q.id}-${Le.id}`)})]},Q.id)})}),jsx(lo,{isOpen:E.isOpen,x:E.x,y:E.y,items:E.type==="header"&&E.columnId?rt(E.columnId):E.type==="task"&&E.task?Qe(E.task):[],onClose:()=>q({...E,isOpen:false}),theme:t}),O&&it&&Z&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:it.x+12,top:it.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let Q=ut.find(oe=>oe.task.id===Z)?.task;return Q?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:Q.name})}):null})()}),document.body)]})}function tc(e,t){let[a,r]=useState("none"),[o,n]=useState(0),[s,c]=useState(e),[p,i]=useState(t),[u,d]=useState(null),[l,h]=useState(null),[b,m]=useState(null),[v,w]=useState(null),[g,f]=useState(0),[x,N]=useState(0),[D,I]=useState(null),[k,$]=useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:n,ghostX:s,setGhostX:c,ghostWidth:p,setGhostWidth:i,connectionLine:u,setConnectionLine:d,hoveredTaskId:l,setHoveredTaskId:h,activeZone:b,setActiveZone:m,draggedSegmentIndex:v,setDraggedSegmentIndex:w,draggedSegmentStartX:g,setDraggedSegmentStartX:f,segmentDragOffsetX:x,setSegmentDragOffsetX:N,hoveredSegmentIndex:D,setHoveredSegmentIndex:I,isHovered:k,setIsHovered:$,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(J,ne)=>{r("none"),d(null),h(null),c(J),i(ne),N(0),w(null),f(0);}}}function vn({task:e,x:t,y:a,width:r,theme:o,dayWidth:n,startDate:s,templates:c,onClick:p,onDoubleClick:i,onContextMenu:u,onDateChange:d,onDependencyCreate:l,allTaskPositions:h=[],onDragMove:b,onHoverChange:m}){let v=tc(t,r),w=useRef(null),{dragMode:g,setDragMode:f,dragOffset:x,setDragOffset:N,ghostX:D,setGhostX:I,ghostWidth:k,setGhostWidth:$,connectionLine:S,setConnectionLine:C,hoveredTaskId:H,setHoveredTaskId:B,activeZone:J,setActiveZone:ne,draggedSegmentIndex:xe,setDraggedSegmentIndex:Pe,draggedSegmentStartX:Re,setDraggedSegmentStartX:le,segmentDragOffsetX:z,setSegmentDragOffsetX:L,hoveredSegmentIndex:W,setHoveredSegmentIndex:E,isHovered:q,setIsHovered:Z,isDragging:U,isResizing:ke,isConnecting:Ne,resetDragState:Fe}=v,ye=32,tt=8,Ie=e.endDate&&e.endDate<new Date&&e.progress<100,st=e.isCriticalPath,it=o.name==="neutral"||o.today==="#1C1917",dt=e.status==="completed"||e.progress===100,O={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},K=e.isCriticalPath||Ie?"#DC2626":e.color?e.color:e.priority&&O[e.priority]?O[e.priority]:o.taskBarPrimary,ge=(fe=>fe>=80?20:fe>=60?15:fe>=50?12:10)(r),Se=r<50,Ke=r<40;useEffect(()=>{if(m)if(q&&!U&&!e.segments){let fe=a<100;m({task:e,x:t,y:a,width:r,height:ye,showBelow:fe});}else m(null);},[q,U,e,t,a,r,ye,m]);let yt=fe=>fe.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Be=()=>{let fe=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${fe} day${fe!==1?"s":""}`},pe=fe=>Math.round(fe/n)*n,Ee=fe=>{let Oe=Math.round(fe/n),Ae=new Date(s);return Ae.setDate(Ae.getDate()+Oe),Ae},jt=(fe,Oe)=>{for(let Ae of h){if(Ae.id===e.id)continue;let Ge=5;if(fe>=Ae.x-Ge&&fe<=Ae.x+Ae.width+Ge&&Oe>=Ae.y-Ge&&Oe<=Ae.y+Ae.height+Ge)return Ae.id}return null},ut=useCallback((fe,Oe,Ae)=>{fe.preventDefault(),fe.stopPropagation();let Ge=w.current?.ownerSVGElement;if(!Ge)return;let _e=Ge.createSVGPoint();_e.x=fe.clientX,_e.y=fe.clientY;let kt=_e.matrixTransform(Ge.getScreenCTM()?.inverse()),rt=Ae!==void 0?Ae:t,Qe=Oe;if(!Qe){let ct=kt.x-rt;fe.shiftKey?(Qe="connect",C({x:t+r,y:a+ye/2})):fe.ctrlKey||fe.metaKey?Qe="move":fe.altKey?Qe=ct<r/2?"resize-start":"resize-end":Ke?ct<r/2?Qe="move":Qe="resize-end":Se?ct<=ge/2?Qe="resize-start":ct>=r-ge/2?Qe="resize-end":Qe="move":ct<=ge?Qe="resize-start":ct>=r-ge?Qe="resize-end":Qe="move";}f(Qe),Z(false),ne(null),Qe==="move"?N(kt.x-rt):Qe==="connect"?C({x:t+r,y:a+ye/2}):N(0),I(rt),$(r);},[t,r,a,ye]),sa=useCallback(fe=>{if(g==="none")return;let Oe=w.current?.ownerSVGElement;if(!Oe)return;let Ae=Oe.createSVGPoint();Ae.x=fe.clientX,Ae.y=fe.clientY;let Ge=Ae.matrixTransform(Oe.getScreenCTM()?.inverse());if(g==="connect"){C({x:Ge.x,y:Ge.y});let _e=jt(Ge.x,Ge.y);B(_e);}else if(g==="move"){let _e=Ge.x-x,kt=pe(_e);I(kt),$(r);let rt=Math.round((kt-t)/n);if(b?.(e.id,rt,true),e.segments&&e.segments.length>0&&xe!==null){let Qe=kt-Re;L(Qe);}}else if(g==="resize-start"){let _e=Ge.x,kt=pe(_e),rt=t+r-kt;rt>=n&&(I(kt),$(rt));}else if(g==="resize-end"){let _e=Ge.x,rt=pe(_e)-t;rt>=n&&$(rt);}},[g,t,r,n,x,e,pe,xe,Re,jt,B,C,I,$,L,b]),Sa=useCallback(()=>{if(g!=="none"){if(g==="connect")H&&l&&l(e,H),C(null),B(null);else {let fe=e.endDate.getTime()-e.startDate.getTime(),Oe,Ae,Ge=true;if(g==="move"){if(Oe=Ee(D),Ae=new Date(Oe.getTime()+fe),e.segments&&e.segments.length>0&&xe!==null){let _e=Math.round(z/n),kt=e.segments.map((Ht,Q)=>{if(Q===xe){let oe=new Date(Ht.startDate),T=new Date(Ht.endDate);return oe.setDate(oe.getDate()+_e),T.setDate(T.getDate()+_e),{startDate:oe,endDate:T}}return Ht}),rt=kt.flatMap(Ht=>[Ht.startDate,Ht.endDate]),Qe=new Date(Math.min(...rt.map(Ht=>Ht.getTime()))),ct=new Date(Math.max(...rt.map(Ht=>Ht.getTime())));d?.({...e,segments:kt},Qe,ct),Fe(t,r);return}}else g==="resize-start"?(Oe=Ee(D),Ae=e.endDate,Oe>Ae&&(console.warn("Invalid date range: start date must be before or equal to end date"),Ge=false)):g==="resize-end"?(Oe=e.startDate,Ae=Ee(D+k),Ae<Oe&&(console.warn("Invalid date range: end date must be after or equal to start date"),Ge=false)):Ge=false;Ge&&Oe&&Ae&&(Ae.getTime()<Oe.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,Oe,Ae));}b?.(e.id,0,false),Fe(t,r);}},[g,D,k,e,d,H,l,t,r,n,Ee,z,xe,Fe,b]);useEffect(()=>{if(g==="none")return;let fe=Ae=>{sa(Ae);},Oe=()=>{Sa();};return window.addEventListener("mousemove",fe),window.addEventListener("mouseup",Oe),()=>{window.removeEventListener("mousemove",fe),window.removeEventListener("mouseup",Oe);}},[g,sa,Sa]);let He=U&&!Ne?D:t,$e=U&&!Ne?k:r,ia=c.taskClass(e);return jsxs("g",{ref:w,onMouseEnter:()=>!U&&Z(true),onMouseLeave:()=>{U||(Z(false),ne(null));},onClick:()=>!U&&p?.(e),onDoubleClick:fe=>{U||(fe.stopPropagation(),i?.(e));},onContextMenu:fe=>{fe.preventDefault(),u?.(e,fe);},children:[q&&!U&&!Se&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:ge,height:ye,fill:J==="resize-start"?o.accent:"transparent",opacity:J==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ne("resize-start"),onMouseDown:fe=>ut(fe,"resize-start")}),jsx("rect",{x:t+ge,y:a,width:r-ge*2,height:ye,fill:J==="move"?o.accent:"transparent",opacity:J==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>ne("move"),onMouseDown:fe=>ut(fe,"move")}),jsx("rect",{x:t+r-ge,y:a,width:ge,height:ye,fill:J==="resize-end"?o.accent:"transparent",opacity:J==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ne("resize-end"),onMouseDown:fe=>ut(fe,"resize-end")})]}),q&&!U&&Ke&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:r/2,height:ye,fill:J==="move"?o.accent:"transparent",opacity:J==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>ne("move"),onMouseDown:fe=>ut(fe,"move")}),jsx("rect",{x:t+r/2,y:a,width:r/2,height:ye,fill:J==="resize-end"?o.accent:"transparent",opacity:J==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ne("resize-end"),onMouseDown:fe=>ut(fe,"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"}})]}),U&&!Ne&&!e.segments&&jsx(motion.rect,{x:D,y:a,width:k,height:ye,rx:tt,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:He,y:a,width:$e,height:ye,rx:tt,fill:K,"data-task-class":ia,initial:{opacity:0,scale:.95},animate:{opacity:U&&!Ne?.15:e.parentId?.6:q?.9:.8,scale:q&&!U?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:fe=>ut(fe),style:{cursor:U?Ne?"crosshair":ke?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsx("rect",{x:He,y:a,width:$e*(e.progress/100),height:ye,rx:tt,fill:K,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((fe,Oe)=>{let Ae=(fe.startDate.getTime()-s.getTime())/864e5*n,_e=(fe.endDate.getTime()-s.getTime())/(1e3*60*60*24)*n-Ae+n,kt=U&&g==="move"&&xe===Oe,rt=W===Oe,Qe=kt?Ae+z:Ae;return jsxs("g",{onMouseEnter:()=>!U&&E(Oe),onMouseLeave:()=>!U&&E(null),children:[jsx(motion.rect,{x:Qe,y:a,width:_e,height:ye,rx:tt,fill:K,initial:{opacity:0,scale:.95},animate:{opacity:kt||e.parentId?.6:rt?.9:.8,scale:rt&&!U?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:ct=>{ct.stopPropagation(),Pe(Oe),le(Ae),ut(ct,void 0,Ae);},style:{cursor:U?Ne?"crosshair":ke?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsx("rect",{x:Qe,y:a,width:_e*(e.progress/100),height:ye,rx:tt,fill:K,opacity:1,style:{pointerEvents:"none"}})]},`segment-${Oe}`)}),it&&(Ie||st)&&!e.segments&&jsxs(Fragment,{children:[st&&!Ie&&jsx("rect",{x:He,y:a,width:$e,height:ye,rx:tt,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),Ie&&jsx("rect",{x:He,y:a,width:$e,height:ye,rx:tt,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),$e>60&&!e.segments&&(()=>{let fe=c.taskLabel(e),Oe=typeof fe=="string"?fe:e.name,Ae=Oe.length>Math.floor($e/8)?`${Oe.substring(0,Math.floor($e/8))}...`:Oe;return jsx("text",{x:He+12,y:a+ye/2,dominantBaseline:"middle",fill:dt?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:dt?"line-through":"none"},children:Ae})})(),$e>100&&e.progress>0&&e.progress<100&&!U&&!e.segments&&jsxs("text",{x:He+$e-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&&$e>80&&!U&&!e.segments&&jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsx("circle",{cx:He+$e-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsx("circle",{cx:He+$e-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(q||ke)&&!Ne&&!e.segments&&jsxs(Fragment,{children:[jsxs("g",{style:{pointerEvents:"all"},children:[jsx("rect",{x:Se?He-15:He-10,y:a-5,width:Se?25:20,height:ye+10,fill:"transparent",onMouseDown:fe=>ut(fe,"resize-start"),style:{cursor:"ew-resize"}}),jsx(motion.rect,{x:Se?He-8:He-3,y:a+6,width:Se?8:6,height:Se?ye-12:ye-16,rx:3,fill:g==="resize-start"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:g==="resize-start"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]}),jsxs("g",{style:{pointerEvents:"all"},children:[jsx("rect",{x:He+$e-10,y:a-5,width:Se?25:20,height:ye+10,fill:"transparent",onMouseDown:fe=>ut(fe,"resize-end"),style:{cursor:"ew-resize"}}),jsx(motion.rect,{x:Se?He+$e:He+$e-3,y:a+6,width:Se?8:6,height:Se?ye-12:ye-16,rx:3,fill:g==="resize-end"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:g==="resize-end"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]})]}),jsx(AnimatePresence,{children:q&&!U&&!e.segments&&jsxs(motion.g,{style:{pointerEvents:"all"},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsx(motion.circle,{cx:t+r+8,cy:a+ye/2,r:6,fill:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},exit:{scale:0},transition:{duration:.2,type:"spring",stiffness:400,damping:25},onMouseDown:fe=>{fe.stopPropagation(),ut(fe,"connect");},style:{cursor:"crosshair"}}),jsx("text",{x:t+r+20,y:a+ye/2,dominantBaseline:"middle",fill:o.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),Ne&&S&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:t+r,y1:a+ye/2,x2:S.x,y2:S.y,stroke:H?o.statusCompleted:o.accent,strokeWidth:H?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:H?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:S.x,cy:S.y,r:H?8:6,fill:H?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),H&&jsx(motion.text,{x:S.x+15,y:S.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:S.x+10},animate:{opacity:1,x:S.x+15},transition:{duration:.2},children:"Connect"})]}),(q||U)&&!Ne&&!e.segments&&jsx(motion.rect,{x:He-2,y:a-2,width:$e+4,height:ye+4,rx:tt+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"}}),ke&&jsxs(Fragment,{children:[jsx("line",{x1:D,y1:0,x2:D,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsx("line",{x1:D+k,y1:0,x2:D+k,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:q&&!U&&!e.segments&&!m&&(()=>{let Ae=a<100,Ge=Ae?a+ye+13:a-82-13,_e=Ae?`M ${He+$e/2-6} ${a+ye+3} L ${He+$e/2} ${a+ye+13} L ${He+$e/2+6} ${a+ye+3}`:`M ${He+$e/2-6} ${a-13} L ${He+$e/2} ${a-3} L ${He+$e/2+6} ${a-13}`,kt=Ge+22,rt=Ge+40,Qe=Ge+55,ct=Ge+70,Ht=Ae?Ge+82-5:a-18;return jsxs(motion.g,{initial:{opacity:0,y:Ae?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:Ae?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:_e,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsx("rect",{x:He+$e/2-120,y:Ge,width:240,height:82,rx:8,fill:o.bgSecondary,stroke:o.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("text",{x:He+$e/2,y:kt,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:He+$e/2-110,y:rt,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:He+$e/2-70,y:rt,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:yt(e.startDate)}),jsx("text",{x:He+$e/2-110,y:Qe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:He+$e/2-70,y:Qe,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:yt(e.endDate)}),jsx("text",{x:He+$e/2+10,y:rt,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:He+$e/2+65,y:rt,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Be()}),jsx("text",{x:He+$e/2+10,y:Qe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:He+$e/2+65,y:Qe,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:He+$e/2-110,y:ct,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:He+$e/2-50,y:ct,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(Q=>Q.name).join(", ").substring(0,30),e.assignees.map(Q=>Q.name).join(", ").length>30?"...":""]})]}),!Ae&&jsx("text",{x:He+$e/2,y:Ht,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Ke?"Left: move \u2022 Right: resize":Se?"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 oc({tooltipData:e,theme:t}){if(!e)return null;let {task:a,x:r,y:o,width:n,height:s,showBelow:c}=e,p=82,i=13,u=c?o+s+i:o-p-i,d=c?`M ${r+n/2-6} ${o+s+3} L ${r+n/2} ${o+s+13} L ${r+n/2+6} ${o+s+3}`:`M ${r+n/2-6} ${o-13} L ${r+n/2} ${o-3} L ${r+n/2+6} ${o-13}`,l=u+22,h=u+40,b=u+55,m=u+70,v=x=>x.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),w=()=>{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:c?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:c?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsx("rect",{x:r+n/2-120,y:u,width:240,height:p,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+n/2,y:l,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+n/2-110,y:h,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:r+n/2-70,y:h,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.startDate?v(a.startDate):"N/A"}),jsx("text",{x:r+n/2-110,y:b,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:r+n/2-70,y:b,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?v(a.endDate):"N/A"}),jsx("text",{x:r+n/2+10,y:h,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:r+n/2+65,y:h,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:w()}),jsx("text",{x:r+n/2+10,y:b,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:r+n/2+65,y:b,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+n/2-110,y:m,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:r+n/2-50,y:m,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 wn({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:n,onHoverChange:s}){let[c,p]=useState(false),i=a-e,u=r-t,d=e+i/2,l=`M ${e} ${t} C ${d} ${t}, ${d} ${r}, ${a} ${r}`,h=6,b=Math.atan2(u,i),m=a-h*Math.cos(b-Math.PI/6),v=r-h*Math.sin(b-Math.PI/6),w=a-h*Math.cos(b+Math.PI/6),g=r-h*Math.sin(b+Math.PI/6),f=o.dependency;useEffect(()=>{s&&n&&s(c?{x1:e,y1:t,x2:a,y2:r,onDelete:n}:null);},[c,e,t,a,r,n,s]);let x=!n&&!s;return jsxs("g",{onMouseEnter:()=>!x&&p(true),onMouseLeave:()=>!x&&p(false),style:{pointerEvents:x?"none":"auto"},children:[!x&&jsx("path",{d:l,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsx(motion.path,{d:l,fill:"none",stroke:f,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:c&&s?0:c?1:.8,strokeWidth:c?2.5:2},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2},strokeWidth:{duration:.2}}}),jsx(motion.path,{d:`M ${a} ${r} L ${m} ${v} M ${a} ${r} L ${w} ${g}`,fill:"none",stroke:f,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:c&&s?0:c?1:.8,scale:c?1.1:1,strokeWidth:c?2.5:2},transition:{duration:.2}}),jsx(motion.circle,{cx:a,cy:r,r:3,fill:f,initial:{scale:0},animate:{scale:c&&s?0:c?1.3:1,opacity:c&&s?0:c?1:.8},transition:{scale:{delay:.3,duration:.15},opacity:{duration:.2}}}),c&&n&&!s&&jsxs(motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:N=>{N.stopPropagation(),n();},style:{cursor:"pointer"},children:[jsx("circle",{cx:d,cy:(t+r)/2,r:10,fill:o.bgSecondary,stroke:o.error||"#ef4444",strokeWidth:2}),jsx("line",{x1:d-4,y1:(t+r)/2-4,x2:d+4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsx("line",{x1:d+4,y1:(t+r)/2-4,x2:d-4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})}function Tn({task:e,x:t,y:a,theme:r,onClick:o}){let[n,s]=useState(false),c=16,p=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxs("g",{onMouseEnter:()=>s(true),onMouseLeave:()=>s(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsx(motion.circle,{cx:t,cy:a+16,r:c+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:n?1.2:1},transition:{duration:.3}}),jsx(motion.rect,{x:t-c/2,y:a+16-c/2,width:c,height:c,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:n?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),n&&jsx(motion.rect,{x:t-(c+4)/2,y:a+16-(c+4)/2,width:c+4,height:c+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:n&&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:p(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 me={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 n=r.get(a)||[];r.set(a,[...n,t]);let s=new Set,c=new Set,p=i=>{if(!s.has(i)){s.add(i),c.add(i);let u=r.get(i)||[];for(let d of u){if(!s.has(d)&&p(d))return true;if(c.has(d))return true}}return c.delete(i),false};return p(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=me.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=me.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let n=me.findTaskById(e,o);if(n)a.unshift(n),o=n.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=me.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let n=[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(n.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=me.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=me.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)=>me.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=me.findTaskById(e,t);return !a||!a.dependencies?[]:me.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>me.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>me.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=me.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 n=t[o];if(!a||n===void 0||n>=a.length||(r=a[n],!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=>me.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,n=me.flattenTasks(e);if(n.length===0){alert("No tasks found to export");return}o.setFontSize(16),o.text("Gantt Chart - Task List",14,20);let s=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],c=n.map(p=>{let i=p.startDate&&p.endDate?me.calculateDuration(p.startDate,p.endDate):0;return [p.name,p.startDate?me.formatDate(p.startDate):"N/A",p.endDate?me.formatDate(p.endDate):"N/A",i>0?`${i} days`:"N/A",`${p.progress}%`,p.status||"N/A"]});r(o,{head:s,body:c,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),o.save(t);}catch(a){throw a}},exportToExcel:async(e,t="gantt-chart.xlsx")=>{let a=await import('xlsx'),o=me.flattenTasks(e).map(p=>{let i=p.startDate&&p.endDate?me.calculateDuration(p.startDate,p.endDate):0;return {"Task ID":p.id,"Task Name":p.name,"Start Date":p.startDate?me.formatDate(p.startDate):"","End Date":p.endDate?me.formatDate(p.endDate):"","Duration (days)":i>0?i:"","Progress (%)":p.progress,Status:p.status||"",Assignees:p.assignees?.map(u=>u.name).join(", ")||"",Dependencies:p.dependencies?.join(", ")||"","Is Milestone":p.isMilestone?"Yes":"No","Parent ID":p.parentId||"",Level:p.level||0}}),n=a.utils.json_to_sheet(o),s=[{wch:15},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:20},{wch:12},{wch:15},{wch:8}];n["!cols"]=s;let c=a.utils.book_new();a.utils.book_append_sheet(c,n,"Gantt Tasks"),a.writeFile(c,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=me.flattenTasks(e),o=new Map;r.forEach((l,h)=>{o.set(l.id,h+1);});let n=l=>l.toISOString().replace("Z",""),s=me.getEarliestStartDate(e)||new Date,c=me.getLatestEndDate(e)||new Date,p=r.map((l,h)=>{let b=o.get(l.id),m=l.startDate&&l.endDate?me.calculateDuration(l.startDate,l.endDate):0,v=(l.dependencies||[]).filter(w=>o.has(w)).map(w=>`
|
|
113
113
|
<PredecessorLink>
|
|
114
|
-
<PredecessorUID>${o.get(
|
|
114
|
+
<PredecessorUID>${o.get(w)}</PredecessorUID>
|
|
115
115
|
<Type>1</Type>
|
|
116
116
|
<CrossProject>0</CrossProject>
|
|
117
117
|
<LinkLag>0</LinkLag>
|
|
118
118
|
<LagFormat>7</LagFormat>
|
|
119
119
|
</PredecessorLink>`).join("");return `
|
|
120
120
|
<Task>
|
|
121
|
-
<UID>${
|
|
122
|
-
<ID>${
|
|
123
|
-
<Name>${
|
|
121
|
+
<UID>${b}</UID>
|
|
122
|
+
<ID>${h+1}</ID>
|
|
123
|
+
<Name>${l.name.replace(/[<>&'"]/g,w=>({"<":"<",">":">","&":"&","'":"'",'"':"""})[w]||w)}</Name>
|
|
124
124
|
<Type>0</Type>
|
|
125
125
|
<IsNull>0</IsNull>
|
|
126
126
|
<CreateDate>${n(new Date)}</CreateDate>
|
|
127
|
-
<WBS>${
|
|
128
|
-
<OutlineNumber>${
|
|
129
|
-
<OutlineLevel>${
|
|
127
|
+
<WBS>${h+1}</WBS>
|
|
128
|
+
<OutlineNumber>${h+1}</OutlineNumber>
|
|
129
|
+
<OutlineLevel>${l.level||0}</OutlineLevel>
|
|
130
130
|
<Priority>500</Priority>
|
|
131
|
-
<Start>${
|
|
132
|
-
<Finish>${
|
|
133
|
-
<Duration>PT${
|
|
131
|
+
<Start>${l.startDate?n(l.startDate):""}</Start>
|
|
132
|
+
<Finish>${l.endDate?n(l.endDate):""}</Finish>
|
|
133
|
+
<Duration>PT${m*8}H0M0S</Duration>
|
|
134
134
|
<DurationFormat>7</DurationFormat>
|
|
135
|
-
<Work>PT${
|
|
136
|
-
<Stop>${
|
|
137
|
-
<Resume>${
|
|
135
|
+
<Work>PT${m*8}H0M0S</Work>
|
|
136
|
+
<Stop>${l.endDate?n(l.endDate):""}</Stop>
|
|
137
|
+
<Resume>${l.startDate?n(l.startDate):""}</Resume>
|
|
138
138
|
<ResumeValid>0</ResumeValid>
|
|
139
139
|
<EffortDriven>1</EffortDriven>
|
|
140
140
|
<Recurring>0</Recurring>
|
|
141
141
|
<OverAllocated>0</OverAllocated>
|
|
142
142
|
<Estimated>0</Estimated>
|
|
143
|
-
<Milestone>${
|
|
144
|
-
<Summary>${
|
|
145
|
-
<Critical>${
|
|
143
|
+
<Milestone>${l.isMilestone?"1":"0"}</Milestone>
|
|
144
|
+
<Summary>${l.subtasks&&l.subtasks.length>0?"1":"0"}</Summary>
|
|
145
|
+
<Critical>${l.isCriticalPath?"1":"0"}</Critical>
|
|
146
146
|
<IsSubproject>0</IsSubproject>
|
|
147
147
|
<IsSubprojectReadOnly>0</IsSubprojectReadOnly>
|
|
148
148
|
<ExternalTask>0</ExternalTask>
|
|
149
|
-
<EarlyStart>${
|
|
150
|
-
<EarlyFinish>${
|
|
151
|
-
<LateStart>${
|
|
152
|
-
<LateFinish>${
|
|
149
|
+
<EarlyStart>${l.startDate?n(l.startDate):""}</EarlyStart>
|
|
150
|
+
<EarlyFinish>${l.endDate?n(l.endDate):""}</EarlyFinish>
|
|
151
|
+
<LateStart>${l.startDate?n(l.startDate):""}</LateStart>
|
|
152
|
+
<LateFinish>${l.endDate?n(l.endDate):""}</LateFinish>
|
|
153
153
|
<StartVariance>0</StartVariance>
|
|
154
154
|
<FinishVariance>0</FinishVariance>
|
|
155
155
|
<WorkVariance>0</WorkVariance>
|
|
@@ -157,22 +157,22 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
157
157
|
<TotalSlack>0</TotalSlack>
|
|
158
158
|
<FixedCost>0</FixedCost>
|
|
159
159
|
<FixedCostAccrual>3</FixedCostAccrual>
|
|
160
|
-
<PercentComplete>${
|
|
161
|
-
<PercentWorkComplete>${
|
|
160
|
+
<PercentComplete>${l.progress}</PercentComplete>
|
|
161
|
+
<PercentWorkComplete>${l.progress}</PercentWorkComplete>
|
|
162
162
|
<Cost>0</Cost>
|
|
163
163
|
<OvertimeCost>0</OvertimeCost>
|
|
164
164
|
<OvertimeWork>PT0H0M0S</OvertimeWork>
|
|
165
|
-
<ActualStart>${
|
|
166
|
-
<ActualFinish>${
|
|
167
|
-
<ActualDuration>PT${Math.round(
|
|
165
|
+
<ActualStart>${l.progress>0&&l.startDate?n(l.startDate):""}</ActualStart>
|
|
166
|
+
<ActualFinish>${l.progress===100&&l.endDate?n(l.endDate):""}</ActualFinish>
|
|
167
|
+
<ActualDuration>PT${Math.round(m*l.progress/100)*8}H0M0S</ActualDuration>
|
|
168
168
|
<ActualCost>0</ActualCost>
|
|
169
169
|
<ActualOvertimeCost>0</ActualOvertimeCost>
|
|
170
|
-
<ActualWork>PT${Math.round(
|
|
170
|
+
<ActualWork>PT${Math.round(m*l.progress/100)*8}H0M0S</ActualWork>
|
|
171
171
|
<ActualOvertimeWork>PT0H0M0S</ActualOvertimeWork>
|
|
172
|
-
<RegularWork>PT${
|
|
173
|
-
<RemainingDuration>PT${Math.round(
|
|
172
|
+
<RegularWork>PT${m*8}H0M0S</RegularWork>
|
|
173
|
+
<RemainingDuration>PT${Math.round(m*(100-l.progress)/100)*8}H0M0S</RemainingDuration>
|
|
174
174
|
<RemainingCost>0</RemainingCost>
|
|
175
|
-
<RemainingWork>PT${Math.round(
|
|
175
|
+
<RemainingWork>PT${Math.round(m*(100-l.progress)/100)*8}H0M0S</RemainingWork>
|
|
176
176
|
<RemainingOvertimeCost>0</RemainingOvertimeCost>
|
|
177
177
|
<RemainingOvertimeWork>PT0H0M0S</RemainingOvertimeWork>
|
|
178
178
|
<ACWP>0</ACWP>
|
|
@@ -191,17 +191,17 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
191
191
|
<PhysicalPercentComplete>0</PhysicalPercentComplete>
|
|
192
192
|
<EarnedValueMethod>0</EarnedValueMethod>
|
|
193
193
|
<IsPublished>1</IsPublished>
|
|
194
|
-
<CommitmentType>0</CommitmentType>${
|
|
195
|
-
</Task>`}).join(""),
|
|
194
|
+
<CommitmentType>0</CommitmentType>${v}
|
|
195
|
+
</Task>`}).join(""),i=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
196
196
|
<Project xmlns="http://schemas.microsoft.com/project">
|
|
197
197
|
<SaveVersion>14</SaveVersion>
|
|
198
|
-
<Name>${t.replace(/[<>&'"]/g,
|
|
199
|
-
<Title>${t.replace(/[<>&'"]/g,
|
|
198
|
+
<Name>${t.replace(/[<>&'"]/g,l=>({"<":"<",">":">","&":"&","'":"'",'"':"""})[l]||l)}</Name>
|
|
199
|
+
<Title>${t.replace(/[<>&'"]/g,l=>({"<":"<",">":">","&":"&","'":"'",'"':"""})[l]||l)}</Title>
|
|
200
200
|
<CreationDate>${n(new Date)}</CreationDate>
|
|
201
201
|
<LastSaved>${n(new Date)}</LastSaved>
|
|
202
202
|
<ScheduleFromStart>1</ScheduleFromStart>
|
|
203
203
|
<StartDate>${n(s)}</StartDate>
|
|
204
|
-
<FinishDate>${n(
|
|
204
|
+
<FinishDate>${n(c)}</FinishDate>
|
|
205
205
|
<FYStartDate>1</FYStartDate>
|
|
206
206
|
<CriticalSlackLimit>0</CriticalSlackLimit>
|
|
207
207
|
<CurrencyDigits>2</CurrencyDigits>
|
|
@@ -337,11 +337,11 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
337
337
|
</WeekDays>
|
|
338
338
|
</Calendar>
|
|
339
339
|
</Calendars>
|
|
340
|
-
<Tasks>${
|
|
340
|
+
<Tasks>${p}
|
|
341
341
|
</Tasks>
|
|
342
|
-
</Project>`,u=new Blob([l],{type:"application/xml;charset=utf-8;"}),c=document.createElement("a");c.href=URL.createObjectURL(u),c.download=a,c.click(),URL.revokeObjectURL(c.href);},calculateCriticalPath:e=>{let t=pe.flattenTasks(e),a=t.filter(l=>l.startDate&&l.endDate);if(a.length===0)return [];let r=new Map,o=l=>{if(r.has(l.id))return;let u=l.startDate&&l.endDate?pe.calculateDuration(l.startDate,l.endDate):0,c=0;if(l.dependencies&&l.dependencies.length>0)for(let i of l.dependencies){let w=t.find(g=>g.id===i);if(w){o(w);let g=r.get(i)?.ef||0;c=Math.max(c,g);}}let d=c+u;r.set(l.id,{es:c,ef:d});};a.forEach(o);let n=Math.max(...Array.from(r.values()).map(l=>l.ef)),s=new Map,p=l=>{if(s.has(l.id))return;let u=l.startDate&&l.endDate?pe.calculateDuration(l.startDate,l.endDate):0,c=t.filter(w=>w.dependencies&&w.dependencies.includes(l.id)),d=n;if(c.length>0)for(let w of c){p(w);let g=s.get(w.id)?.ls||0;d=Math.min(d,g);}let i=d-u;s.set(l.id,{ls:i,lf:d});};a.forEach(p);let m=[];for(let l of a){let u=r.get(l.id),c=s.get(l.id);if(u&&c){let d=c.ls-u.es;Math.abs(d)<.01&&m.push(l.id);}}return m},calculateSlack:(e,t)=>{let a=pe.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(pe.calculateCriticalPath(e).includes(t))return 0;let o=pe.getDependentTasks(e,t);if(o.length===0){let p=pe.getLatestEndDate(e);if(!p)return null;let m=pe.calculateDuration(a.endDate,p);return Math.max(0,m)}let n=o.filter(p=>p.startDate).map(p=>p.startDate.getTime()).sort((p,m)=>p-m)[0];if(!n)return null;let s=pe.calculateDuration(a.endDate,new Date(n));return Math.max(0,s)},isOnCriticalPath:(e,t)=>pe.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=pe.findTaskById(e,t);if(!r||!r.endDate)return e;let o=pe.getDependentTasks(e,t);if(o.length===0)return e;let n=[...e];for(let s of o){if(!s.startDate||!s.endDate)continue;let p=pe.calculateDuration(s.startDate,s.endDate),m;a!==void 0?(m=new Date(s.startDate),m.setDate(m.getDate()+a)):(m=new Date(r.endDate),m.setDate(m.getDate()+1));let l=pe.calculateEndDate(m,p),u=c=>c.map(d=>d.id===s.id?{...d,startDate:m,endDate:l}:d.subtasks?{...d,subtasks:u(d.subtasks)}:d);n=u(n),n=pe.autoScheduleDependents(n,s.id,a);}return n},calculateCascadePreview:(e,t,a,r,o,n,s,p)=>{if(a===0)return [];let m=[],l=o.getTime(),u=1e3*60*60*24,c=pe.findTaskById(e,t);if(!c||!c.endDate)return [];let d=(i,w,g=new Set)=>{if(g.has(i))return;g.add(i);let b=pe.getDependentTasks(e,i);for(let h of b){if(!h.startDate||!h.endDate)continue;let v=r.findIndex(C=>C.id===h.id);if(v===-1)continue;let f=h.startDate.getTime(),T=(h.endDate.getTime()-f)/u,I=(f-l)/u*n,k=I+w*n,L=Math.max(T*n,n),N=p+v*s+12;m.push({taskId:h.id,taskName:h.name,originalX:I,previewX:k,width:L,y:N,rowIndex:v,daysDelta:w,color:h.color}),d(h.id,w,g);}};return d(t,a),m},splitTask:(e,t,a,r=3)=>{let o=pe.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 n=new Date(a);n.setDate(n.getDate()-1);let s=new Date(a);s.setDate(s.getDate()+r);let p=new Date(o.endDate);p.setDate(p.getDate()+r);let m=[{startDate:new Date(o.startDate),endDate:n},{startDate:s,endDate:p}],l=u=>u.map(c=>c.id===o.id?{...c,endDate:p,segments:m}:c.subtasks?{...c,subtasks:l(c.subtasks)}:c);return l(e)}};function Cn({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:n,zoom:s,templates:p,onTaskClick:m,onTaskDblClick:l,onTaskContextMenu:u,onTaskDateChange:c,onDependencyCreate:d,onDependencyDelete:i}){let[g,b]=useState([]),[h,v]=useState(null),[f,x]=useState(null),T=useCallback(z=>{v(z);},[]),D=Math.ceil((n.getTime()-o.getTime())/(1e3*60*60*24)),I=r==="day"?60:r==="week"?20:8,k=D*I*s,L=z=>{let B=new Date(Date.UTC(z.getFullYear(),z.getMonth(),z.getDate())),$=B.getUTCDay()||7;B.setUTCDate(B.getUTCDate()+4-$);let P=new Date(Date.UTC(B.getUTCFullYear(),0,1));return Math.ceil(((B.getTime()-P.getTime())/864e5+1)/7)},N=z=>{let B=z.getDay();return B===0||B===6},C=useCallback(z=>{let B=Math.round(z/(I*s)),$=new Date(o);return $.setDate($.getDate()+B),$},[o,I,s]),G=useCallback((z,B)=>{if(B.startDate&&B.endDate)return;let $=z.currentTarget.ownerSVGElement;if(!$)return;let P=$.createSVGPoint();P.x=z.clientX,P.y=z.clientY;let Q=P.matrixTransform($.getScreenCTM()?.inverse()),ee=C(Q.x),H=new Date(ee);H.setDate(H.getDate()+1),c?.(B,ee,H);},[C,c]),F=useMemo(()=>{let z=Q=>Q.map(ee=>{if(ee.subtasks&&ee.subtasks.length>0){let H=z(ee.subtasks),De=H.filter(Ee=>Ee.startDate&&Ee.endDate);if(De.length>0){let Ee=De.map(ae=>ae.startDate.getTime()),Be=De.map(ae=>ae.endDate.getTime()),xe=new Date(Math.min(...Ee)),U=new Date(Math.max(...Be));return {...ee,subtasks:H,startDate:xe,endDate:U}}return {...ee,subtasks:H}}return ee}),B=(Q,ee=[])=>{for(let H of Q)ee.push(H),H.subtasks&&H.subtasks.length>0&&(H.isExpanded===void 0||H.isExpanded)&&B(H.subtasks,ee);return ee},$=z(e);return B($)},[e]),J=useCallback(z=>{if(!z.startDate||!z.endDate)return {x:0,width:0};let B=z.startDate.getTime(),$=z.endDate.getTime(),P=o.getTime(),Q=(B-P)/(1e3*60*60*24),ee=($-B)/(1e3*60*60*24),H=Q*I*s,De=Math.max(I*s,40),Ee=Math.max(ee*I*s,De);return {x:H,width:Ee}},[o,I,s]),K=useMemo(()=>F.filter(z=>z.startDate&&z.endDate).map(z=>{let{x:B,width:$}=J(z),Q=F.findIndex(ee=>ee.id===z.id)*a+12;return {id:z.id,x:B,y:Q,width:$,height:32}}),[F,J]),de=useCallback((z,B,$)=>{if(!$||B===0){b([]);return}let P=pe.calculateCascadePreview(e,z,B,F,o,I*s,a,48);b(P);},[e,F,o,I,s,a,48]),ge=useMemo(()=>{let z=[],B=new Date(o);for(;B<=n;){let Q=(B.getTime()-o.getTime())/864e5*I*s;if(r==="day")z.push({date:new Date(B),label:B.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:Q}),B.setDate(B.getDate()+1);else if(r==="week"){let ee=L(B);z.push({date:new Date(B),label:`Week ${ee}`,x:Q}),B.setDate(B.getDate()+7);}else z.push({date:new Date(B),label:B.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:Q}),B.setMonth(B.getMonth()+1);}return z},[o,n,r,I,s]),Te=useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*I*s,[o,I,s]),Ce=Math.max(F.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}),ge.map((z,B)=>jsxs("g",{children:[B>0&&jsx("line",{x1:z.x,y1:0,x2:z.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsx("text",{x:z.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:z.label})]},`header-${B}`)),Te>=0&&Te<=k&&jsx("circle",{cx:Te,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxs("svg",{width:Math.max(k,1e3),height:Ce,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:Ce,fill:t.bgPrimary}),ge.map((z,B)=>{let $=ge[B+1]?.x||k,P=N(z.date);return jsxs("g",{children:[P&&jsx("rect",{x:z.x,y:0,width:$-z.x,height:F.length*a,fill:t.bgWeekend,opacity:1}),B>0&&jsx("line",{x1:z.x,y1:0,x2:z.x,y2:F.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},B)}),F.map((z,B)=>{let $=z.startDate&&z.endDate;return jsxs("g",{children:[jsx("rect",{x:0,y:B*a,width:k,height:a,fill:B%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-${z.id}`),!$&&jsxs(Fragment,{children:[jsx("rect",{x:0,y:B*a,width:k,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:P=>G(P,z),onMouseEnter:P=>{P.currentTarget.setAttribute("fill",t.accentLight),P.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:P=>{P.currentTarget.setAttribute("fill","transparent"),P.currentTarget.setAttribute("opacity","1");}},`clickable-${z.id}`),jsx("text",{x:Te>0?Te:100,y:B*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-${z.id}`)]})]},`row-group-${z.id}`)}),F.map((z,B)=>!z.dependencies||z.dependencies.length===0||!z.startDate||!z.endDate?null:z.dependencies.map($=>{let P=F.find(De=>De.id===$);if(!P||!P.startDate||!P.endDate)return null;let Q=F.findIndex(De=>De.id===$),ee=J(P),H=J(z);return jsx(vn,{x1:ee.x+ee.width,y1:Q*a+a/2,x2:H.x,y2:B*a+a/2,theme:t},`dep-${$}-${z.id}`)})),F.map((z,B)=>{if(!z.startDate||!z.endDate)return null;let{x:$,width:P}=J(z),Q=B*a+12,ee=z.subtasks&&z.subtasks.length>0&&!z.isMilestone;return z.isMilestone?jsx(kn,{task:z,x:$+P/2,y:Q+16,theme:t,onClick:m},z.id):ee?jsxs("g",{onClick:()=>m?.(z),onContextMenu:H=>{H.preventDefault(),H.stopPropagation(),u?.(z,H);},style:{cursor:"default"},children:[jsx("rect",{x:$,y:Q,width:P,height:32,fill:t.primary,opacity:.25,rx:6}),jsx("line",{x1:$,y1:Q,x2:$+P,y2:Q,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsx("line",{x1:$,y1:Q,x2:$,y2:Q+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsx("line",{x1:$+P,y1:Q,x2:$+P,y2:Q+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsx("line",{x1:$,y1:Q+32,x2:$+P,y2:Q+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),P>60&&jsx("text",{x:$+12,y:Q+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:z.name})]},z.id):jsx(hn,{task:z,x:$,y:Q,width:P,theme:t,dayWidth:I*s,startDate:o,templates:p,onClick:m,onDoubleClick:l,onContextMenu:u,onDateChange:c,onDependencyCreate:d,allTaskPositions:K,onDragMove:de,onHoverChange:T},z.id)}),F.map((z,B)=>!z.dependencies||z.dependencies.length===0||!z.startDate||!z.endDate?null:z.dependencies.map($=>{let P=F.find(ce=>ce.id===$);if(!P||!P.startDate||!P.endDate)return null;let Q=F.findIndex(ce=>ce.id===$),ee=J(P),H=J(z),De=ee.x+ee.width,Ee=Q*a+a/2,Be=H.x,xe=B*a+a/2,U=Be-De,ae=De+U/2,Me=ce=>{let fe=1-ce,Ae=fe*fe,ot=Ae*fe,kt=ce*ce,Le=kt*ce,ke=ot*De+3*Ae*ce*ae+3*fe*kt*ae+Le*Be,Ie=ot*Ee+3*Ae*ce*Ee+3*fe*kt*xe+Le*xe;return {x:ke,y:Ie}},_e=20,qe=[];for(let ce=0;ce<=_e;ce++){let fe=.1+ce/_e*.8;qe.push(Me(fe));}let Ke=qe[0],O=`M ${Ke.x} ${Ke.y} `+qe.slice(1).map(ce=>`L ${ce.x} ${ce.y}`).join(" ");return f&&f.x1===De&&f.y1===Ee&&f.x2===Be&&f.y2===xe?null:jsx("path",{d:O,fill:"none",stroke:"transparent",strokeWidth:12,strokeLinecap:"round",style:{cursor:"pointer"},onMouseEnter:()=>{x({x1:De,y1:Ee,x2:Be,y2:xe,onDelete:()=>i?.(z.id,$)});}},`dep-hover-${$}-${z.id}`)})),g.map(z=>jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:z.previewX,y:z.y-48,width:z.width,height:32,rx:8,fill:z.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(z.daysDelta)>0&&jsx("text",{x:z.previewX+z.width/2,y:z.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:z.daysDelta>0?`+${z.daysDelta}d`:`${z.daysDelta}d`})]},`cascade-preview-${z.taskId}`)),f&&(()=>{let{x1:z,y1:B,x2:$,y2:P,onDelete:Q}=f,ee=$-z,H=P-B,De=z+ee/2,Ee=(B+P)/2,Be=`M ${z} ${B} C ${De} ${B}, ${De} ${P}, ${$} ${P}`,xe=6,U=Math.atan2(H,ee),ae=$-xe*Math.cos(U-Math.PI/6),Me=P-xe*Math.sin(U-Math.PI/6),_e=$-xe*Math.cos(U+Math.PI/6),qe=P-xe*Math.sin(U+Math.PI/6),Ke=t.dependency,O="#f87171";return jsxs("g",{onMouseLeave:()=>x(null),children:[jsx("path",{d:Be,fill:"none",stroke:"transparent",strokeWidth:50,strokeLinecap:"round",style:{cursor:"pointer"}}),jsx("circle",{cx:De,cy:Ee,r:25,fill:"transparent",style:{cursor:"pointer"}}),jsx("path",{d:Be,fill:"none",stroke:Ke,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsx("path",{d:Be,fill:"none",stroke:Ke,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("path",{d:`M ${$} ${P} L ${ae} ${Me} M ${$} ${P} L ${_e} ${qe}`,fill:"none",stroke:Ke,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("circle",{cx:$,cy:P,r:4,fill:Ke,opacity:.9,style:{pointerEvents:"none"}}),jsxs(motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:ce=>{ce.stopPropagation(),x(null),Q();},style:{cursor:"pointer"},children:[jsx("circle",{cx:De,cy:Ee,r:9,fill:"rgba(248, 113, 113, 0.15)",stroke:O,strokeWidth:1.5,style:{transition:"all 0.15s ease"}}),jsx("line",{x1:De-3,y1:Ee-3,x2:De+3,y2:Ee+3,stroke:O,strokeWidth:1.5,strokeLinecap:"round"}),jsx("line",{x1:De+3,y1:Ee-3,x2:De-3,y2:Ee+3,stroke:O,strokeWidth:1.5,strokeLinecap:"round"})]})]})})(),Te>=0&&Te<=k&&jsx("line",{x1:Te,y1:0,x2:Te,y2:Ce,stroke:t.today,strokeWidth:1,opacity:1,style:{pointerEvents:"none"}}),h&&jsx(tc,{tooltipData:h,theme:t})]})]})}var Tn=[{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"}];var ci=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],pi=[{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 Dn({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:n,isLoading:s=false,mode:p=a?"edit":"create",theme:m="dark",customStatuses:l=[],availableTags:u=[],onCreateTag:c,attachments:d=[],onUploadAttachments:i,onDeleteAttachment:w}){let g=[...ci,...l.filter(O=>!ci.some(re=>re.id===O.id))],b=Ve[m]||Ve.dark,[h,v]=useState(false),[f,x]=useState(false),[T,D]=useState(false),[I,k]=useState(false),[L,N]=useState({top:0,left:0}),[C,G]=useState(null),[F,J]=useState(new Date),[K,de]=useState({top:0,left:0}),[ge,Te]=useState(false),[Ce,z]=useState([]),B=useRef(null),$=useRef(null),P=useRef(null),Q=useRef(null),ee=useRef(null),[H,De]=useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[Ee,Be]=useState({});useEffect(()=>{a?(De({name:a.name,description:a.description||"",startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",priority:a.priority||"medium",isMilestone:a.isMilestone||false,color:a.color||"#6366F1",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&Te(true)):(De({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),Te(false),z([]));},[a,e]),useEffect(()=>{let O=re=>{B.current&&!B.current.contains(re.target)&&v(false),$.current&&!$.current.contains(re.target)&&x(false),P.current&&!P.current.contains(re.target)&&D(false),Q.current&&!Q.current.contains(re.target)&&k(false);};return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[]);let xe=()=>{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"),Be(O),Object.keys(O).length===0},U=async O=>{if(O.preventDefault(),!!xe())try{let re=p==="create"&&Ce.length>0?{...H,pendingFiles:Ce}:H;await n(re),z([]),t();}catch(re){console.error("Error submitting task:",re);}},ae=(O,re)=>{De(ce=>{let fe={...ce,[O]:re};if(O==="status"){let Ae=re;Ae==="todo"?fe.progress=0:Ae==="in-progress"?(ce.progress===0||ce.progress===100)&&(fe.progress=50):Ae==="completed"||Ae==="closed"?fe.progress=100:(Ae==="in-review"||Ae==="review")&&(fe.progress=75);}if(O==="progress"){let Ae=typeof re=="number"?re:parseInt(re,10);Ae===100&&ce.status!=="completed"?fe.status="completed":Ae>0&&Ae<100&&ce.status==="todo"?fe.status="in-progress":Ae===0&&ce.status!=="todo"&&(fe.status="todo");}return fe}),Ee[O]&&Be(ce=>{let fe={...ce};return delete fe[O],fe});},Me=g.find(O=>O.id===H.status)??ci[0],_e=pi.find(O=>O.id===H.priority)??pi[1],qe=Tn.find(O=>O.value===H.color)??Tn[0],Ke={backgroundColor:b.bgSecondary,border:`1px solid ${b.borderLight}`,color:b.textPrimary};return jsx(AnimatePresence,{children:e&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 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:b.bgPrimary,border:`1px solid ${b.border}`},onClick:O=>O.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${b.border}`},children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:Me.color||b.accent}}),jsx("span",{className:"text-sm font-medium",style:{color:b.textSecondary},children:p==="create"?"Nueva tarea":"Editar tarea"})]}),jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:b.textTertiary},onMouseEnter:O=>{O.currentTarget.style.backgroundColor=b.hoverBg,O.currentTarget.style.color=b.textPrimary;},onMouseLeave:O=>{O.currentTarget.style.backgroundColor="transparent",O.currentTarget.style.color=b.textTertiary;},disabled:s,children:jsx(X,{className:"w-4 h-4"})})]}),jsxs("form",{onSubmit:U,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=>ae("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:b.textPrimary},placeholder:"Nombre de la tarea",disabled:s,autoFocus:true}),Ee.name&&jsxs("p",{className:"mt-1 text-xs text-red-400 flex items-center gap-1",children:[jsx(AlertCircle,{className:"w-3 h-3"}),Ee.name]})]}),jsx("div",{children:jsx("textarea",{value:H.description||"",onChange:O=>ae("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:b.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:s})}),jsx("div",{style:{borderTop:`1px solid ${b.borderLight}`}}),jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxs("div",{ref:B,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!s&&v(!h),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...Ke,borderColor:Me.color,backgroundColor:`${Me.color}15`},disabled:s,children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:Me.color}}),jsx("span",{style:{color:Me.color},children:Me.title}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:Me.color}})]}),jsx(AnimatePresence,{children:h&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:b.bgPrimary,border:`1px solid ${b.border}`},children:g.map(O=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:b.textPrimary},onMouseEnter:re=>re.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:re=>re.currentTarget.style.backgroundColor="transparent",onClick:()=>{ae("status",O.id),v(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:b.accent}})]},O.id))})})]}),jsxs("div",{ref:$,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!s&&x(!f),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Ke,disabled:s,children:[jsx(Flag,{className:"w-3.5 h-3.5",style:{color:_e.color}}),jsx("span",{children:_e.label}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsx(AnimatePresence,{children:f&&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:b.bgPrimary,border:`1px solid ${b.border}`},children:pi.map(O=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:b.textPrimary},onMouseEnter:re=>re.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:re=>re.currentTarget.style.backgroundColor="transparent",onClick:()=>{ae("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:b.accent}})]},O.id))})})]}),o.length>0&&jsxs("div",{ref:P,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!s&&D(!T),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Ke,disabled:s,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,re)=>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||b.accent,borderColor:b.bgSecondary},children:O.initials},re))}),H.assignees.length>3&&jsxs("span",{style:{color:b.textTertiary},children:["+",H.assignees.length-3]})]}):jsxs(Fragment,{children:[jsx(Users,{className:"w-3.5 h-3.5",style:{color:b.textTertiary}}),jsx("span",{style:{color:b.textTertiary},children:"Asignar"})]}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsx(AnimatePresence,{children:T&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg shadow-xl",style:{backgroundColor:b.bgPrimary,border:`1px solid ${b.border}`},children:o.map(O=>{let re=H.assignees?.some(ce=>ce.name===O.name);return jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:b.textPrimary},onMouseEnter:ce=>ce.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:ce=>ce.currentTarget.style.backgroundColor="transparent",onClick:()=>{let ce=re?(H.assignees||[]).filter(fe=>fe.name!==O.name):[...H.assignees||[],{name:O.name,avatar:O.avatar,initials:O.name.split(" ").map(fe=>fe[0]).join("").toUpperCase().slice(0,2),color:b.accent}];ae("assignees",ce);},children:[jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:b.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:re&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:b.accent}})})]},O.id)})})})]}),jsxs("div",{ref:Q,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>{if(!s)if(I)k(false);else {if(Q.current){let O=Q.current.getBoundingClientRect(),re=window.innerHeight,ce=120,Ae=re-O.bottom<ce?O.top-ce-8:O.bottom+8;N({top:Ae,left:O.left});}k(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Ke,disabled:s,children:[jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:H.color}}),jsx("span",{children:qe.name}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsx(AnimatePresence,{children:I&&jsxs(it,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>k(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${L.top}px`,left:`${L.left}px`,zIndex:99999,backgroundColor:b.bgPrimary,border:`1px solid ${b.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:Tn.slice(0,18).map(O=>{let re=H.color===O.value;return jsx("button",{type:"button",onClick:ce=>{ce.preventDefault(),ce.stopPropagation(),ae("color",O.value),k(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:O.name,children:jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:O.value,outline:re?`2px solid ${O.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},O.value)})})})})]})})]}),u.length>0||c?jsx(ja,{selectedTags:H.tags||[],availableTags:u,onChange:O=>ae("tags",O),onCreateTag:c,theme:b,disabled:s}):null]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Calendar,{className:"w-4 h-4",style:{color:b.textTertiary}}),jsxs("div",{ref:ee,className:"flex items-center gap-2 flex-1 relative",children:[jsx("button",{type:"button",onClick:()=>{if(!s&&!H.isMilestone)if(C==="start")G(null);else {if(ee.current){let O=ee.current.getBoundingClientRect(),re=window.innerHeight,ce=320,Ae=re-O.bottom<ce?O.top-ce-8:O.bottom+8;de({top:Ae,left:O.left});}G("start"),J(H.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...Ke,opacity:H.isMilestone?.5:1,cursor:H.isMilestone?"not-allowed":"pointer"},disabled:s||H.isMilestone,children:H.startDate?H.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsx("span",{style:{color:b.textTertiary},children:"\u2192"}),jsx("button",{type:"button",onClick:()=>{if(!s&&!H.isMilestone)if(C==="end")G(null);else {if(ee.current){let O=ee.current.getBoundingClientRect(),re=window.innerHeight,ce=320,Ae=re-O.bottom<ce?O.top-ce-8:O.bottom+8;de({top:Ae,left:O.left});}G("end"),J(H.endDate||H.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...Ke,opacity:H.isMilestone?.5:1,cursor:H.isMilestone?"not-allowed":"pointer"},disabled:s||H.isMilestone,children:H.endDate?H.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsx(AnimatePresence,{children:C&&jsxs(it,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>G(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:`${K.top}px`,left:`${K.left}px`,zIndex:99999,backgroundColor:b.bgPrimary,border:`1px solid ${b.border}`},onClick:O=>O.stopPropagation(),children:[jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${b.border}`},children:[(()=>{let O=new Date,re=new Date(O);re.setDate(O.getDate()+1);let ce=new Date(O);ce.setDate(O.getDate()+7);let fe=new Date(O);return fe.setDate(O.getDate()+14),[{label:"Hoy",date:O},{label:"Ma\xF1ana",date:re},{label:"Pr\xF3xima semana",date:ce},{label:"2 semanas",date:fe}].map((ot,kt)=>jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:b.textPrimary},onMouseEnter:Le=>Le.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:Le=>Le.currentTarget.style.backgroundColor="transparent",onClick:()=>{C==="start"?(ae("startDate",ot.date),(!H.endDate||ot.date>H.endDate)&&ae("endDate",ot.date),G("end")):(ae("endDate",ot.date),(!H.startDate||ot.date<H.startDate)&&ae("startDate",ot.date),G(null));},children:ot.label},kt))})(),jsx("div",{style:{borderTop:`1px solid ${b.border}`,margin:"0.5rem 0"}}),jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:O=>O.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:O=>O.currentTarget.style.backgroundColor="transparent",onClick:()=>{ae("startDate",void 0),ae("endDate",void 0),G(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:()=>J(new Date(F.getFullYear(),F.getMonth()-1)),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronLeft,{className:"w-4 h-4",style:{color:b.textSecondary}})}),jsx("span",{className:"text-sm font-medium",style:{color:b.textPrimary},children:F.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>J(new Date(F.getFullYear(),F.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronRight,{className:"w-4 h-4",style:{color:b.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((O,re)=>jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:b.textTertiary},children:O},re))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let O=F.getFullYear(),re=F.getMonth(),ce=new Date(O,re,1).getDay(),fe=new Date(O,re+1,0).getDate(),Ae=new Date,ot=[];for(let Le=ce-1;Le>=0;Le--)ot.push({day:new Date(O,re,-Le).getDate(),date:new Date(O,re-1,new Date(O,re,-Le).getDate()),isCurrentMonth:false});for(let Le=1;Le<=fe;Le++)ot.push({day:Le,date:new Date(O,re,Le),isCurrentMonth:true});let kt=42-ot.length;for(let Le=1;Le<=kt;Le++)ot.push({day:Le,date:new Date(O,re+1,Le),isCurrentMonth:false});return ot.map((Le,ke)=>{let Ie=Le.date.toDateString()===Ae.toDateString(),Zt=H.startDate?.toDateString()===Le.date.toDateString(),vt=H.endDate?.toDateString()===Le.date.toDateString(),sa=H.startDate&&H.endDate&&Le.date>=H.startDate&&Le.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:Le.isCurrentMonth?Zt||vt?"#FFF":b.textPrimary:b.textTertiary,backgroundColor:Zt?"#3B82F6":vt?"#7C3AED":sa?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Ie&&!Zt&&!vt?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{C==="start"?(ae("startDate",Le.date),H.endDate&&Le.date>H.endDate&&ae("endDate",Le.date),G("end")):(ae("endDate",Le.date),H.startDate&&Le.date<H.startDate&&ae("startDate",Le.date),G(null));},children:Le.day},ke)})})()})]})]})]})})]}),Ee.endDate&&jsx("span",{className:"text-xs text-red-400",children:Ee.endDate})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:"w-4 h-4",style:{color:b.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=>ae("progress",parseInt(O.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:b.bgSecondary,accentColor:H.progress<30?"#EF4444":H.progress<70?"#F59E0B":"#10B981"},disabled:s}),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:()=>Te(!ge),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:b.textTertiary},children:[jsx(ChevronDown,{className:`w-3 h-3 transition-transform ${ge?"rotate-180":""}`}),"Opciones avanzadas"]}),jsx(AnimatePresence,{children:ge&&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:[(i||d.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:b.textTertiary},children:jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxs("span",{className:"text-xs",style:{color:b.textTertiary},children:["Adjuntos ",p==="create"?Ce.length>0&&`(${Ce.length})`:d.length>0&&`(${d.length})`]})]}),p==="create"?jsx(qa,{cardId:"pending",attachments:Ce.map((O,re)=>({id:`pending-${re}`,cardId:"pending",name:O.name,size:O.size,type:O.type,url:URL.createObjectURL(O),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:O=>z(re=>[...re,...O]),onDelete:O=>{let re=parseInt(O.replace("pending-",""),10);z(ce=>ce.filter((fe,Ae)=>Ae!==re));},maxSizeMB:10,maxFiles:20}):jsx(qa,{cardId:a?.id||"new",attachments:d,onUpload:i&&a?.id?O=>i(a.id,O):void 0,onDelete:w,maxSizeMB:10,maxFiles:20}),p==="create"&&Ce.length>0&&jsxs("p",{className:"text-xs mt-1",style:{color:b.textTertiary},children:[Ce.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=>ae("isMilestone",O.target.checked),className:"w-4 h-4 rounded",style:{accentColor:b.accent},disabled:s}),jsx(Milestone,{className:"w-4 h-4 text-yellow-500"}),jsx("span",{className:"text-sm",style:{color:b.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxs("div",{children:[jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:b.textTertiary},children:[jsx(Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),jsx("div",{className:"flex flex-wrap gap-1.5 max-h-24 overflow-y-auto p-2 rounded-lg",style:{backgroundColor:b.bgSecondary},children:r.filter(O=>O.id!==a?.id).map(O=>{let re=H.dependencies?.includes(O.id);return jsx("button",{type:"button",onClick:()=>{let ce=re?(H.dependencies||[]).filter(fe=>fe!==O.id):[...H.dependencies||[],O.id];ae("dependencies",ce);},className:"px-2 py-1 rounded-full text-xs transition-colors",style:{backgroundColor:re?`${b.accent}30`:b.bgPrimary,color:re?b.accent:b.textSecondary,border:`1px solid ${re?b.accent:b.borderLight}`},disabled:s,children:O.name},O.id)})})]})]})})})]})]}),jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${b.border}`},children:[jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:b.textSecondary},onMouseEnter:O=>O.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:O=>O.currentTarget.style.backgroundColor="transparent",disabled:s,children:"Cancelar"}),jsx("button",{type:"submit",disabled:s,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:b.accent,color:"#FFF"},onMouseEnter:O=>!s&&(O.currentTarget.style.opacity="0.9"),onMouseLeave:O=>!s&&(O.currentTarget.style.opacity="1"),children:s?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 d0=['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"'],sc=()=>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"})]}),c0=()=>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"})}),p0=()=>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"})}),m0=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M5 12h14"})}),u0=()=>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 Nn({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:n,onTaskDelete:s,onDependencyCreate:p,onDependencyDelete:m}){let[l,u]=useState(false),[c,d]=useState(false),[i,w]=useState([]),[g,b]=useState(""),[h,v]=useState(false),[f,x]=useState(true),T=useRef(null),D=useRef(null),I=useRef(null),{enabled:k=true,placeholder:L='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:N="bottom-right",onCommand:C,suggestions:G=d0,maxHistory:F=50,persistHistory:J}=a,K=J?.storageKey||"gantt-ai-history",de=J?.maxMessages??5;useEffect(()=>{if(J?.enabled)try{let $=localStorage.getItem(K);if($){let Q=JSON.parse($).map(ee=>({...ee,timestamp:new Date(ee.timestamp)}));w(Q.slice(-de));}}catch($){console.warn("[GanttAIAssistant] Failed to load persisted history:",$);}},[J?.enabled,K,de]),useEffect(()=>{if(J?.enabled&&i.length>0)try{let $=i.filter(P=>!P.isLoading).slice(-de);localStorage.setItem(K,JSON.stringify($));}catch($){console.warn("[GanttAIAssistant] Failed to persist history:",$);}},[i,J?.enabled,K,de]),useEffect(()=>{D.current&&D.current.scrollIntoView({behavior:"smooth"});},[i]),useEffect(()=>{l&&!c&&T.current&&setTimeout(()=>T.current?.focus(),100);},[l,c]);let ge=useCallback($=>{if($.success)switch($.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":$.taskId&&$.updates&&o?.($.taskId,$.updates);break;case "create_task":$.newTask&&n?.($.newTask);break;case "delete_task":$.taskId&&s?.($.taskId);break;case "link_tasks":$.dependencyFrom&&$.dependencyTo&&p?.($.dependencyFrom,$.dependencyTo);break;case "unlink_tasks":$.taskId&&$.dependencyFrom&&m?.($.taskId,$.dependencyFrom);break}},[o,n,s,p,m]),Te=useCallback(async $=>{if(!$.trim()||h)return;let P={id:`user-${Date.now()}`,role:"user",content:$,timestamp:new Date};w(ee=>[...ee.slice(-(F-1)),P]),b(""),x(false),v(true);let Q={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};w(ee=>[...ee,Q]);try{if(C){let ee=await C($,e);w(H=>{let De=H.filter(Be=>!Be.isLoading),Ee={id:`assistant-${Date.now()}`,role:"assistant",content:ee.message,timestamp:new Date,command:ee};return [...De,Ee]}),ge(ee);}else w(ee=>[...ee.filter(De=>!De.isLoading),{id:`assistant-${Date.now()}`,role:"assistant",content:"AI handler not configured. Please provide an onCommand handler in the aiAssistant config.",timestamp:new Date}]);}catch(ee){w(H=>[...H.filter(Ee=>!Ee.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${ee instanceof Error?ee.message:"Unknown error"}`,timestamp:new Date}]);}finally{v(false);}},[h,F,C,e,ge]),Ce=$=>{$.preventDefault(),Te(g);},z=$=>{b($),T.current?.focus();};if(useEffect(()=>{let $=P=>{(P.metaKey||P.ctrlKey)&&P.key==="k"&&(P.preventDefault(),u(Q=>!Q),l||d(false)),P.key==="Escape"&&l&&u(false);};return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[l]),useEffect(()=>{if(!l)return;let $=Q=>{let ee=Q.target;I.current&&!I.current.contains(ee)&&u(false);},P=setTimeout(()=>{document.addEventListener("mousedown",$);},100);return ()=>{clearTimeout(P),document.removeEventListener("mousedown",$);}},[l]),!k)return null;let B={"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(it,{children:[jsx(AnimatePresence,{children:!l&&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 ${B[N]} 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(sc,{}),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:l&&jsxs(motion.div,{ref:I,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:c?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${B[N]} 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(sc,{}),jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>d($=>!$),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsx(m0,{})}),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(p0,{})})]})]}),jsx(AnimatePresence,{children:!c&&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:[i.length===0&&f&&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:G.slice(0,4).map(($,P)=>jsx("button",{onClick:()=>z($),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:$.length>30?$.slice(0,30)+"...":$},P))})]}),i.map($=>jsx(motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${$.role==="user"?"justify-end":"justify-start"}`,children:jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${$.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:$.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:$.role==="user"?"white":t.textPrimary},children:[$.isLoading?jsx(u0,{}):jsx("p",{className:"text-sm whitespace-pre-wrap",children:$.content}),$.command&&jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:$.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:$.command.success?"#10B981":"#EF4444"},children:[$.command.success?"\u2713":"\u2717",jsx("span",{className:"capitalize",children:$.command.type.replace(/_/g," ")})]})]})},$.id)),jsx("div",{ref:D})]}),jsxs("form",{onSubmit:Ce,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:T,type:"text",value:g,onChange:$=>b($.target.value),placeholder:L,disabled:h,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsx("button",{type:"submit",disabled:!g.trim()||h,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:g.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:g.trim()?"white":t.textSecondary},children:jsx(c0,{})})]}),jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function ic(e,t=50){let[a,r]=useState({past:[],present:e,future:[]}),o=useRef(false),n=useCallback((l,u=true)=>{r(c=>{let d=typeof l=="function"?l(c.present):l;if(o.current)return {...c,present:d};if(!u)return {...c,present:d};let i=[...c.past,c.present];return i.length>t&&i.shift(),{past:i,present:d,future:[]}});},[t]),s=useCallback(()=>{r(l=>{if(l.past.length===0)return l;let u=l.past[l.past.length-1],c=l.past.slice(0,l.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:c,present:u,future:[l.present,...l.future]}});},[]),p=useCallback(()=>{r(l=>{if(l.future.length===0)return l;let u=l.future[0],c=l.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...l.past,l.present],present:u,future:c}});},[]),m=useCallback(()=>{r(l=>({past:[],present:l.present,future:[]}));},[]);return {state:a.present,setState:n,undo:s,redo:p,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:m}}function lc({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){useEffect(()=>{if(!o)return;let n=s=>{let p=navigator.platform.toUpperCase().indexOf("MAC")>=0,m=p?s.metaKey:s.ctrlKey;if(m&&s.key==="z"&&!s.shiftKey&&a){s.preventDefault(),e();return}if(r){if(!p&&m&&s.key==="y"){s.preventDefault(),t();return}if(p&&m&&s.shiftKey&&s.key==="z"){s.preventDefault(),t();return}}};return window.addEventListener("keydown",n),()=>{window.removeEventListener("keydown",n);}},[e,t,a,r,o]);}var b0={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${pe.formatDate(e.startDate)} - ${pe.formatDate(e.endDate)}`);let a=pe.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=>pe.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function dc(e){return {...b0,...e}}var T0=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},mc=forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:n,timeScale:s="week",rowDensity:p="comfortable",showThemeSelector:m=true,showExportButton:l=true,availableUsers:u=[],templates:c,enableAutoCriticalPath:d=true,persistExpandedState:i,aiAssistant:w,locale:g="en",customTranslations:b,showCreateTaskButton:h=false,createTaskLabel:v,onCreateTask:f,onThemeChange:x,onTaskClick:T,onTaskDblClick:D,onTaskContextMenu:I,onTaskUpdate:k,onProgressChange:L,onTaskEdit:N,onTaskAddSubtask:C,onTaskMarkIncomplete:G,onTaskSetInProgress:F,onDependencyCreate:J,onDependencyDelete:K,onBeforeTaskAdd:de,onAfterTaskAdd:ge,onBeforeTaskUpdate:Te,onAfterTaskUpdate:Ce,onBeforeTaskDelete:z,onAfterTaskDelete:B}=a,P=useContext(dn)?.theme,[Q,ee]=useState(P||n||"dark"),[H,De]=useState(s),[Ee,Be]=useState(p),[xe,U]=useState(1),[ae,Me]=useState(0),[_e,qe]=useState(false),[Ke,O]=useState(null),[re,ce]=useState({isOpen:false,x:0,y:0,task:null}),[fe,Ae]=useState(null),[ot,kt]=useState(null);useEffect(()=>{P&&P!==Q&&ee(P);},[P]),useEffect(()=>{n&&n!==Q&&ee(n);},[n]);let Le=useCallback(S=>{ee(S),x?.(S);},[x]),{state:ke,setState:Ie,undo:Zt,redo:vt,canUndo:sa,canRedo:Na,clearHistory:Oe}=ic(t,50),Ue=useCallback(()=>i?typeof i=="string"?i:"gantt-expanded-tasks":null,[i]),qt=useRef(new Map),he=useRef(false);if(!he.current&&i){he.current=true;let S=typeof i=="string"?i:"gantt-expanded-tasks";try{let E=localStorage.getItem(S);if(E){let V=JSON.parse(E);Array.isArray(V)&&(qt.current=new Map(V));}}catch(E){console.warn("[GanttBoard] Error loading expanded state from localStorage:",E);}}let Ge=useCallback(()=>{let S=Ue();if(S)try{let E=Array.from(qt.current.entries());localStorage.setItem(S,JSON.stringify(E));}catch(E){console.warn("[GanttBoard] Error saving expanded state to localStorage:",E);}},[Ue]);useEffect(()=>{let S=E=>E.map(V=>{let oe=qt.current.get(V.id),me=oe!==void 0?{...V,isExpanded:oe}:V;return me.subtasks?.length?{...me,subtasks:S(me.subtasks)}:me});qt.current.size>0?Ie(S(t)):Ie(t);},[t,Ie]);let Fe=useRef(t),tt=useRef(true);useEffect(()=>{if(tt.current){tt.current=false,Fe.current=ke;return}if(!r)return;let S=JSON.stringify(Fe.current),E=JSON.stringify(ke);S!==E&&(Fe.current=ke,r(ke));},[ke,r]);let Xe=useMemo(()=>Ys(g,b),[g,b]),wt=useCallback(S=>[{id:"name",label:S.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:S.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:S.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:S.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:S.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:S.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:S.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:S.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[st,Qe]=useState(()=>wt(Xe));useEffect(()=>{Qe(S=>S.map(E=>({...E,label:Xe.columns[E.id==="name"?"taskName":E.id]||E.label})));},[Xe]);let A=useMemo(()=>st.filter(E=>E.visible).reduce((E,V)=>E+V.width,0),[st]),ue=useRef(st.filter(S=>S.visible).map(S=>S.id).join(","));useEffect(()=>{let S=st.filter(oe=>oe.visible),E=S.map(oe=>oe.id).join(","),V=ue.current;if(E!==V){let oe=S.some(Se=>Se.id!=="name"),me=V.includes(",");oe?!me&&oe&&O(null):O(null),ue.current=E;}},[st]);let _=60,Z=.6,ve=useMemo(()=>{let E=A+_,V=typeof window<"u"?window.innerWidth*Z:800,oe=Math.max(E,V);return Ke!==null?Math.max(200,Math.min(Ke,oe)):Math.max(200,E)},[Ke,A]),Y=useRef(null),ne=useRef(null),R=useRef(null),W=useMemo(()=>Sd(Q),[Q]),Ne=useMemo(()=>({theme:W,themeName:Q}),[W,Q]),et=useMemo(()=>dc(c),[c]),$e=useMemo(()=>{if(!d)return ke;let S=pe.calculateCriticalPath(ke),E=V=>V.map(oe=>({...oe,isCriticalPath:S.includes(oe.id),subtasks:oe.subtasks?E(oe.subtasks):void 0}));return E(ke)},[ke,d]),mt=T0(Ee);lc({undo:Zt,redo:vt,canUndo:sa,canRedo:Na,enabled:true}),useImperativeHandle(o,()=>({getTask:S=>pe.findTaskById(ke,S),addTask:(S,E)=>{Ie(V=>{if(!E)return [...V,{...S,level:0}];let oe=me=>me.map(Se=>Se.id===E?{...Se,subtasks:[...Se.subtasks||[],{...S,parentId:E,level:(Se.level||0)+1}],isExpanded:true}:Se.subtasks?{...Se,subtasks:oe(Se.subtasks)}:Se);return oe(V)});},updateTask:(S,E)=>{Ie(V=>{let oe=me=>me.map(Se=>Se.id===S?{...Se,...E}:Se.subtasks?{...Se,subtasks:oe(Se.subtasks)}:Se);return oe(V)});},deleteTask:S=>{Ie(E=>{let V=oe=>oe.filter(me=>me.id===S?false:(me.subtasks&&(me.subtasks=V(me.subtasks)),true));return V(E)});},deleteTasks:S=>{Ie(E=>ti(E,S));},duplicateTask:S=>{Ie(E=>ai(E,[S]));},splitTask:(S,E,V=3)=>{Ie(oe=>pe.splitTask(oe,S,E,V));},calculateEndDate:pe.calculateEndDate,calculateDuration:pe.calculateDuration,validateDependency:(S,E)=>!pe.validateDependencies(ke,S,E),getAllTasks:()=>pe.flattenTasks(ke),getTasksByStatus:S=>pe.flattenTasks(ke).filter(E=>E.status===S),getTasksByParent:S=>S?pe.findTaskById(ke,S)?.subtasks||[]:ke.filter(V=>!V.parentId),getCriticalPath:()=>pe.flattenTasks(ke).filter(S=>S.isCriticalPath),indentTask:S=>{Ie(E=>Zs(E,[S]));},outdentTask:S=>{Ie(E=>Qs(E,[S]));},moveTask:(S,E)=>{Ie(V=>ei(V,[S],E));},createSubtask:async S=>{let{tasks:E,newTask:V}=ni(ke,S);if(de){let oe=de({...V,parentId:S});if((oe instanceof Promise?await oe:oe)===false)return}Ie(E),ge&&ge({...V,parentId:S});},scrollToTask:S=>{let V=pe.flattenTasks(ke).findIndex(oe=>oe.id===S);if(V!==-1&&Y.current){let oe=V*mt;Y.current.scrollTo({top:oe,behavior:"smooth"}),ne.current&&ne.current.scrollTo({top:oe,behavior:"smooth"});}},highlightTask:(S,E=2e3)=>{},expandTask:S=>{Ie(E=>{let V=oe=>oe.map(me=>me.id===S?{...me,isExpanded:true}:me.subtasks?{...me,subtasks:V(me.subtasks)}:me);return V(E)});},collapseTask:S=>{Ie(E=>{let V=oe=>oe.map(me=>me.id===S?{...me,isExpanded:false}:me.subtasks?{...me,subtasks:V(me.subtasks)}:me);return V(E)});},expandAll:()=>{Ie(S=>{let E=V=>V.map(oe=>({...oe,isExpanded:true,subtasks:oe.subtasks?E(oe.subtasks):void 0}));return E(S)});},collapseAll:()=>{Ie(S=>{let E=V=>V.map(oe=>({...oe,isExpanded:false,subtasks:oe.subtasks?E(oe.subtasks):void 0}));return E(S)});},undo:Zt,redo:vt,canUndo:()=>sa,canRedo:()=>Na,clearHistory:Oe,exportToPNG:async()=>{if(!R.current||!Y.current||!ne.current)throw new Error("Gantt container not found");let S=R.current,E=Y.current.querySelector(".gantt-grid-scroll"),V=ne.current,oe=E?.scrollTop||0,me=V.scrollTop,Se=S.style.overflow,gt=S.style.height;try{let Ht=E?.querySelector(".gantt-taskgrid-content"),ia=V.querySelector("svg"),la=Ht?.scrollHeight||E?.scrollHeight||600,ba=ia?.getBoundingClientRect().height||V.scrollHeight,Dr=(S.querySelector('[class*="h-12"]')?.offsetHeight||48)+Math.max(la,ba)+20;E&&(E.scrollTop=0),V.scrollTop=0,S.style.overflow="visible",S.style.height=`${Dr}px`,await new Promise(cr=>setTimeout(cr,100));let dr=await pc(S,{backgroundColor:W.bgPrimary,scale:2,logging:!1,useCORS:!0,ignoreElements:cr=>{let jr=window.getComputedStyle(cr),Nr=parseInt(jr.zIndex,10);return !isNaN(Nr)&&Nr>=50||jr.position==="fixed"}});return new Promise((cr,jr)=>{dr.toBlob(Nr=>{Nr?cr(Nr):jr(new Error("Failed to create blob from canvas"));},"image/png");})}finally{S.style.overflow=Se,S.style.height=gt,E&&(E.scrollTop=oe),V.scrollTop=me;}},exportToPDF:async S=>{await pe.exportToPDF(ke,S);},exportToExcel:async S=>{await pe.exportToExcel(ke,S);},exportToJSON:()=>pe.exportToJSON(ke),exportToCSV:()=>pe.exportToCSV(ke),importFromJSON:S=>{let E=pe.importFromJSON(S);Ie(E);},getTasks:()=>ke,refresh:()=>{Ie(S=>[...S]);},clearAll:()=>{Ie([]);}}),[ke,Zt,vt,sa,Na,Oe,W,mt]);let Re=useCallback(S=>{Qe(E=>E.map(V=>V.id===S?{...V,visible:!V.visible}:V));},[]),ut=useCallback((S,E)=>{Qe(V=>V.map(oe=>{if(oe.id!==S)return oe;let me=oe.minWidth??100,Se=oe.maxWidth??800,gt=Math.max(me,Math.min(Se,E));return {...oe,width:gt}}));},[]),$t=useCallback(S=>{Ie(E=>{let V=oi(E,S),oe=me=>{for(let Se of me){if(Se.id===S){qt.current.set(S,Se.isExpanded??true);return}Se.subtasks?.length&&oe(Se.subtasks);}};return oe(V),Ge(),V}),a.onTaskToggleExpand?.(S);},[a,Ge]),se=useCallback((S,E)=>{if(Te&&Te(S,E)===false)return;let oe=pe.findTaskById(ke,S)?.progress,me=gt=>gt.map(Ht=>Ht.id===S?{...Ht,...E}:Ht.subtasks?{...Ht,subtasks:me(Ht.subtasks)}:Ht);Ie(me(ke));let Se=pe.findTaskById(me(ke),S);Se&&(k?.(Se),Ce?.(Se),E.progress!==void 0&&oe!==void 0&&E.progress!==oe&&L?.(S,oe,E.progress));},[ke,k,Te,Ce,L]),Mt=useCallback(S=>{S.length!==0&&(Ie(E=>Zs(E,S)),a.onTaskIndent?.(S[0]));},[a]),aa=useCallback(S=>{S.length!==0&&(Ie(E=>Qs(E,S)),a.onTaskOutdent?.(S[0]));},[a]),_r=useCallback((S,E,V)=>{Ie(oe=>Kd(oe,S,E,V)),a.onTaskReparent?.(S,E,V);},[a]),Ho=useCallback((S,E)=>{S.length!==0&&(Ie(V=>ei(V,S,E)),a.onTaskMove?.(S[0],E));},[a]),ir=useCallback(async S=>{let E=[];for(let V of S)z&&await Promise.resolve(z(V))===false||E.push(V);E.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(E):(Ie(V=>ti(V,E)),E.forEach(V=>a.onTaskDelete?.(V))),B&&E.forEach(V=>B(V)));},[a,z,B]),Qa=useCallback(S=>{Ie(E=>ai(E,S)),S.forEach(E=>a.onTaskDuplicate?.(E));},[a]),Tr=useCallback((S,E)=>{Ie(V=>{let{tasks:oe,newTask:me}=jd(V,S,E);return de&&de(me)===false?V:(a.onTaskCreate?.(me.parentId,me.position||0),ge?.(me),oe)});},[a,de,ge]),Ut=useCallback((S,E)=>{Ie(V=>ri(V,S,E)),a.onTaskRename?.(S,E);},[a]),uo=useCallback(S=>{Ie(E=>{let{tasks:V}=ni(E,S);return a.onTaskCreate?.(S,0),V});},[a]),jn=useCallback((S,E,V)=>{let oe=S.startDate?Math.round((E.getTime()-S.startDate.getTime())/864e5):0,me=Ht=>Ht.map(ia=>ia.id===S.id?{...ia,startDate:E,endDate:V,...S.segments&&{segments:S.segments}}:ia.subtasks?{...ia,subtasks:me(ia.subtasks)}:ia),Se=me(ke);Se=pe.autoScheduleDependents(Se,S.id,oe),Ie(Se);let gt={...S,startDate:E,endDate:V};k?.(gt);},[ke,k]),sl=useCallback((S,E)=>{I?.(S,E),ce({isOpen:true,x:E.clientX,y:E.clientY,task:S});},[I]),go=useCallback((S,E)=>{let V=pe.splitTask(ke,S.id,E);Ie(V),ce({isOpen:false,x:0,y:0,task:null});},[ke]),il=useCallback(S=>{let E=pe.findTaskById(ke,S.id)||S;D?.(E),N||Ae(E);},[ke,D,N]),ll=useCallback((S,E,V)=>{let oe=new Map,me=la=>{la.forEach(ba=>{ba.dependencies&&oe.set(ba.id,ba.dependencies),ba.subtasks&&me(ba.subtasks);});};me(V);let Se=oe.get(E)||[];oe.set(E,[...Se,S]);let gt=new Set,Ht=new Set,ia=la=>{if(!gt.has(la)){gt.add(la),Ht.add(la);let ba=oe.get(la)||[];for(let lr of ba){if(!gt.has(lr)&&ia(lr))return true;if(Ht.has(lr))return true}}return Ht.delete(la),false};return ia(E)},[]),dl=useCallback((S,E)=>{if(ll(S.id,E,ke)){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=me.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?me.calculateDuration(i.startDate,i.endDate):0,d=0;if(i.dependencies&&i.dependencies.length>0)for(let h of i.dependencies){let b=t.find(m=>m.id===h);if(b){o(b);let m=r.get(h)?.ef||0;d=Math.max(d,m);}}let l=d+u;r.set(i.id,{es:d,ef:l});};a.forEach(o);let n=Math.max(...Array.from(r.values()).map(i=>i.ef)),s=new Map,c=i=>{if(s.has(i.id))return;let u=i.startDate&&i.endDate?me.calculateDuration(i.startDate,i.endDate):0,d=t.filter(b=>b.dependencies&&b.dependencies.includes(i.id)),l=n;if(d.length>0)for(let b of d){c(b);let m=s.get(b.id)?.ls||0;l=Math.min(l,m);}let h=l-u;s.set(i.id,{ls:h,lf:l});};a.forEach(c);let p=[];for(let i of a){let u=r.get(i.id),d=s.get(i.id);if(u&&d){let l=d.ls-u.es;Math.abs(l)<.01&&p.push(i.id);}}return p},calculateSlack:(e,t)=>{let a=me.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(me.calculateCriticalPath(e).includes(t))return 0;let o=me.getDependentTasks(e,t);if(o.length===0){let c=me.getLatestEndDate(e);if(!c)return null;let p=me.calculateDuration(a.endDate,c);return Math.max(0,p)}let n=o.filter(c=>c.startDate).map(c=>c.startDate.getTime()).sort((c,p)=>c-p)[0];if(!n)return null;let s=me.calculateDuration(a.endDate,new Date(n));return Math.max(0,s)},isOnCriticalPath:(e,t)=>me.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=me.findTaskById(e,t);if(!r||!r.endDate)return e;let o=me.getDependentTasks(e,t);if(o.length===0)return e;let n=[...e];for(let s of o){if(!s.startDate||!s.endDate)continue;let c=me.calculateDuration(s.startDate,s.endDate),p;a!==void 0?(p=new Date(s.startDate),p.setDate(p.getDate()+a)):(p=new Date(r.endDate),p.setDate(p.getDate()+1));let i=me.calculateEndDate(p,c),u=d=>d.map(l=>l.id===s.id?{...l,startDate:p,endDate:i}:l.subtasks?{...l,subtasks:u(l.subtasks)}:l);n=u(n),n=me.autoScheduleDependents(n,s.id,a);}return n},calculateCascadePreview:(e,t,a,r,o,n,s,c)=>{if(a===0)return [];let p=[],i=o.getTime(),u=1e3*60*60*24,d=me.findTaskById(e,t);if(!d||!d.endDate)return [];let l=(h,b,m=new Set)=>{if(m.has(h))return;m.add(h);let v=me.getDependentTasks(e,h);for(let w of v){if(!w.startDate||!w.endDate)continue;let g=r.findIndex(C=>C.id===w.id);if(g===-1)continue;let f=w.startDate.getTime(),N=(w.endDate.getTime()-f)/u,I=(f-i)/u*n,k=I+b*n,$=Math.max(N*n,n),S=c+g*s+12;p.push({taskId:w.id,taskName:w.name,originalX:I,previewX:k,width:$,y:S,rowIndex:g,daysDelta:b,color:w.color}),l(w.id,b,m);}};return l(t,a),p},splitTask:(e,t,a,r=3)=>{let o=me.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 n=new Date(a);n.setDate(n.getDate()-1);let s=new Date(a);s.setDate(s.getDate()+r);let c=new Date(o.endDate);c.setDate(c.getDate()+r);let p=[{startDate:new Date(o.startDate),endDate:n},{startDate:s,endDate:c}],i=u=>u.map(d=>d.id===o.id?{...d,endDate:c,segments:p}:d.subtasks?{...d,subtasks:i(d.subtasks)}:d);return i(e)}};function Dn({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:n,zoom:s,templates:c,onTaskClick:p,onTaskDblClick:i,onTaskContextMenu:u,onTaskDateChange:d,onDependencyCreate:l,onDependencyDelete:h}){let[m,v]=useState([]),[w,g]=useState(null),[f,x]=useState(null),N=useCallback(z=>{g(z);},[]),D=Math.ceil((n.getTime()-o.getTime())/(1e3*60*60*24)),I=r==="day"?60:r==="week"?20:8,k=D*I*s,$=z=>{let L=new Date(Date.UTC(z.getFullYear(),z.getMonth(),z.getDate())),W=L.getUTCDay()||7;L.setUTCDate(L.getUTCDate()+4-W);let E=new Date(Date.UTC(L.getUTCFullYear(),0,1));return Math.ceil(((L.getTime()-E.getTime())/864e5+1)/7)},S=z=>{let L=z.getDay();return L===0||L===6},C=useCallback(z=>{let L=Math.round(z/(I*s)),W=new Date(o);return W.setDate(W.getDate()+L),W},[o,I,s]),H=useCallback((z,L)=>{if(L.startDate&&L.endDate)return;let W=z.currentTarget.ownerSVGElement;if(!W)return;let E=W.createSVGPoint();E.x=z.clientX,E.y=z.clientY;let q=E.matrixTransform(W.getScreenCTM()?.inverse()),Z=C(q.x),U=new Date(Z);U.setDate(U.getDate()+1),d?.(L,Z,U);},[C,d]),B=useMemo(()=>{let z=q=>q.map(Z=>{if(Z.subtasks&&Z.subtasks.length>0){let U=z(Z.subtasks),ke=U.filter(Ne=>Ne.startDate&&Ne.endDate);if(ke.length>0){let Ne=ke.map(Ie=>Ie.startDate.getTime()),Fe=ke.map(Ie=>Ie.endDate.getTime()),ye=new Date(Math.min(...Ne)),tt=new Date(Math.max(...Fe));return {...Z,subtasks:U,startDate:ye,endDate:tt}}return {...Z,subtasks:U}}return Z}),L=(q,Z=[])=>{for(let U of q)Z.push(U),U.subtasks&&U.subtasks.length>0&&(U.isExpanded===void 0||U.isExpanded)&&L(U.subtasks,Z);return Z},W=z(e);return L(W)},[e]),J=useCallback(z=>{if(!z.startDate||!z.endDate)return {x:0,width:0};let L=z.startDate.getTime(),W=z.endDate.getTime(),E=o.getTime(),q=(L-E)/(1e3*60*60*24),Z=(W-L)/(1e3*60*60*24),U=q*I*s,ke=Math.max(I*s,40),Ne=Math.max(Z*I*s,ke);return {x:U,width:Ne}},[o,I,s]),ne=useMemo(()=>B.filter(z=>z.startDate&&z.endDate).map(z=>{let{x:L,width:W}=J(z),q=B.findIndex(Z=>Z.id===z.id)*a+12;return {id:z.id,x:L,y:q,width:W,height:32}}),[B,J]),xe=useCallback((z,L,W)=>{if(!W||L===0){v([]);return}let E=me.calculateCascadePreview(e,z,L,B,o,I*s,a,48);v(E);},[e,B,o,I,s,a,48]),Pe=useMemo(()=>{let z=[],L=new Date(o);for(;L<=n;){let q=(L.getTime()-o.getTime())/864e5*I*s;if(r==="day")z.push({date:new Date(L),label:L.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:q}),L.setDate(L.getDate()+1);else if(r==="week"){let Z=$(L);z.push({date:new Date(L),label:`Week ${Z}`,x:q}),L.setDate(L.getDate()+7);}else z.push({date:new Date(L),label:L.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:q}),L.setMonth(L.getMonth()+1);}return z},[o,n,r,I,s]),Re=useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*I*s,[o,I,s]),le=Math.max(B.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}),Pe.map((z,L)=>jsxs("g",{children:[L>0&&jsx("line",{x1:z.x,y1:0,x2:z.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsx("text",{x:z.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:z.label})]},`header-${L}`)),Re>=0&&Re<=k&&jsx("circle",{cx:Re,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxs("svg",{width:Math.max(k,1e3),height:le,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:le,fill:t.bgPrimary}),Pe.map((z,L)=>{let W=Pe[L+1]?.x||k,E=S(z.date);return jsxs("g",{children:[E&&jsx("rect",{x:z.x,y:0,width:W-z.x,height:B.length*a,fill:t.bgWeekend,opacity:1}),L>0&&jsx("line",{x1:z.x,y1:0,x2:z.x,y2:B.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},L)}),B.map((z,L)=>{let W=z.startDate&&z.endDate;return jsxs("g",{children:[jsx("rect",{x:0,y:L*a,width:k,height:a,fill:L%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-${z.id}`),!W&&jsxs(Fragment,{children:[jsx("rect",{x:0,y:L*a,width:k,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:E=>H(E,z),onMouseEnter:E=>{E.currentTarget.setAttribute("fill",t.accentLight),E.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:E=>{E.currentTarget.setAttribute("fill","transparent"),E.currentTarget.setAttribute("opacity","1");}},`clickable-${z.id}`),jsx("text",{x:Re>0?Re:100,y:L*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-${z.id}`)]})]},`row-group-${z.id}`)}),B.map((z,L)=>!z.dependencies||z.dependencies.length===0||!z.startDate||!z.endDate?null:z.dependencies.map(W=>{let E=B.find(ke=>ke.id===W);if(!E||!E.startDate||!E.endDate)return null;let q=B.findIndex(ke=>ke.id===W),Z=J(E),U=J(z);return jsx(wn,{x1:Z.x+Z.width,y1:q*a+a/2,x2:U.x,y2:L*a+a/2,theme:t},`dep-${W}-${z.id}`)})),B.map((z,L)=>{if(!z.startDate||!z.endDate)return null;let{x:W,width:E}=J(z),q=L*a+12,Z=z.subtasks&&z.subtasks.length>0&&!z.isMilestone;return z.isMilestone?jsx(Tn,{task:z,x:W+E/2,y:q+16,theme:t,onClick:p},z.id):Z?jsxs("g",{onClick:()=>p?.(z),onContextMenu:U=>{U.preventDefault(),U.stopPropagation(),u?.(z,U);},style:{cursor:"default"},children:[jsx("rect",{x:W,y:q,width:E,height:32,fill:t.primary,opacity:.25,rx:6}),jsx("line",{x1:W,y1:q,x2:W+E,y2:q,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsx("line",{x1:W,y1:q,x2:W,y2:q+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsx("line",{x1:W+E,y1:q,x2:W+E,y2:q+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsx("line",{x1:W,y1:q+32,x2:W+E,y2:q+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),E>60&&jsx("text",{x:W+12,y:q+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:z.name})]},z.id):jsx(vn,{task:z,x:W,y:q,width:E,theme:t,dayWidth:I*s,startDate:o,templates:c,onClick:p,onDoubleClick:i,onContextMenu:u,onDateChange:d,onDependencyCreate:l,allTaskPositions:ne,onDragMove:xe,onHoverChange:N},z.id)}),B.map((z,L)=>!z.dependencies||z.dependencies.length===0||!z.startDate||!z.endDate?null:z.dependencies.map(W=>{let E=B.find(ae=>ae.id===W);if(!E||!E.startDate||!E.endDate)return null;let q=B.findIndex(ae=>ae.id===W),Z=J(E),U=J(z),ke=Z.x+Z.width,Ne=q*a+a/2,Fe=U.x,ye=L*a+a/2,tt=Fe-ke,Ie=ke+tt/2,st=ae=>{let ge=1-ae,Se=ge*ge,Ke=Se*ge,yt=ae*ae,Be=yt*ae,pe=Ke*ke+3*Se*ae*Ie+3*ge*yt*Ie+Be*Fe,Ee=Ke*Ne+3*Se*ae*Ne+3*ge*yt*ye+Be*ye;return {x:pe,y:Ee}},it=20,dt=[];for(let ae=0;ae<=it;ae++){let ge=.1+ae/it*.8;dt.push(st(ge));}let O=dt[0],F=`M ${O.x} ${O.y} `+dt.slice(1).map(ae=>`L ${ae.x} ${ae.y}`).join(" ");return f&&f.x1===ke&&f.y1===Ne&&f.x2===Fe&&f.y2===ye?null:jsx("path",{d:F,fill:"none",stroke:"transparent",strokeWidth:12,strokeLinecap:"round",style:{cursor:"pointer"},onMouseEnter:()=>{x({x1:ke,y1:Ne,x2:Fe,y2:ye,onDelete:()=>h?.(z.id,W)});}},`dep-hover-${W}-${z.id}`)})),m.map(z=>jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:z.previewX,y:z.y-48,width:z.width,height:32,rx:8,fill:z.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(z.daysDelta)>0&&jsx("text",{x:z.previewX+z.width/2,y:z.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:z.daysDelta>0?`+${z.daysDelta}d`:`${z.daysDelta}d`})]},`cascade-preview-${z.taskId}`)),f&&(()=>{let{x1:z,y1:L,x2:W,y2:E,onDelete:q}=f,Z=W-z,U=E-L,ke=z+Z/2,Ne=(L+E)/2,Fe=`M ${z} ${L} C ${ke} ${L}, ${ke} ${E}, ${W} ${E}`,ye=6,tt=Math.atan2(U,Z),Ie=W-ye*Math.cos(tt-Math.PI/6),st=E-ye*Math.sin(tt-Math.PI/6),it=W-ye*Math.cos(tt+Math.PI/6),dt=E-ye*Math.sin(tt+Math.PI/6),O=t.dependency,F="#f87171";return jsxs("g",{onMouseLeave:()=>x(null),children:[jsx("path",{d:Fe,fill:"none",stroke:"transparent",strokeWidth:50,strokeLinecap:"round",style:{cursor:"pointer"}}),jsx("circle",{cx:ke,cy:Ne,r:25,fill:"transparent",style:{cursor:"pointer"}}),jsx("path",{d:Fe,fill:"none",stroke:O,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsx("path",{d:Fe,fill:"none",stroke:O,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("path",{d:`M ${W} ${E} L ${Ie} ${st} M ${W} ${E} L ${it} ${dt}`,fill:"none",stroke:O,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("circle",{cx:W,cy:E,r:4,fill:O,opacity:.9,style:{pointerEvents:"none"}}),jsxs(motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:ae=>{ae.stopPropagation(),x(null),q();},style:{cursor:"pointer"},children:[jsx("circle",{cx:ke,cy:Ne,r:9,fill:"rgba(248, 113, 113, 0.15)",stroke:F,strokeWidth:1.5,style:{transition:"all 0.15s ease"}}),jsx("line",{x1:ke-3,y1:Ne-3,x2:ke+3,y2:Ne+3,stroke:F,strokeWidth:1.5,strokeLinecap:"round"}),jsx("line",{x1:ke+3,y1:Ne-3,x2:ke-3,y2:Ne+3,stroke:F,strokeWidth:1.5,strokeLinecap:"round"})]})]})})(),Re>=0&&Re<=k&&jsx("line",{x1:Re,y1:0,x2:Re,y2:le,stroke:t.today,strokeWidth:1,opacity:1,style:{pointerEvents:"none"}}),w&&jsx(oc,{tooltipData:w,theme:t})]})]})}var Sn=[{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"}];var ci=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],pi=[{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 En({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:n,isLoading:s=false,mode:c=a?"edit":"create",theme:p="dark",customStatuses:i=[],availableTags:u=[],onCreateTag:d,attachments:l=[],onUploadAttachments:h,onDeleteAttachment:b}){let m=[...ci,...i.filter(F=>!ci.some(K=>K.id===F.id))],v=Ve[p]||Ve.dark,[w,g]=useState(false),[f,x]=useState(false),[N,D]=useState(false),[I,k]=useState(false),[$,S]=useState({top:0,left:0}),[C,H]=useState(null),[B,J]=useState(new Date),[ne,xe]=useState({top:0,left:0}),[Pe,Re]=useState(false),[le,z]=useState([]),L=useRef(null),W=useRef(null),E=useRef(null),q=useRef(null),Z=useRef(null),[U,ke]=useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[Ne,Fe]=useState({});useEffect(()=>{a?(ke({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)&&Re(true)):(ke({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),Re(false),z([]));},[a,e]),useEffect(()=>{let F=K=>{L.current&&!L.current.contains(K.target)&&g(false),W.current&&!W.current.contains(K.target)&&x(false),E.current&&!E.current.contains(K.target)&&D(false),q.current&&!q.current.contains(K.target)&&k(false);};return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[]);let ye=()=>{let F={};return U.name.trim()||(F.name="El nombre es requerido"),U.startDate&&U.endDate&&U.startDate>U.endDate&&(F.endDate="La fecha de fin debe ser posterior a la de inicio"),Fe(F),Object.keys(F).length===0},tt=async F=>{if(F.preventDefault(),!!ye())try{let K=c==="create"&&le.length>0?{...U,pendingFiles:le}:U;await n(K),z([]),t();}catch(K){console.error("Error submitting task:",K);}},Ie=(F,K)=>{ke(ae=>{let ge={...ae,[F]:K};if(F==="status"){let Se=K;Se==="todo"?ge.progress=0:Se==="in-progress"?(ae.progress===0||ae.progress===100)&&(ge.progress=50):Se==="completed"||Se==="closed"?ge.progress=100:(Se==="in-review"||Se==="review")&&(ge.progress=75);}if(F==="progress"){let Se=typeof K=="number"?K:parseInt(K,10);Se===100&&ae.status!=="completed"?ge.status="completed":Se>0&&Se<100&&ae.status==="todo"?ge.status="in-progress":Se===0&&ae.status!=="todo"&&(ge.status="todo");}return ge}),Ne[F]&&Fe(ae=>{let ge={...ae};return delete ge[F],ge});},st=m.find(F=>F.id===U.status)??ci[0],it=pi.find(F=>F.id===U.priority)??pi[1],dt=Sn.find(F=>F.value===U.color)??Sn[0],O={backgroundColor:v.bgSecondary,border:`1px solid ${v.borderLight}`,color:v.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":p,style:{backgroundColor:v.bgPrimary,border:`1px solid ${v.border}`},onClick:F=>F.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${v.border}`},children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:st.color||v.accent}}),jsx("span",{className:"text-sm font-medium",style:{color:v.textSecondary},children:c==="create"?"Nueva tarea":"Editar tarea"})]}),jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:v.textTertiary},onMouseEnter:F=>{F.currentTarget.style.backgroundColor=v.hoverBg,F.currentTarget.style.color=v.textPrimary;},onMouseLeave:F=>{F.currentTarget.style.backgroundColor="transparent",F.currentTarget.style.color=v.textTertiary;},disabled:s,children:jsx(X,{className:"w-4 h-4"})})]}),jsxs("form",{onSubmit:tt,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:F=>Ie("name",F.target.value),className:"w-full text-lg font-medium bg-transparent border-none focus:outline-none focus:ring-0 placeholder:opacity-50",style:{color:v.textPrimary},placeholder:"Nombre de la tarea",disabled:s,autoFocus:true}),Ne.name&&jsxs("p",{className:"mt-1 text-xs text-red-400 flex items-center gap-1",children:[jsx(AlertCircle,{className:"w-3 h-3"}),Ne.name]})]}),jsx("div",{children:jsx("textarea",{value:U.description||"",onChange:F=>Ie("description",F.target.value),className:"w-full text-sm bg-transparent border-none focus:outline-none focus:ring-0 resize-none placeholder:opacity-40",style:{color:v.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:s})}),jsx("div",{style:{borderTop:`1px solid ${v.borderLight}`}}),jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxs("div",{ref:L,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!s&&g(!w),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...O,borderColor:st.color,backgroundColor:`${st.color}15`},disabled:s,children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:st.color}}),jsx("span",{style:{color:st.color},children:st.title}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:st.color}})]}),jsx(AnimatePresence,{children:w&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:v.bgPrimary,border:`1px solid ${v.border}`},children:m.map(F=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:v.textPrimary},onMouseEnter:K=>K.currentTarget.style.backgroundColor=v.hoverBg,onMouseLeave:K=>K.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ie("status",F.id),g(false);},children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:F.color}}),F.title,U.status===F.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:v.accent}})]},F.id))})})]}),jsxs("div",{ref:W,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!s&&x(!f),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:O,disabled:s,children:[jsx(Flag,{className:"w-3.5 h-3.5",style:{color:it.color}}),jsx("span",{children:it.label}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:v.textTertiary}})]}),jsx(AnimatePresence,{children:f&&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:v.bgPrimary,border:`1px solid ${v.border}`},children:pi.map(F=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:v.textPrimary},onMouseEnter:K=>K.currentTarget.style.backgroundColor=v.hoverBg,onMouseLeave:K=>K.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ie("priority",F.id),x(false);},children:[jsx("span",{children:F.icon}),F.label,U.priority===F.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:v.accent}})]},F.id))})})]}),o.length>0&&jsxs("div",{ref:E,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!s&&D(!N),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:O,disabled:s,children:[U.assignees&&U.assignees.length>0?jsxs(Fragment,{children:[jsx("div",{className:"flex -space-x-1",children:U.assignees.slice(0,3).map((F,K)=>jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:F.color||v.accent,borderColor:v.bgSecondary},children:F.initials},K))}),U.assignees.length>3&&jsxs("span",{style:{color:v.textTertiary},children:["+",U.assignees.length-3]})]}):jsxs(Fragment,{children:[jsx(Users,{className:"w-3.5 h-3.5",style:{color:v.textTertiary}}),jsx("span",{style:{color:v.textTertiary},children:"Asignar"})]}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:v.textTertiary}})]}),jsx(AnimatePresence,{children:N&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg shadow-xl",style:{backgroundColor:v.bgPrimary,border:`1px solid ${v.border}`},children:o.map(F=>{let K=U.assignees?.some(ae=>ae.name===F.name);return jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:v.textPrimary},onMouseEnter:ae=>ae.currentTarget.style.backgroundColor=v.hoverBg,onMouseLeave:ae=>ae.currentTarget.style.backgroundColor="transparent",onClick:()=>{let ae=K?(U.assignees||[]).filter(ge=>ge.name!==F.name):[...U.assignees||[],{name:F.name,avatar:F.avatar,initials:F.name.split(" ").map(ge=>ge[0]).join("").toUpperCase().slice(0,2),color:v.accent}];Ie("assignees",ae);},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:v.accent},children:F.name.charAt(0).toUpperCase()}),jsx("span",{className:"truncate flex-1 text-left",children:F.name}),jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:K&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:v.accent}})})]},F.id)})})})]}),jsxs("div",{ref:q,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>{if(!s)if(I)k(false);else {if(q.current){let F=q.current.getBoundingClientRect(),K=window.innerHeight,ae=120,Se=K-F.bottom<ae?F.top-ae-8:F.bottom+8;S({top:Se,left:F.left});}k(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:O,disabled:s,children:[jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:U.color}}),jsx("span",{children:dt.name}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:v.textTertiary}})]}),jsx(AnimatePresence,{children:I&&jsxs(ot,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>k(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${$.top}px`,left:`${$.left}px`,zIndex:99999,backgroundColor:v.bgPrimary,border:`1px solid ${v.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:F=>F.stopPropagation(),children:jsx("div",{style:{padding:"6px 8px"},children:jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:Sn.slice(0,18).map(F=>{let K=U.color===F.value;return jsx("button",{type:"button",onClick:ae=>{ae.preventDefault(),ae.stopPropagation(),Ie("color",F.value),k(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:F.name,children:jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:F.value,outline:K?`2px solid ${F.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},F.value)})})})})]})})]}),u.length>0||d?jsx(Xa,{selectedTags:U.tags||[],availableTags:u,onChange:F=>Ie("tags",F),onCreateTag:d,theme:v,disabled:s}):null]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Calendar,{className:"w-4 h-4",style:{color:v.textTertiary}}),jsxs("div",{ref:Z,className:"flex items-center gap-2 flex-1 relative",children:[jsx("button",{type:"button",onClick:()=>{if(!s&&!U.isMilestone)if(C==="start")H(null);else {if(Z.current){let F=Z.current.getBoundingClientRect(),K=window.innerHeight,ae=320,Se=K-F.bottom<ae?F.top-ae-8:F.bottom+8;xe({top:Se,left:F.left});}H("start"),J(U.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...O,opacity:U.isMilestone?.5:1,cursor:U.isMilestone?"not-allowed":"pointer"},disabled:s||U.isMilestone,children:U.startDate?U.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsx("span",{style:{color:v.textTertiary},children:"\u2192"}),jsx("button",{type:"button",onClick:()=>{if(!s&&!U.isMilestone)if(C==="end")H(null);else {if(Z.current){let F=Z.current.getBoundingClientRect(),K=window.innerHeight,ae=320,Se=K-F.bottom<ae?F.top-ae-8:F.bottom+8;xe({top:Se,left:F.left});}H("end"),J(U.endDate||U.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...O,opacity:U.isMilestone?.5:1,cursor:U.isMilestone?"not-allowed":"pointer"},disabled:s||U.isMilestone,children:U.endDate?U.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsx(AnimatePresence,{children:C&&jsxs(ot,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>H(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"rounded-xl shadow-2xl overflow-hidden flex",style:{position:"fixed",top:`${ne.top}px`,left:`${ne.left}px`,zIndex:99999,backgroundColor:v.bgPrimary,border:`1px solid ${v.border}`},onClick:F=>F.stopPropagation(),children:[jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${v.border}`},children:[(()=>{let F=new Date,K=new Date(F);K.setDate(F.getDate()+1);let ae=new Date(F);ae.setDate(F.getDate()+7);let ge=new Date(F);return ge.setDate(F.getDate()+14),[{label:"Hoy",date:F},{label:"Ma\xF1ana",date:K},{label:"Pr\xF3xima semana",date:ae},{label:"2 semanas",date:ge}].map((Ke,yt)=>jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:v.textPrimary},onMouseEnter:Be=>Be.currentTarget.style.backgroundColor=v.hoverBg,onMouseLeave:Be=>Be.currentTarget.style.backgroundColor="transparent",onClick:()=>{C==="start"?(Ie("startDate",Ke.date),(!U.endDate||Ke.date>U.endDate)&&Ie("endDate",Ke.date),H("end")):(Ie("endDate",Ke.date),(!U.startDate||Ke.date<U.startDate)&&Ie("startDate",Ke.date),H(null));},children:Ke.label},yt))})(),jsx("div",{style:{borderTop:`1px solid ${v.border}`,margin:"0.5rem 0"}}),jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:F=>F.currentTarget.style.backgroundColor=v.hoverBg,onMouseLeave:F=>F.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ie("startDate",void 0),Ie("endDate",void 0),H(null);},children:"Borrar fechas"})]}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("button",{type:"button",onClick:()=>J(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:v.textSecondary}})}),jsx("span",{className:"text-sm font-medium",style:{color:v.textPrimary},children:B.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>J(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:v.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((F,K)=>jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:v.textTertiary},children:F},K))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let F=B.getFullYear(),K=B.getMonth(),ae=new Date(F,K,1).getDay(),ge=new Date(F,K+1,0).getDate(),Se=new Date,Ke=[];for(let Be=ae-1;Be>=0;Be--)Ke.push({day:new Date(F,K,-Be).getDate(),date:new Date(F,K-1,new Date(F,K,-Be).getDate()),isCurrentMonth:false});for(let Be=1;Be<=ge;Be++)Ke.push({day:Be,date:new Date(F,K,Be),isCurrentMonth:true});let yt=42-Ke.length;for(let Be=1;Be<=yt;Be++)Ke.push({day:Be,date:new Date(F,K+1,Be),isCurrentMonth:false});return Ke.map((Be,pe)=>{let Ee=Be.date.toDateString()===Se.toDateString(),jt=U.startDate?.toDateString()===Be.date.toDateString(),ut=U.endDate?.toDateString()===Be.date.toDateString(),sa=U.startDate&&U.endDate&&Be.date>=U.startDate&&Be.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:Be.isCurrentMonth?jt||ut?"#FFF":v.textPrimary:v.textTertiary,backgroundColor:jt?"#3B82F6":ut?"#7C3AED":sa?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Ee&&!jt&&!ut?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{C==="start"?(Ie("startDate",Be.date),U.endDate&&Be.date>U.endDate&&Ie("endDate",Be.date),H("end")):(Ie("endDate",Be.date),U.startDate&&Be.date<U.startDate&&Ie("startDate",Be.date),H(null));},children:Be.day},pe)})})()})]})]})]})})]}),Ne.endDate&&jsx("span",{className:"text-xs text-red-400",children:Ne.endDate})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:"w-4 h-4",style:{color:v.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:F=>Ie("progress",parseInt(F.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:v.bgSecondary,accentColor:U.progress<30?"#EF4444":U.progress<70?"#F59E0B":"#10B981"},disabled:s}),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:()=>Re(!Pe),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:v.textTertiary},children:[jsx(ChevronDown,{className:`w-3 h-3 transition-transform ${Pe?"rotate-180":""}`}),"Opciones avanzadas"]}),jsx(AnimatePresence,{children:Pe&&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||l.length>0||c==="create")&&jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:v.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:v.textTertiary},children:["Adjuntos ",c==="create"?le.length>0&&`(${le.length})`:l.length>0&&`(${l.length})`]})]}),c==="create"?jsx(er,{cardId:"pending",attachments:le.map((F,K)=>({id:`pending-${K}`,cardId:"pending",name:F.name,size:F.size,type:F.type,url:URL.createObjectURL(F),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:F=>z(K=>[...K,...F]),onDelete:F=>{let K=parseInt(F.replace("pending-",""),10);z(ae=>ae.filter((ge,Se)=>Se!==K));},maxSizeMB:10,maxFiles:20}):jsx(er,{cardId:a?.id||"new",attachments:l,onUpload:h&&a?.id?F=>h(a.id,F):void 0,onDelete:b,maxSizeMB:10,maxFiles:20}),c==="create"&&le.length>0&&jsxs("p",{className:"text-xs mt-1",style:{color:v.textTertiary},children:[le.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:F=>Ie("isMilestone",F.target.checked),className:"w-4 h-4 rounded",style:{accentColor:v.accent},disabled:s}),jsx(Milestone,{className:"w-4 h-4 text-yellow-500"}),jsx("span",{className:"text-sm",style:{color:v.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:v.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:v.bgSecondary},children:r.filter(F=>F.id!==a?.id).map(F=>{let K=U.dependencies?.includes(F.id);return jsx("button",{type:"button",onClick:()=>{let ae=K?(U.dependencies||[]).filter(ge=>ge!==F.id):[...U.dependencies||[],F.id];Ie("dependencies",ae);},className:"px-2 py-1 rounded-full text-xs transition-colors",style:{backgroundColor:K?`${v.accent}30`:v.bgPrimary,color:K?v.accent:v.textSecondary,border:`1px solid ${K?v.accent:v.borderLight}`},disabled:s,children:F.name},F.id)})})]})]})})})]})]}),jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${v.border}`},children:[jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:v.textSecondary},onMouseEnter:F=>F.currentTarget.style.backgroundColor=v.hoverBg,onMouseLeave:F=>F.currentTarget.style.backgroundColor="transparent",disabled:s,children:"Cancelar"}),jsx("button",{type:"submit",disabled:s,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:v.accent,color:"#FFF"},onMouseEnter:F=>!s&&(F.currentTarget.style.opacity="0.9"),onMouseLeave:F=>!s&&(F.currentTarget.style.opacity="1"),children:s?jsxs(Fragment,{children:[jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsx(Fragment,{children:c==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var c0=['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"'],dc=()=>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"})}),m0=()=>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"})}),u0=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M5 12h14"})}),g0=()=>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 Pn({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:n,onTaskDelete:s,onDependencyCreate:c,onDependencyDelete:p}){let[i,u]=useState(false),[d,l]=useState(false),[h,b]=useState([]),[m,v]=useState(""),[w,g]=useState(false),[f,x]=useState(true),N=useRef(null),D=useRef(null),I=useRef(null),{enabled:k=true,placeholder:$='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:S="bottom-right",onCommand:C,suggestions:H=c0,maxHistory:B=50,persistHistory:J}=a,ne=J?.storageKey||"gantt-ai-history",xe=J?.maxMessages??5;useEffect(()=>{if(J?.enabled)try{let W=localStorage.getItem(ne);if(W){let q=JSON.parse(W).map(Z=>({...Z,timestamp:new Date(Z.timestamp)}));b(q.slice(-xe));}}catch(W){console.warn("[GanttAIAssistant] Failed to load persisted history:",W);}},[J?.enabled,ne,xe]),useEffect(()=>{if(J?.enabled&&h.length>0)try{let W=h.filter(E=>!E.isLoading).slice(-xe);localStorage.setItem(ne,JSON.stringify(W));}catch(W){console.warn("[GanttAIAssistant] Failed to persist history:",W);}},[h,J?.enabled,ne,xe]),useEffect(()=>{D.current&&D.current.scrollIntoView({behavior:"smooth"});},[h]),useEffect(()=>{i&&!d&&N.current&&setTimeout(()=>N.current?.focus(),100);},[i,d]);let Pe=useCallback(W=>{if(W.success)switch(W.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":W.taskId&&W.updates&&o?.(W.taskId,W.updates);break;case "create_task":W.newTask&&n?.(W.newTask);break;case "delete_task":W.taskId&&s?.(W.taskId);break;case "link_tasks":W.dependencyFrom&&W.dependencyTo&&c?.(W.dependencyFrom,W.dependencyTo);break;case "unlink_tasks":W.taskId&&W.dependencyFrom&&p?.(W.taskId,W.dependencyFrom);break}},[o,n,s,c,p]),Re=useCallback(async W=>{if(!W.trim()||w)return;let E={id:`user-${Date.now()}`,role:"user",content:W,timestamp:new Date};b(Z=>[...Z.slice(-(B-1)),E]),v(""),x(false),g(true);let q={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};b(Z=>[...Z,q]);try{if(C){let Z=await C(W,e);b(U=>{let ke=U.filter(Fe=>!Fe.isLoading),Ne={id:`assistant-${Date.now()}`,role:"assistant",content:Z.message,timestamp:new Date,command:Z};return [...ke,Ne]}),Pe(Z);}else b(Z=>[...Z.filter(ke=>!ke.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(Z){b(U=>[...U.filter(Ne=>!Ne.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${Z instanceof Error?Z.message:"Unknown error"}`,timestamp:new Date}]);}finally{g(false);}},[w,B,C,e,Pe]),le=W=>{W.preventDefault(),Re(m);},z=W=>{v(W),N.current?.focus();};if(useEffect(()=>{let W=E=>{(E.metaKey||E.ctrlKey)&&E.key==="k"&&(E.preventDefault(),u(q=>!q),i||l(false)),E.key==="Escape"&&i&&u(false);};return document.addEventListener("keydown",W),()=>document.removeEventListener("keydown",W)},[i]),useEffect(()=>{if(!i)return;let W=q=>{let Z=q.target;I.current&&!I.current.contains(Z)&&u(false);},E=setTimeout(()=>{document.addEventListener("mousedown",W);},100);return ()=>{clearTimeout(E),document.removeEventListener("mousedown",W);}},[i]),!k)return null;let L={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"};return jsxs(ot,{children:[jsx(AnimatePresence,{children:!i&&jsxs(motion.button,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},className:`fixed ${L[S]} 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(dc,{}),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:I,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:d?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${L[S]} 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(dc,{}),jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>l(W=>!W),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsx(u0,{})}),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(m0,{})})]})]}),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&&f&&jsxs("div",{className:"space-y-3",children:[jsx("p",{className:"text-sm text-center",style:{color:t.textSecondary},children:"Try asking me to edit your Gantt chart:"}),jsx("div",{className:"flex flex-wrap gap-2",children:H.slice(0,4).map((W,E)=>jsx("button",{onClick:()=>z(W),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:W.length>30?W.slice(0,30)+"...":W},E))})]}),h.map(W=>jsx(motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${W.role==="user"?"justify-end":"justify-start"}`,children:jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${W.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:W.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:W.role==="user"?"white":t.textPrimary},children:[W.isLoading?jsx(g0,{}):jsx("p",{className:"text-sm whitespace-pre-wrap",children:W.content}),W.command&&jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:W.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:W.command.success?"#10B981":"#EF4444"},children:[W.command.success?"\u2713":"\u2717",jsx("span",{className:"capitalize",children:W.command.type.replace(/_/g," ")})]})]})},W.id)),jsx("div",{ref:D})]}),jsxs("form",{onSubmit:le,className:"p-3 border-t",style:{borderColor:t.border},children:[jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:t.bgSecondary,border:`1px solid ${t.border}`},children:[jsx("input",{ref:N,type:"text",value:m,onChange:W=>v(W.target.value),placeholder:$,disabled:w,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsx("button",{type:"submit",disabled:!m.trim()||w,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:m.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:m.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 cc(e,t=50){let[a,r]=useState({past:[],present:e,future:[]}),o=useRef(false),n=useCallback((i,u=true)=>{r(d=>{let l=typeof i=="function"?i(d.present):i;if(o.current)return {...d,present:l};if(!u)return {...d,present:l};let h=[...d.past,d.present];return h.length>t&&h.shift(),{past:h,present:l,future:[]}});},[t]),s=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]}});},[]),c=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}});},[]),p=useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:n,undo:s,redo:c,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:p}}function pc({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){useEffect(()=>{if(!o)return;let n=s=>{let c=navigator.platform.toUpperCase().indexOf("MAC")>=0,p=c?s.metaKey:s.ctrlKey;if(p&&s.key==="z"&&!s.shiftKey&&a){s.preventDefault(),e();return}if(r){if(!c&&p&&s.key==="y"){s.preventDefault(),t();return}if(c&&p&&s.shiftKey&&s.key==="z"){s.preventDefault(),t();return}}};return window.addEventListener("keydown",n),()=>{window.removeEventListener("keydown",n);}},[e,t,a,r,o]);}var y0={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${me.formatDate(e.startDate)} - ${me.formatDate(e.endDate)}`);let a=me.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=>me.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function mc(e){return {...y0,...e}}var N0=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},fc=forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:n,timeScale:s="week",rowDensity:c="comfortable",showThemeSelector:p=true,showExportButton:i=true,availableUsers:u=[],templates:d,enableAutoCriticalPath:l=true,persistExpandedState:h,aiAssistant:b,locale:m="en",customTranslations:v,showCreateTaskButton:w=false,createTaskLabel:g,onCreateTask:f,onThemeChange:x,onTaskClick:N,onTaskDblClick:D,onTaskContextMenu:I,onTaskUpdate:k,onProgressChange:$,onTaskEdit:S,onTaskAddSubtask:C,onTaskMarkIncomplete:H,onTaskSetInProgress:B,onDependencyCreate:J,onDependencyDelete:ne,onBeforeTaskAdd:xe,onAfterTaskAdd:Pe,onBeforeTaskUpdate:Re,onAfterTaskUpdate:le,onBeforeTaskDelete:z,onAfterTaskDelete:L}=a,E=useContext(mn)?.theme,[q,Z]=useState(E||n||"dark"),[U,ke]=useState(s),[Ne,Fe]=useState(c),[ye,tt]=useState(1),[Ie,st]=useState(0),[it,dt]=useState(false),[O,F]=useState(null),[K,ae]=useState({isOpen:false,x:0,y:0,task:null}),[ge,Se]=useState(null),[Ke,yt]=useState(null);useEffect(()=>{E&&E!==q&&Z(E);},[E]),useEffect(()=>{n&&n!==q&&Z(n);},[n]);let Be=useCallback(P=>{Z(P),x?.(P);},[x]),{state:pe,setState:Ee,undo:jt,redo:ut,canUndo:sa,canRedo:Sa,clearHistory:He}=cc(t,50),$e=useCallback(()=>h?typeof h=="string"?h:"gantt-expanded-tasks":null,[h]),ia=useRef(new Map),fe=useRef(false);if(!fe.current&&h){fe.current=true;let P=typeof h=="string"?h:"gantt-expanded-tasks";try{let A=localStorage.getItem(P);if(A){let G=JSON.parse(A);Array.isArray(G)&&(ia.current=new Map(G));}}catch(A){console.warn("[GanttBoard] Error loading expanded state from localStorage:",A);}}let Oe=useCallback(()=>{let P=$e();if(P)try{let A=Array.from(ia.current.entries());localStorage.setItem(P,JSON.stringify(A));}catch(A){console.warn("[GanttBoard] Error saving expanded state to localStorage:",A);}},[$e]);useEffect(()=>{let P=A=>A.map(G=>{let se=ia.current.get(G.id),ue=se!==void 0?{...G,isExpanded:se}:G;return ue.subtasks?.length?{...ue,subtasks:P(ue.subtasks)}:ue});ia.current.size>0?Ee(P(t)):Ee(t);},[t,Ee]);let Ae=useRef(t),Ge=useRef(true);useEffect(()=>{if(Ge.current){Ge.current=false,Ae.current=pe;return}if(!r)return;let P=JSON.stringify(Ae.current),A=JSON.stringify(pe);P!==A&&(Ae.current=pe,r(pe));},[pe,r]);let _e=useMemo(()=>Ys(m,v),[m,v]),kt=useCallback(P=>[{id:"name",label:P.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:P.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:P.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:P.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:P.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:P.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:P.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:P.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[rt,Qe]=useState(()=>kt(_e));useEffect(()=>{Qe(P=>P.map(A=>({...A,label:_e.columns[A.id==="name"?"taskName":A.id]||A.label})));},[_e]);let ct=useMemo(()=>rt.filter(A=>A.visible).reduce((A,G)=>A+G.width,0),[rt]),Ht=useRef(rt.filter(P=>P.visible).map(P=>P.id).join(","));useEffect(()=>{let P=rt.filter(se=>se.visible),A=P.map(se=>se.id).join(","),G=Ht.current;if(A!==G){let se=P.some(De=>De.id!=="name"),ue=G.includes(",");se?!ue&&se&&F(null):F(null),Ht.current=A;}},[rt]);let Q=60,oe=.6,T=useMemo(()=>{let A=ct+Q,G=typeof window<"u"?window.innerWidth*oe:800,se=Math.max(A,G);return O!==null?Math.max(200,Math.min(O,se)):Math.max(200,A)},[O,ct]),ee=useRef(null),ie=useRef(null),R=useRef(null),Y=useMemo(()=>Md(q),[q]),V=useMemo(()=>({theme:Y,themeName:q}),[Y,q]),we=useMemo(()=>mc(d),[d]),Le=useMemo(()=>{if(!l)return pe;let P=me.calculateCriticalPath(pe),A=G=>G.map(se=>({...se,isCriticalPath:P.includes(se.id),subtasks:se.subtasks?A(se.subtasks):void 0}));return A(pe)},[pe,l]),Me=N0(Ne);pc({undo:jt,redo:ut,canUndo:sa,canRedo:Sa,enabled:true}),useImperativeHandle(o,()=>({getTask:P=>me.findTaskById(pe,P),addTask:(P,A)=>{Ee(G=>{if(!A)return [...G,{...P,level:0}];let se=ue=>ue.map(De=>De.id===A?{...De,subtasks:[...De.subtasks||[],{...P,parentId:A,level:(De.level||0)+1}],isExpanded:true}:De.subtasks?{...De,subtasks:se(De.subtasks)}:De);return se(G)});},updateTask:(P,A)=>{Ee(G=>{let se=ue=>ue.map(De=>De.id===P?{...De,...A}:De.subtasks?{...De,subtasks:se(De.subtasks)}:De);return se(G)});},deleteTask:P=>{Ee(A=>{let G=se=>se.filter(ue=>ue.id===P?false:(ue.subtasks&&(ue.subtasks=G(ue.subtasks)),true));return G(A)});},deleteTasks:P=>{Ee(A=>ti(A,P));},duplicateTask:P=>{Ee(A=>ai(A,[P]));},splitTask:(P,A,G=3)=>{Ee(se=>me.splitTask(se,P,A,G));},calculateEndDate:me.calculateEndDate,calculateDuration:me.calculateDuration,validateDependency:(P,A)=>!me.validateDependencies(pe,P,A),getAllTasks:()=>me.flattenTasks(pe),getTasksByStatus:P=>me.flattenTasks(pe).filter(A=>A.status===P),getTasksByParent:P=>P?me.findTaskById(pe,P)?.subtasks||[]:pe.filter(G=>!G.parentId),getCriticalPath:()=>me.flattenTasks(pe).filter(P=>P.isCriticalPath),indentTask:P=>{Ee(A=>Zs(A,[P]));},outdentTask:P=>{Ee(A=>Qs(A,[P]));},moveTask:(P,A)=>{Ee(G=>ei(G,[P],A));},createSubtask:async P=>{let{tasks:A,newTask:G}=ni(pe,P);if(xe){let se=xe({...G,parentId:P});if((se instanceof Promise?await se:se)===false)return}Ee(A),Pe&&Pe({...G,parentId:P});},scrollToTask:P=>{let G=me.flattenTasks(pe).findIndex(se=>se.id===P);if(G!==-1&&ee.current){let se=G*Me;ee.current.scrollTo({top:se,behavior:"smooth"}),ie.current&&ie.current.scrollTo({top:se,behavior:"smooth"});}},highlightTask:(P,A=2e3)=>{},expandTask:P=>{Ee(A=>{let G=se=>se.map(ue=>ue.id===P?{...ue,isExpanded:true}:ue.subtasks?{...ue,subtasks:G(ue.subtasks)}:ue);return G(A)});},collapseTask:P=>{Ee(A=>{let G=se=>se.map(ue=>ue.id===P?{...ue,isExpanded:false}:ue.subtasks?{...ue,subtasks:G(ue.subtasks)}:ue);return G(A)});},expandAll:()=>{Ee(P=>{let A=G=>G.map(se=>({...se,isExpanded:true,subtasks:se.subtasks?A(se.subtasks):void 0}));return A(P)});},collapseAll:()=>{Ee(P=>{let A=G=>G.map(se=>({...se,isExpanded:false,subtasks:se.subtasks?A(se.subtasks):void 0}));return A(P)});},undo:jt,redo:ut,canUndo:()=>sa,canRedo:()=>Sa,clearHistory:He,exportToPNG:async()=>{if(!R.current||!ee.current||!ie.current)throw new Error("Gantt container not found");let P=R.current,A=ee.current.querySelector(".gantt-grid-scroll"),G=ie.current,se=A?.scrollTop||0,ue=G.scrollTop,De=P.style.overflow,gt=P.style.height;try{let Gt=A?.querySelector(".gantt-taskgrid-content"),la=G.querySelector("svg"),da=Gt?.scrollHeight||A?.scrollHeight||600,va=la?.getBoundingClientRect().height||G.scrollHeight,Sr=(P.querySelector('[class*="h-12"]')?.offsetHeight||48)+Math.max(da,va)+20;A&&(A.scrollTop=0),G.scrollTop=0,P.style.overflow="visible",P.style.height=`${Sr}px`,await new Promise(mr=>setTimeout(mr,100));let pr=await gc(P,{backgroundColor:Y.bgPrimary,scale:2,logging:!1,useCORS:!0,ignoreElements:mr=>{let Yr=window.getComputedStyle(mr),Er=parseInt(Yr.zIndex,10);return !isNaN(Er)&&Er>=50||Yr.position==="fixed"}});return new Promise((mr,Yr)=>{pr.toBlob(Er=>{Er?mr(Er):Yr(new Error("Failed to create blob from canvas"));},"image/png");})}finally{P.style.overflow=De,P.style.height=gt,A&&(A.scrollTop=se),G.scrollTop=ue;}},exportToPDF:async P=>{await me.exportToPDF(pe,P);},exportToExcel:async P=>{await me.exportToExcel(pe,P);},exportToJSON:()=>me.exportToJSON(pe),exportToCSV:()=>me.exportToCSV(pe),importFromJSON:P=>{let A=me.importFromJSON(P);Ee(A);},getTasks:()=>pe,refresh:()=>{Ee(P=>[...P]);},clearAll:()=>{Ee([]);}}),[pe,jt,ut,sa,Sa,He,Y,Me]);let Kt=useCallback(P=>{Qe(A=>A.map(G=>G.id===P?{...G,visible:!G.visible}:G));},[]),$t=useCallback((P,A)=>{Qe(G=>G.map(se=>{if(se.id!==P)return se;let ue=se.minWidth??100,De=se.maxWidth??800,gt=Math.max(ue,Math.min(De,A));return {...se,width:gt}}));},[]),Qt=useCallback(P=>{Ee(A=>{let G=oi(A,P),se=ue=>{for(let De of ue){if(De.id===P){ia.current.set(P,De.isExpanded??true);return}De.subtasks?.length&&se(De.subtasks);}};return se(G),Oe(),G}),a.onTaskToggleExpand?.(P);},[a,Oe]),re=useCallback((P,A)=>{if(Re&&Re(P,A)===false)return;let se=me.findTaskById(pe,P)?.progress,ue=gt=>gt.map(Gt=>Gt.id===P?{...Gt,...A}:Gt.subtasks?{...Gt,subtasks:ue(Gt.subtasks)}:Gt);Ee(ue(pe));let De=me.findTaskById(ue(pe),P);De&&(k?.(De),le?.(De),A.progress!==void 0&&se!==void 0&&A.progress!==se&&$?.(P,se,A.progress));},[pe,k,Re,le,$]),Ce=useCallback(P=>{P.length!==0&&(Ee(A=>Zs(A,P)),a.onTaskIndent?.(P[0]));},[a]),Je=useCallback(P=>{P.length!==0&&(Ee(A=>Qs(A,P)),a.onTaskOutdent?.(P[0]));},[a]),At=useCallback((P,A,G)=>{Ee(se=>Xd(se,P,A,G)),a.onTaskReparent?.(P,A,G);},[a]),Oa=useCallback((P,A)=>{P.length!==0&&(Ee(G=>ei(G,P,A)),a.onTaskMove?.(P[0],A));},[a]),dr=useCallback(async P=>{let A=[];for(let G of P)z&&await Promise.resolve(z(G))===false||A.push(G);A.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(A):(Ee(G=>ti(G,A)),A.forEach(G=>a.onTaskDelete?.(G))),L&&A.forEach(G=>L(G)));},[a,z,L]),rr=useCallback(P=>{Ee(A=>ai(A,P)),P.forEach(A=>a.onTaskDuplicate?.(A));},[a]),Dr=useCallback((P,A)=>{Ee(G=>{let{tasks:se,newTask:ue}=qd(G,P,A);return xe&&xe(ue)===false?G:(a.onTaskCreate?.(ue.parentId,ue.position||0),Pe?.(ue),se)});},[a,xe,Pe]),Ut=useCallback((P,A)=>{Ee(G=>ri(G,P,A)),a.onTaskRename?.(P,A);},[a]),fo=useCallback(P=>{Ee(A=>{let{tasks:G}=ni(A,P);return a.onTaskCreate?.(P,0),G});},[a]),Kn=useCallback((P,A,G)=>{let se=P.startDate?Math.round((A.getTime()-P.startDate.getTime())/864e5):0,ue=Gt=>Gt.map(la=>la.id===P.id?{...la,startDate:A,endDate:G,...P.segments&&{segments:P.segments}}:la.subtasks?{...la,subtasks:ue(la.subtasks)}:la),De=ue(pe);De=me.autoScheduleDependents(De,P.id,se),Ee(De);let gt={...P,startDate:A,endDate:G};k?.(gt);},[pe,k]),sl=useCallback((P,A)=>{I?.(P,A),ae({isOpen:true,x:A.clientX,y:A.clientY,task:P});},[I]),ho=useCallback((P,A)=>{let G=me.splitTask(pe,P.id,A);Ee(G),ae({isOpen:false,x:0,y:0,task:null});},[pe]),il=useCallback(P=>{let A=me.findTaskById(pe,P.id)||P;D?.(A),S||Se(A);},[pe,D,S]),ll=useCallback((P,A,G)=>{let se=new Map,ue=da=>{da.forEach(va=>{va.dependencies&&se.set(va.id,va.dependencies),va.subtasks&&ue(va.subtasks);});};ue(G);let De=se.get(A)||[];se.set(A,[...De,P]);let gt=new Set,Gt=new Set,la=da=>{if(!gt.has(da)){gt.add(da),Gt.add(da);let va=se.get(da)||[];for(let cr of va){if(!gt.has(cr)&&la(cr))return true;if(Gt.has(cr))return true}}return Gt.delete(da),false};return la(A)},[]),dl=useCallback((P,A)=>{if(ll(P.id,A,pe)){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 V=oe=>oe.map(me=>{if(me.id===E){let Se=me.dependencies||[];if(!Se.includes(S.id))return {...me,dependencies:[...Se,S.id]}}return me.subtasks?{...me,subtasks:V(me.subtasks)}:me});Ie(V(ke)),J?.(S.id,E);},[ke,J,ll]),cl=useCallback((S,E)=>{let V=oe=>oe.map(me=>{if(me.id===S&&me.dependencies){let Se=me.dependencies.filter(gt=>gt!==E);return {...me,dependencies:Se}}return me.subtasks?{...me,subtasks:V(me.subtasks)}:me});Ie(V(ke)),K?.(S,E);},[ke,K]),{startDate:Sp,endDate:Ep}=useMemo(()=>{let S=ke.filter(Se=>Se.startDate&&Se.endDate);if(S.length===0){let Se=new Date,gt=new Date(Se);gt.setDate(gt.getDate()-30);let Ht=new Date(Se);return Ht.setDate(Ht.getDate()+60),{startDate:gt,endDate:Ht}}let E=S.flatMap(Se=>[Se.startDate,Se.endDate]).filter(Se=>Se!==void 0),V=new Date(Math.min(...E.map(Se=>Se.getTime()))),oe=new Date(Math.max(...E.map(Se=>Se.getTime()))),me=H==="day"?7:H==="week"?14:30;return V.setDate(V.getDate()-me),oe.setDate(oe.getDate()+me),{startDate:V,endDate:oe}},[ke,H]),Pp=useCallback(async()=>{if(!R.current||!Y.current||!ne.current)return;await new Promise(Dr=>setTimeout(Dr,200));let S=R.current,E=Y.current.querySelector(".gantt-grid-scroll"),V=ne.current,oe=E?.scrollTop||0,me=E?.scrollLeft||0,Se=V.scrollTop,gt=V.scrollLeft,Ht=S.style.overflow,ia=S.style.height,la=E?.style.overflow||"",ba=V.style.overflow,lr=S.style.width,Go=V.style.width;try{let Dr=E?.querySelector(".gantt-taskgrid-content"),dr=V.querySelector("svg"),cr=dr?.getAttribute("height")?parseInt(dr.getAttribute("height"),10):dr?.getBoundingClientRect().height||0,jr=Dr?.scrollHeight||E?.scrollHeight||600,Nr=Math.max(cr,V.scrollHeight),pl=dr?.getAttribute("width")?parseInt(dr.getAttribute("width"),10):dr?.getBoundingClientRect().width||V.scrollWidth,Rp=S.querySelector('[class*="h-12"]')?.offsetHeight||48,Kn=Math.max(jr,Nr,cr),Yn=Rp+Kn+50,qn=(E?.offsetWidth||300)+pl+10;E&&(E.scrollTop=0,E.scrollLeft=0),V.scrollTop=0,V.scrollLeft=0,S.style.overflow="visible",S.style.height=`${Yn}px`,S.style.width=`${qn}px`,E&&(E.style.overflow="visible",E.style.height=`${Kn+50}px`),V.style.overflow="visible",V.style.height=`${Kn+50}px`,V.style.width=`${pl+10}px`,await new Promise(Jn=>setTimeout(Jn,150));let Op=await pc(S,{backgroundColor:W.bgPrimary,scale:2,logging:!1,useCORS:!0,allowTaint:!0,width:qn,height:Yn,windowWidth:qn+100,windowHeight:Yn+100,scrollX:0,scrollY:0,ignoreElements:Jn=>{let ml=window.getComputedStyle(Jn),ul=parseInt(ml.zIndex,10);return !isNaN(ul)&&ul>=50||ml.position==="fixed"}}),Xn=document.createElement("a");Xn.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,Xn.href=Op.toDataURL("image/png"),Xn.click();}finally{S.style.overflow=Ht,S.style.height=ia,S.style.width=lr,E&&(E.style.overflow=la,E.style.height="",E.scrollTop=oe,E.scrollLeft=me),V.style.overflow=ba,V.style.height="",V.style.width=Go,V.scrollTop=Se,V.scrollLeft=gt;}},[W]),Mp=useCallback(async()=>{await pe.exportToPDF(ke);},[ke]),Ap=useCallback(async()=>{await pe.exportToExcel(ke);},[ke]),Ip=useCallback(()=>{let S=pe.exportToCSV(ke),E=new Blob([S],{type:"text/csv;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(E),V.download="gantt-chart.csv",V.click(),URL.revokeObjectURL(V.href);},[ke]),Fp=useCallback(()=>{let S=pe.exportToJSON(ke),E=new Blob([S],{type:"application/json;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(E),V.download="gantt-chart.json",V.click(),URL.revokeObjectURL(V.href);},[ke]),Lp=useCallback(()=>{pe.exportToMSProject(ke,"Gantt Project","project.xml");},[ke]),Bp=S=>{S.preventDefault(),qe(true);},Vr=useRef(false);return useEffect(()=>{let S=ne.current,E=Y.current?.querySelector(".gantt-grid-scroll");if(!S||!E)return;let V=()=>{if(Vr.current)return;Vr.current=true;let gt=S.scrollTop;Me(gt),E.scrollTop=gt,requestAnimationFrame(()=>{Vr.current=false;});},oe=()=>{if(Vr.current)return;Vr.current=true;let gt=E.scrollTop;Me(gt),S.scrollTop=gt,requestAnimationFrame(()=>{Vr.current=false;});},me=gt=>{if(_e&&E){let ia=E.parentElement?.getBoundingClientRect()?.left||0,la=gt.clientX-ia,ba=200,lr=A+_,Go=window.innerWidth*Z,Dr=Math.max(lr,Go);la>=ba&&la<=Dr&&O(la);}},Se=()=>{qe(false);};return S.addEventListener("scroll",V),E.addEventListener("scroll",oe),document.addEventListener("mousemove",me),document.addEventListener("mouseup",Se),()=>{S.removeEventListener("scroll",V),E.removeEventListener("scroll",oe),document.removeEventListener("mousemove",me),document.removeEventListener("mouseup",Se);}},[_e,A]),jsx(no.Provider,{value:Xe,children:jsx(as.Provider,{value:Ne,children:jsxs("div",{ref:R,className:"flex flex-col h-full w-full",style:{backgroundColor:W.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsx(pn,{theme:W,timeScale:H,onTimeScaleChange:De,zoom:xe,onZoomChange:U,currentTheme:Q,onThemeChange:Le,rowDensity:Ee,onRowDensityChange:Be,showThemeSelector:m,showCreateTaskButton:h,createTaskLabel:v,onCreateTask:f,onExportPNG:l?Pp:void 0,onExportPDF:l?Mp:void 0,onExportExcel:l?Ap:void 0,onExportCSV:l?Ip:void 0,onExportJSON:l?Fp:void 0,onExportMSProject:l?Lp:void 0}),jsxs("div",{ref:Y,className:"flex-1 flex min-h-0",style:{overflow:"clip",overflowClipMargin:"100px"},children:[jsx("div",{className:"gantt-grid-scroll flex-shrink-0",style:{width:ve,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsx(fn,{tasks:$e,theme:W,rowHeight:mt,availableUsers:u,templates:et,onTaskClick:T,onTaskDblClick:il,onTaskContextMenu:I,onTaskToggle:$t,scrollTop:ae,columns:st,onToggleColumn:Re,onColumnResize:ut,onTaskUpdate:se,onTaskIndent:Mt,onTaskOutdent:aa,onTaskMove:Ho,onMultiTaskDelete:ir,onTaskDuplicate:Qa,onTaskCreate:Tr,onTaskRename:Ut,onCreateSubtask:uo,onOpenTaskModal:T?S=>T(S):void 0,onDeleteRequest:(S,E)=>kt({taskId:S,taskName:E}),onTaskReparent:_r})}),jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:W.border,zIndex:15},onMouseDown:Bp}),jsx("div",{ref:ne,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsx(Cn,{tasks:$e,theme:W,rowHeight:mt,timeScale:H,startDate:Sp,endDate:Ep,zoom:xe,templates:et,onTaskClick:T,onTaskDblClick:il,onTaskContextMenu:sl,onTaskDateChange:jn,onDependencyCreate:dl,onDependencyDelete:cl})})]}),re.task&&jsx(so,{isOpen:re.isOpen,x:re.x,y:re.y,theme:W,onClose:()=>ce({isOpen:false,x:0,y:0,task:null}),items:(()=>{let S=re.task;if(!S)return [];let E=pe.findTaskById(ke,S.id)||S;return E.subtasks&&E.subtasks.length>0?[{id:"addSubtask",label:Xe.contextMenu?.addSubtask||"Add Subtask",icon:Et.Add,onClick:()=>{C?C(E):uo(E.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:Xe.contextMenu?.deleteTask||"Delete Task",icon:Et.Delete,onClick:()=>{kt({taskId:E.id,taskName:E.name});}}]:[{id:"edit",label:Xe.contextMenu?.editTask||"Edit Task",icon:Et.Pencil,onClick:()=>{N?N(E):Ae(E);}},{id:"addSubtask",label:Xe.contextMenu?.addSubtask||"Add Subtask",icon:Et.Add,onClick:()=>{C?C(E):uo(E.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:Xe.contextMenu?.markIncomplete||"Mark Incomplete",icon:Et.MarkIncomplete,onClick:()=>{G?G(E):se(E.id,{status:"todo",progress:0});},disabled:E.status==="todo"},{id:"setInProgress",label:Xe.contextMenu?.setInProgress||"Set In Progress",icon:Et.SetInProgress,onClick:()=>{F?F(E):se(E.id,{status:"in-progress"});},disabled:E.status==="in-progress"},{id:"markComplete",label:Xe.contextMenu?.markComplete||"Mark Complete",icon:Et.MarkComplete,onClick:()=>{se(E.id,{status:"completed",progress:100});},disabled:E.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:Xe.contextMenu?.splitTask||"Split Task",icon:Et.Split,onClick:()=>{if(!E.startDate||!E.endDate){console.warn("Cannot split task without dates");return}let oe=E.startDate.getTime(),me=E.endDate.getTime(),Se=oe+(me-oe)/2,gt=new Date(Se);go(E,gt);},disabled:!E.startDate||!E.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:Xe.contextMenu?.deleteTask||"Delete Task",icon:Et.Delete,onClick:()=>{kt({taskId:E.id,taskName:E.name});}}]})()}),fe&&jsx(Dn,{isOpen:true,onClose:()=>Ae(null),task:fe,onSubmit:S=>{se(fe.id,S),Ae(null);},mode:"edit",theme:Q}),jsx(AnimatePresence,{children:ot&&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:()=>kt(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:S=>S.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:W.bgSecondary,border:`1px solid ${W.border}`},children:[jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${W.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:W.textPrimary,fontFamily:"Inter, sans-serif"},children:[Xe.contextMenu?.deleteTask||"Delete Task","?"]}),jsx("p",{className:"text-sm mt-1",style:{color:W.textSecondary,fontFamily:"Inter, sans-serif"},children:g==="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:W.textSecondary,fontFamily:"Inter, sans-serif"},children:[g==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxs("span",{className:"font-semibold",style:{color:W.textPrimary},children:['"',ot.taskName,'"']}),"."]})}),jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:W.bgPrimary,borderTop:`1px solid ${W.border}`},children:[jsx("button",{onClick:()=>kt(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:W.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:S=>{S.currentTarget.style.backgroundColor=W.hoverBg;},onMouseLeave:S=>{S.currentTarget.style.backgroundColor="transparent";},children:g==="es"?"Cancelar":"Cancel"}),jsxs("button",{onClick:()=>{ir([ot.taskId]),kt(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:S=>{S.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:S=>{S.currentTarget.style.backgroundColor="#EF4444";},children:[jsx(Trash2,{className:"w-4 h-4"}),g==="es"?"Eliminar":"Delete"]})]})]})})}),w?.enabled&&jsx(Nn,{tasks:ke,theme:W,config:w,onTasksUpdate:Ie,onTaskUpdate:se,onTaskCreate:S=>{Ie(E=>[...E,S]);},onTaskDelete:S=>{ir([S]);},onDependencyCreate:(S,E)=>{let V=pe.findTaskById(ke,S);V&&dl(V,E);},onDependencyDelete:cl})]})})})});var uc=`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 G=se=>se.map(ue=>{if(ue.id===A){let De=ue.dependencies||[];if(!De.includes(P.id))return {...ue,dependencies:[...De,P.id]}}return ue.subtasks?{...ue,subtasks:G(ue.subtasks)}:ue});Ee(G(pe)),J?.(P.id,A);},[pe,J,ll]),cl=useCallback((P,A)=>{let G=se=>se.map(ue=>{if(ue.id===P&&ue.dependencies){let De=ue.dependencies.filter(gt=>gt!==A);return {...ue,dependencies:De}}return ue.subtasks?{...ue,subtasks:G(ue.subtasks)}:ue});Ee(G(pe)),ne?.(P,A);},[pe,ne]),{startDate:Ap,endDate:Fp}=useMemo(()=>{let P=pe.filter(De=>De.startDate&&De.endDate);if(P.length===0){let De=new Date,gt=new Date(De);gt.setDate(gt.getDate()-30);let Gt=new Date(De);return Gt.setDate(Gt.getDate()+60),{startDate:gt,endDate:Gt}}let A=P.flatMap(De=>[De.startDate,De.endDate]).filter(De=>De!==void 0),G=new Date(Math.min(...A.map(De=>De.getTime()))),se=new Date(Math.max(...A.map(De=>De.getTime()))),ue=U==="day"?7:U==="week"?14:30;return G.setDate(G.getDate()-ue),se.setDate(se.getDate()+ue),{startDate:G,endDate:se}},[pe,U]),Ip=useCallback(async()=>{if(!R.current||!ee.current||!ie.current)return;await new Promise(Sr=>setTimeout(Sr,200));let P=R.current,A=ee.current.querySelector(".gantt-grid-scroll"),G=ie.current,se=A?.scrollTop||0,ue=A?.scrollLeft||0,De=G.scrollTop,gt=G.scrollLeft,Gt=P.style.overflow,la=P.style.height,da=A?.style.overflow||"",va=G.style.overflow,cr=P.style.width,Vo=G.style.width;try{let Sr=A?.querySelector(".gantt-taskgrid-content"),pr=G.querySelector("svg"),mr=pr?.getAttribute("height")?parseInt(pr.getAttribute("height"),10):pr?.getBoundingClientRect().height||0,Yr=Sr?.scrollHeight||A?.scrollHeight||600,Er=Math.max(mr,G.scrollHeight),pl=pr?.getAttribute("width")?parseInt(pr.getAttribute("width"),10):pr?.getBoundingClientRect().width||G.scrollWidth,Up=P.querySelector('[class*="h-12"]')?.offsetHeight||48,Yn=Math.max(Yr,Er,mr),qn=Up+Yn+50,Xn=(A?.offsetWidth||300)+pl+10;A&&(A.scrollTop=0,A.scrollLeft=0),G.scrollTop=0,G.scrollLeft=0,P.style.overflow="visible",P.style.height=`${qn}px`,P.style.width=`${Xn}px`,A&&(A.style.overflow="visible",A.style.height=`${Yn+50}px`),G.style.overflow="visible",G.style.height=`${Yn+50}px`,G.style.width=`${pl+10}px`,await new Promise(Zn=>setTimeout(Zn,150));let Wp=await gc(P,{backgroundColor:Y.bgPrimary,scale:2,logging:!1,useCORS:!0,allowTaint:!0,width:Xn,height:qn,windowWidth:Xn+100,windowHeight:qn+100,scrollX:0,scrollY:0,ignoreElements:Zn=>{let ml=window.getComputedStyle(Zn),ul=parseInt(ml.zIndex,10);return !isNaN(ul)&&ul>=50||ml.position==="fixed"}}),Jn=document.createElement("a");Jn.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,Jn.href=Wp.toDataURL("image/png"),Jn.click();}finally{P.style.overflow=Gt,P.style.height=la,P.style.width=cr,A&&(A.style.overflow=da,A.style.height="",A.scrollTop=se,A.scrollLeft=ue),G.style.overflow=va,G.style.height="",G.style.width=Vo,G.scrollTop=De,G.scrollLeft=gt;}},[Y]),Lp=useCallback(async()=>{await me.exportToPDF(pe);},[pe]),Bp=useCallback(async()=>{await me.exportToExcel(pe);},[pe]),Rp=useCallback(()=>{let P=me.exportToCSV(pe),A=new Blob([P],{type:"text/csv;charset=utf-8;"}),G=document.createElement("a");G.href=URL.createObjectURL(A),G.download="gantt-chart.csv",G.click(),URL.revokeObjectURL(G.href);},[pe]),Op=useCallback(()=>{let P=me.exportToJSON(pe),A=new Blob([P],{type:"application/json;charset=utf-8;"}),G=document.createElement("a");G.href=URL.createObjectURL(A),G.download="gantt-chart.json",G.click(),URL.revokeObjectURL(G.href);},[pe]),zp=useCallback(()=>{me.exportToMSProject(pe,"Gantt Project","project.xml");},[pe]),$p=P=>{P.preventDefault(),dt(true);},Kr=useRef(false);return useEffect(()=>{let P=ie.current,A=ee.current?.querySelector(".gantt-grid-scroll");if(!P||!A)return;let G=()=>{if(Kr.current)return;Kr.current=true;let gt=P.scrollTop;st(gt),A.scrollTop=gt,requestAnimationFrame(()=>{Kr.current=false;});},se=()=>{if(Kr.current)return;Kr.current=true;let gt=A.scrollTop;st(gt),P.scrollTop=gt,requestAnimationFrame(()=>{Kr.current=false;});},ue=gt=>{if(it&&A){let la=A.parentElement?.getBoundingClientRect()?.left||0,da=gt.clientX-la,va=200,cr=ct+Q,Vo=window.innerWidth*oe,Sr=Math.max(cr,Vo);da>=va&&da<=Sr&&F(da);}},De=()=>{dt(false);};return P.addEventListener("scroll",G),A.addEventListener("scroll",se),document.addEventListener("mousemove",ue),document.addEventListener("mouseup",De),()=>{P.removeEventListener("scroll",G),A.removeEventListener("scroll",se),document.removeEventListener("mousemove",ue),document.removeEventListener("mouseup",De);}},[it,ct]),jsx(io.Provider,{value:_e,children:jsx(rs.Provider,{value:V,children:jsxs("div",{ref:R,className:"flex flex-col h-full w-full",style:{backgroundColor:Y.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsx(gn,{theme:Y,timeScale:U,onTimeScaleChange:ke,zoom:ye,onZoomChange:tt,currentTheme:q,onThemeChange:Be,rowDensity:Ne,onRowDensityChange:Fe,showThemeSelector:p,showCreateTaskButton:w,createTaskLabel:g,onCreateTask:f,onExportPNG:i?Ip:void 0,onExportPDF:i?Lp:void 0,onExportExcel:i?Bp:void 0,onExportCSV:i?Rp:void 0,onExportJSON:i?Op:void 0,onExportMSProject:i?zp:void 0}),jsxs("div",{ref:ee,className:"flex-1 flex min-h-0",style:{overflow:"clip",overflowClipMargin:"100px"},children:[jsx("div",{className:"gantt-grid-scroll flex-shrink-0",style:{width:T,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsx(yn,{tasks:Le,theme:Y,rowHeight:Me,availableUsers:u,templates:we,onTaskClick:N,onTaskDblClick:il,onTaskContextMenu:I,onTaskToggle:Qt,scrollTop:Ie,columns:rt,onToggleColumn:Kt,onColumnResize:$t,onTaskUpdate:re,onTaskIndent:Ce,onTaskOutdent:Je,onTaskMove:Oa,onMultiTaskDelete:dr,onTaskDuplicate:rr,onTaskCreate:Dr,onTaskRename:Ut,onCreateSubtask:fo,onOpenTaskModal:N?P=>N(P):void 0,onDeleteRequest:(P,A)=>yt({taskId:P,taskName:A}),onTaskReparent:At})}),jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:Y.border,zIndex:15},onMouseDown:$p}),jsx("div",{ref:ie,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsx(Dn,{tasks:Le,theme:Y,rowHeight:Me,timeScale:U,startDate:Ap,endDate:Fp,zoom:ye,templates:we,onTaskClick:N,onTaskDblClick:il,onTaskContextMenu:sl,onTaskDateChange:Kn,onDependencyCreate:dl,onDependencyDelete:cl})})]}),K.task&&jsx(lo,{isOpen:K.isOpen,x:K.x,y:K.y,theme:Y,onClose:()=>ae({isOpen:false,x:0,y:0,task:null}),items:(()=>{let P=K.task;if(!P)return [];let A=me.findTaskById(pe,P.id)||P;return A.subtasks&&A.subtasks.length>0?[{id:"addSubtask",label:_e.contextMenu?.addSubtask||"Add Subtask",icon:St.Add,onClick:()=>{C?C(A):fo(A.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:_e.contextMenu?.deleteTask||"Delete Task",icon:St.Delete,onClick:()=>{yt({taskId:A.id,taskName:A.name});}}]:[{id:"edit",label:_e.contextMenu?.editTask||"Edit Task",icon:St.Pencil,onClick:()=>{S?S(A):Se(A);}},{id:"addSubtask",label:_e.contextMenu?.addSubtask||"Add Subtask",icon:St.Add,onClick:()=>{C?C(A):fo(A.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:_e.contextMenu?.markIncomplete||"Mark Incomplete",icon:St.MarkIncomplete,onClick:()=>{H?H(A):re(A.id,{status:"todo",progress:0});},disabled:A.status==="todo"},{id:"setInProgress",label:_e.contextMenu?.setInProgress||"Set In Progress",icon:St.SetInProgress,onClick:()=>{B?B(A):re(A.id,{status:"in-progress"});},disabled:A.status==="in-progress"},{id:"markComplete",label:_e.contextMenu?.markComplete||"Mark Complete",icon:St.MarkComplete,onClick:()=>{re(A.id,{status:"completed",progress:100});},disabled:A.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:_e.contextMenu?.splitTask||"Split Task",icon:St.Split,onClick:()=>{if(!A.startDate||!A.endDate){console.warn("Cannot split task without dates");return}let se=A.startDate.getTime(),ue=A.endDate.getTime(),De=se+(ue-se)/2,gt=new Date(De);ho(A,gt);},disabled:!A.startDate||!A.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:_e.contextMenu?.deleteTask||"Delete Task",icon:St.Delete,onClick:()=>{yt({taskId:A.id,taskName:A.name});}}]})()}),ge&&jsx(En,{isOpen:true,onClose:()=>Se(null),task:ge,onSubmit:P=>{re(ge.id,P),Se(null);},mode:"edit",theme:q}),jsx(AnimatePresence,{children:Ke&&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:()=>yt(null),children:jsxs(motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:P=>P.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:Y.bgSecondary,border:`1px solid ${Y.border}`},children:[jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${Y.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:Y.textPrimary,fontFamily:"Inter, sans-serif"},children:[_e.contextMenu?.deleteTask||"Delete Task","?"]}),jsx("p",{className:"text-sm mt-1",style:{color:Y.textSecondary,fontFamily:"Inter, sans-serif"},children:m==="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:Y.textSecondary,fontFamily:"Inter, sans-serif"},children:[m==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxs("span",{className:"font-semibold",style:{color:Y.textPrimary},children:['"',Ke.taskName,'"']}),"."]})}),jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:Y.bgPrimary,borderTop:`1px solid ${Y.border}`},children:[jsx("button",{onClick:()=>yt(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:Y.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:P=>{P.currentTarget.style.backgroundColor=Y.hoverBg;},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="transparent";},children:m==="es"?"Cancelar":"Cancel"}),jsxs("button",{onClick:()=>{dr([Ke.taskId]),yt(null);},className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:"#EF4444",fontFamily:"Inter, sans-serif"},onMouseEnter:P=>{P.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="#EF4444";},children:[jsx(Trash2,{className:"w-4 h-4"}),m==="es"?"Eliminar":"Delete"]})]})]})})}),b?.enabled&&jsx(Pn,{tasks:pe,theme:Y,config:b,onTasksUpdate:Ee,onTaskUpdate:re,onTaskCreate:P=>{Ee(A=>[...A,P]);},onTaskDelete:P=>{dr([P]);},onDependencyCreate:(P,A)=>{let G=me.findTaskById(pe,P);G&&dl(G,A);},onDependencyDelete:cl})]})})})});var hc=`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
|
|
@@ -382,39 +382,39 @@ Tasks have: id, name, startDate, endDate, progress, status, dependencies[], assi
|
|
|
382
382
|
|
|
383
383
|
Always try to match task names case-insensitively and handle partial matches.
|
|
384
384
|
If you can't find a task by name, search through the provided task list.
|
|
385
|
-
If ambiguous, ask for clarification in the message field.`;function
|
|
386
|
-
${
|
|
385
|
+
If ambiguous, ask for clarification in the message field.`;function bc(e){return `CURRENT TASKS:
|
|
386
|
+
${yc(e).map(r=>{let o=r.startDate?r.startDate.toISOString().split("T")[0]:"no date",n=r.endDate?r.endDate.toISOString().split("T")[0]:"no date",s=r.dependencies?.length?`deps: [${r.dependencies.join(", ")}]`:"";return `- ${r.id}: "${r.name}" (${o} to ${n}, ${r.progress}%, ${r.status||"todo"}) ${s}`}).join(`
|
|
387
387
|
`)}
|
|
388
388
|
|
|
389
|
-
Today's date: ${new Date().toISOString().split("T")[0]}`}function fc(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function sr(e,t){let a=fc(e),r=t.toLowerCase().trim(),o=a.find(p=>p.name.toLowerCase()===r);if(o)return o;let n=a.find(p=>p.name.toLowerCase().includes(r));if(n)return n;let s=r.split(/\s+/);return a.find(p=>{let m=p.name.toLowerCase();return s.every(l=>m.includes(l))})}function gi(e,t=new Date){let a=e.toLowerCase().trim(),r=new Date(t);if(r.setHours(0,0,0,0),a==="today"||a==="hoy")return r;if(a==="tomorrow"||a==="ma\xF1ana"){let d=new Date(r);return d.setDate(d.getDate()+1),d}if(a==="yesterday"||a==="ayer"){let d=new Date(r);return d.setDate(d.getDate()-1),d}if(a==="next week"||a==="la pr\xF3xima semana"){let d=new Date(r);return d.setDate(d.getDate()+7),d}let 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 i={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(i!==void 0){let w=new Date(r),g=w.getDay(),b=i-g;return b<=0&&(b+=7),w.setDate(w.getDate()+b),w}}let n=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(n&&n[1]&&n[2]){let d=parseInt(n[1],10),i=n[2].toLowerCase(),w=new Date(r);return i==="day"||i==="d\xEDa"||i==="dias"?w.setDate(w.getDate()+d):i==="week"||i==="semana"||i==="semanas"?w.setDate(w.getDate()+d*7):(i==="month"||i==="mes"||i==="meses")&&w.setMonth(w.getMonth()+d),w}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 d=parseInt(p[1],10),i=parseInt(p[2],10)-1,w=parseInt(p[3],10);return new Date(w,i,d)}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},l=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(l&&l[1]&&l[2]){let d=parseInt(l[1],10),i=m[l[2].toLowerCase()],w=l[3]?parseInt(l[3],10):r.getFullYear();if(i!==void 0)return new Date(w,i,d)}let u={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},c=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(c&&c[1]&&c[2]){let d=u[c[1].toLowerCase()],i=parseInt(c[2],10),w=c[3]?parseInt(c[3],10):r.getFullYear();if(d!==void 0)return new Date(w,d,i)}return null}function fi(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 hi(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 hc(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 bc(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let l=r[1].trim(),u=r[2].trim(),c=sr(t,l),d=gi(u);if(!c)return {type:"move_task",taskName:l,message:`Could not find a task named "${l}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!d)return {type:"move_task",taskId:c.id,taskName:c.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 i=c.startDate&&c.endDate?Math.round((c.endDate.getTime()-c.startDate.getTime())/(1e3*60*60*24)):1,w=new Date(d);return w.setDate(w.getDate()+i),{type:"move_task",taskId:c.id,taskName:c.name,updates:{startDate:d,endDate:w},message:`Moved "${c.name}" to ${d.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let l=o[1].trim(),u=o[2].trim(),c=sr(t,l),d=fi(u);if(!c)return {type:"resize_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"};if(!d||!c.endDate)return {type:"resize_task",taskId:c.id,taskName:c.name,message:`Could not parse the duration "${u}".`,success:false,error:"Invalid duration"};let i=new Date(c.endDate);return i.setDate(i.getDate()+d),{type:"resize_task",taskId:c.id,taskName:c.name,updates:{endDate:i},message:`Extended "${c.name}" by ${d} days. New end date: ${i.toLocaleDateString()}.`,success:true}}let n=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(n&&n[1]&&n[2]){let l=n[1].trim(),u=n[2].trim(),c=sr(t,l),d=hi(u);return c?d===null?{type:"set_progress",taskId:c.id,taskName:c.name,message:`Could not parse the progress value "${u}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:c.id,taskName:c.name,updates:{progress:d},message:`Set "${c.name}" progress to ${d}%.`,success:true}:{type:"set_progress",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}let s=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(s&&s[1]&&s[2]){let l=s[1].trim(),u=s[2].trim(),c=sr(t,l);return c?{type:"rename_task",taskId:c.id,taskName:c.name,updates:{name:u},message:`Renamed "${c.name}" to "${u}".`,success:true}:{type:"rename_task",taskName:l,message:`Could not find a task named "${l}".`,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 l=p[1].trim(),u=p[2].trim(),c=sr(t,l),d=sr(t,u);return c?d?{type:"link_tasks",taskId:d.id,taskName:d.name,dependencyFrom:c.id,dependencyTo:d.id,message:`Linked "${c.name}" \u2192 "${d.name}".`,success:true}:{type:"link_tasks",taskName:u,message:`Could not find a task named "${u}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Source task not found"}}let m=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(m&&m[1]){let l=m[1].trim(),u=sr(t,l);return u?{type:"delete_task",taskId:u.id,taskName:u.name,message:`Deleted "${u.name}".`,success:true}:{type:"delete_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}return null}function yc(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 D0(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 N0(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function En(e,t=[],a=[]){let r=e.assignedUserIds?.map(u=>{let c=a.find(d=>d.id===u);return c?{name:c.name,initials:c.initials,color:c.color}:null}).filter(u=>u!==null),o=t.filter(u=>u.metadata?.parentCardId===e.id).map(u=>En(u,t,a)),n;e.dependencies&&(typeof e.dependencies[0]=="string"?n=e.dependencies:n=e.dependencies.filter(u=>u.type==="finish-to-start").map(u=>u.taskId));let s=u=>{if(u)return typeof u=="string"?new Date(u):u},p=s(e.startDate),m=s(e.endDate),l=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:D0(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:n?.length?n:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:l,isCriticalPath:e.metadata?.isCriticalPath===true}}function vc(e,t=[]){let a;return e.assignees&&e.assignees.length>0&&(a=e.assignees.map(r=>t.find(n=>n.name===r.name||n.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:N0(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function xc(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>En(r,e,t))}var bi={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"}},yi={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"}},Pn={en:bi,es:yi};function vi(e){return Pn[e]||Pn.en}function Mn(e,t){let a=vi(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 Tc(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(...Tc(r.subtasks,t+1));return a}function O0({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 Dc({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:n,style:s}){let{theme:p="dark",locale:m="en",customTranslations:l,showSearch:u=true,showHierarchy:c=true}=t,d=Mn(m,l),i=p==="dark",[w,g]=useState(new Set),[b,h]=useState("startDate"),[v,f]=useState("asc"),[x,T]=useState("");useMemo(()=>{let N=new Set;function C(G){for(let F of G)F.subtasks?.length&&(N.add(F.id),C(F.subtasks));}C(e),g(N);},[e]);let D=useCallback(N=>{g(C=>{let G=new Set(C);return G.has(N)?G.delete(N):G.add(N),G}),a.onTaskToggleExpand?.(N);},[a]),I=useCallback(N=>{b===N?f(C=>C==="asc"?"desc":"asc"):(h(N),f("asc")),a.onSortChange?.({column:N,direction:v==="asc"?"desc":"asc"});},[b,v,a]),k=useMemo(()=>{let N=Tc(e);if(x.trim()){let G=x.toLowerCase();N=N.filter(F=>F.name.toLowerCase().includes(G));}let C=[];for(let G of N){let F=G.level===0;G.level>0&&(F=true),(F||x.trim())&&C.push(G);}return x.trim()&&C.sort((G,F)=>{let J,K;switch(b){case "name":J=G.name.toLowerCase(),K=F.name.toLowerCase();break;case "startDate":J=G.startDate?.getTime()||0,K=F.startDate?.getTime()||0;break;case "endDate":J=G.endDate?.getTime()||0,K=F.endDate?.getTime()||0;break;case "progress":J=G.progress||0,K=F.progress||0;break;case "status":J=G.status||"todo",K=F.status||"todo";break;default:return 0}return J<K?v==="asc"?-1:1:J>K?v==="asc"?1:-1:0}),C},[e,x,b,v]),L=N=>N?(N instanceof Date?N:new Date(N)).toLocaleDateString(m==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-";return r?jsx("div",{className:y("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",n),style:s,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:y("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:[d.empty.noTasks,"..."]})]})}):o?jsx("div",{className:y("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",n),style:s,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:y("text-lg font-semibold mb-2",i?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:y("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsx("div",{className:y("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",n),style:s,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:y("text-lg font-semibold mb-2",i?"text-white":"text-gray-900"),children:d.empty.noTasks}),jsx("p",{className:y("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:d.empty.addFirstTask})]})}):jsxs("div",{className:y("flex-1 flex flex-col w-full h-full overflow-hidden",i?"bg-[#0F1117]":"bg-white",n),style:s,children:[jsx("div",{className:y("flex-shrink-0 px-6 py-4 border-b",i?"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:y("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",i?"text-[#9CA3AF]":"text-gray-400")}),jsx("input",{type:"text",value:x,onChange:N=>T(N.target.value),placeholder:d.toolbar.searchPlaceholder,className:y("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",i?"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:y("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:[k.length," ",d.pagination.tasks]})]})}),jsxs("div",{className:y("flex-shrink-0 grid grid-cols-12 gap-4 px-6 py-3 border-b text-xs font-medium uppercase tracking-wider",i?"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:()=>I("name"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[d.columns.name,jsx(ArrowUpDown,{className:"w-3 h-3"})]})}),jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxs("button",{onClick:()=>I("status"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[d.columns.status,jsx(ArrowUpDown,{className:"w-3 h-3"})]})}),jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxs("button",{onClick:()=>I("startDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[d.columns.startDate,jsx(ArrowUpDown,{className:"w-3 h-3"})]})}),jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxs("button",{onClick:()=>I("endDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[d.columns.endDate,jsx(ArrowUpDown,{className:"w-3 h-3"})]})}),jsx("div",{className:"col-span-1 flex items-center gap-1",children:jsxs("button",{onClick:()=>I("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:k.map((N,C)=>{let G=w.has(N.id);return jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:C*.02},className:y("grid grid-cols-12 gap-4 px-6 py-3 border-b transition-colors cursor-pointer",i?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),style:{paddingLeft:c?`${24+N.level*24}px`:void 0},onClick:()=>a.onTaskClick?.(N),onDoubleClick:()=>a.onTaskDoubleClick?.(N),children:[jsxs("div",{className:"col-span-5 flex items-center gap-2 min-w-0",children:[c&&N.hasChildren&&jsx("button",{onClick:F=>{F.stopPropagation(),D(N.id);},className:y("p-0.5 rounded",i?"hover:bg-white/10":"hover:bg-gray-200"),children:G?jsx(ChevronDown,{className:y("w-4 h-4",i?"text-[#9CA3AF]":"text-gray-400")}):jsx(ChevronRight,{className:y("w-4 h-4",i?"text-[#9CA3AF]":"text-gray-400")})}),c&&!N.hasChildren&&jsx("div",{className:"w-5"}),jsx("button",{onClick:F=>{F.stopPropagation(),a.onTaskUpdate?.({...N,progress:N.progress===100?0:100,status:N.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsx(O0,{status:N.status,progress:N.progress})}),jsx("span",{className:y("truncate",i?"text-white":"text-gray-900",N.progress===100&&(i?"line-through text-[#6B7280]":"line-through text-gray-400")),children:N.name})]}),jsx("div",{className:"col-span-2 flex items-center",children:jsx("span",{className:y("px-2 py-1 rounded-full text-xs font-medium",N.progress===100||N.status==="completed"?"bg-green-500/10 text-green-500":N.progress&&N.progress>0||N.status==="in-progress"?"bg-blue-500/10 text-blue-500":i?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:N.progress===100||N.status==="completed"?d.status.completed:N.progress&&N.progress>0||N.status==="in-progress"?d.status.inProgress:d.status.todo})}),jsxs("div",{className:y("col-span-2 flex items-center gap-1 text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:[jsx(Calendar,{className:"w-4 h-4"}),L(N.startDate)]}),jsxs("div",{className:y("col-span-2 flex items-center gap-1 text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:[jsx(Clock,{className:"w-4 h-4"}),L(N.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:y("flex-1 h-1.5 rounded-full overflow-hidden",i?"bg-white/10":"bg-gray-200"),children:jsx("div",{className:y("h-full rounded-full transition-all",N.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${N.progress||0}%`}})}),jsxs("span",{className:y("text-xs w-8",i?"text-[#9CA3AF]":"text-gray-500"),children:[N.progress||0,"%"]})]})})]},N.id)})}),k.length===0&&x&&jsx("div",{className:"flex items-center justify-center py-12",children:jsxs("div",{className:"text-center",children:[jsx(List,{className:y("w-12 h-12 mx-auto mb-4",i?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:y(i?"text-[#9CA3AF]":"text-gray-600"),children:d.empty.noResults})]})})]})]})}var xi={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"},ki={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"},wi={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"},In={dark:xi,light:ki,neutral:wi};function Nc(e){return In[e]||In.dark}var Ci={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"}},Ti={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"}},Fn={en:Ci,es:Ti};function Lo(e){return Fn[e]||Fn.en}function Ln(e,t){let a=Lo(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 Sc(e){let t=Lo(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 Ec(e,t=0,a=true){let r=Lo(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 th(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 Pi(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 Ic({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 Lc({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:n,className:s,style:p,availableTags:m=[],onCreateTag:l,attachmentsByTask:u}){let{theme:c="dark",locale:d="en",customTranslations:i}=t,w=Ln(d,i),g=c==="dark",b={textTertiary:g?"#6B7280":"#9CA3AF",textSecondary:g?"#9CA3AF":"#6B7280",textPrimary:g?"#FFFFFF":"#111827",borderLight:g?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:g?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:g?"#1A1D25":"#FFFFFF",bgSecondary:g?"#0F1117":"#F9FAFB",hoverBg:g?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},[h,v]=useState(r||new Date),[f,x]=useState(null),[T,D]=useState(null),[I,k]=useState(null),[L,N]=useState(new Date),[C,G]=useState({}),F=4,J=3,[K,de]=useState(false),[ge,Te]=useState(false),[Ce,z]=useState(false),[B,$]=useState(false),[P,Q]=useState(null),[ee,H]=useState(""),[De,Ee]=useState(void 0),[Be,xe]=useState(null),[U,ae]=useState(false),[Me,_e]=useState(false),[qe,Ke]=useState(null),[O,re]=useState(false),[ce,fe]=useState(new Date),[Ae,ot]=useState(false),[kt,Le]=useState(false),ke=useCallback(()=>{v(new Date(h.getFullYear(),h.getMonth()-1,1));},[h]),Ie=useCallback(()=>{v(new Date(h.getFullYear(),h.getMonth()+1,1));},[h]),Zt=useCallback(()=>{v(new Date);},[]),vt=useMemo(()=>{let A=h.getFullYear(),ue=h.getMonth(),_=new Date(A,ue,1),Z=new Date(A,ue+1,0),ve=_.getDay(),Y=Z.getDate(),ne=th(e),R=new Date;R.setHours(0,0,0,0);let W=[],Ne=ve,et=new Date(A,ue,0).getDate();for(let mt=Ne-1;mt>=0;mt--){let Re=new Date(A,ue-1,et-mt);W.push({date:Re,isCurrentMonth:false,isToday:false,isWeekend:Re.getDay()===0||Re.getDay()===6,events:ne.filter(ut=>Pi(Re,ut)).map(ut=>({id:ut.id,title:ut.name,start:ut.startDate,end:ut.endDate,task:ut}))});}for(let mt=1;mt<=Y;mt++){let Re=new Date(A,ue,mt),ut=Re.getTime()===R.getTime();W.push({date:Re,isCurrentMonth:true,isToday:ut,isWeekend:Re.getDay()===0||Re.getDay()===6,events:ne.filter($t=>Pi(Re,$t)).map($t=>({id:$t.id,title:$t.name,start:$t.startDate,end:$t.endDate,task:$t}))});}let $e=42-W.length;for(let mt=1;mt<=$e;mt++){let Re=new Date(A,ue+1,mt);W.push({date:Re,isCurrentMonth:false,isToday:false,isWeekend:Re.getDay()===0||Re.getDay()===6,events:ne.filter(ut=>Pi(Re,ut)).map(ut=>({id:ut.id,title:ut.name,start:ut.startDate,end:ut.endDate,task:ut}))});}return W},[h,e]),sa=d==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Na=h.toLocaleDateString(d==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),Oe=useCallback((A,ue)=>{if(!f)return;let _={...f,[A]:ue};x(_),a.onTaskUpdate?.(_);},[f,a]),Ue=useCallback(A=>{if(!f)return;let ue=f.progress||0;A==="completed"?ue=100:A==="todo"&&(ue=0);let _={...f,status:A,progress:ue};x(_),a.onTaskUpdate?.(_),de(false);},[f,a]),qt=useCallback((A,ue)=>{if(!f)return;let _={...f,startDate:A,endDate:ue};x(_),a.onTaskUpdate?.(_);},[f,a]),he=useCallback(()=>{de(false),Te(false),z(false),k(null);},[]),Ge=useCallback(async A=>{if(A.preventDefault(),A.stopPropagation(),ot(false),!f||!a.onUploadAttachments)return;let ue=Array.from(A.dataTransfer.files);if(ue.length!==0){Le(true);try{await a.onUploadAttachments(f.id,ue);}finally{Le(false);}}},[f,a]),Fe=useCallback(async A=>{if(!f||!a.onUploadAttachments||!A.target.files)return;let ue=Array.from(A.target.files);if(ue.length!==0){Le(true);try{await a.onUploadAttachments(f.id,ue);}finally{Le(false);}A.target.value="";}},[f,a]),tt=useCallback(A=>{A.preventDefault(),A.stopPropagation(),ot(true);},[]),Xe=useCallback(A=>{A.preventDefault(),A.stopPropagation(),ot(false);},[]),wt=useCallback(A=>A<1024?`${A} B`:A<1024*1024?`${(A/1024).toFixed(1)} KB`:`${(A/(1024*1024)).toFixed(1)} MB`,[]),st=useCallback(A=>A.startsWith("image/")?Image:A.includes("pdf")||A.includes("document")?FileText:File,[]),Qe=useMemo(()=>!f||!u?[]:u.get(f.id)||[],[f,u]);return o?jsx("div",{className:y("flex-1 flex items-center justify-center",g?"bg-[#0F1117]":"bg-white",s),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:y("text-sm",g?"text-[#9CA3AF]":"text-gray-600"),children:[w.labels.noEvents,"..."]})]})}):n?jsx("div",{className:y("flex-1 flex items-center justify-center",g?"bg-[#0F1117]":"bg-white",s),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:y("text-lg font-semibold mb-2",g?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:y("text-sm",g?"text-[#9CA3AF]":"text-gray-600"),children:typeof n=="string"?n:n.message})]})]})}):e.length===0?jsx("div",{className:y("flex-1 flex items-center justify-center",g?"bg-[#0F1117]":"bg-white",s),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:y("text-lg font-semibold mb-2",g?"text-white":"text-gray-900"),children:w.labels.noEvents}),jsx("p",{className:y("text-sm",g?"text-[#9CA3AF]":"text-gray-600"),children:w.labels.newTask})]})}):jsxs("div",{className:y("flex-1 flex flex-col w-full h-full overflow-auto",g?"bg-[#0F1117]":"bg-white",s),style:p,children:[jsx("div",{className:y("flex-shrink-0 px-6 py-4 border-b",g?"border-white/10":"border-gray-200"),children:jsxs("div",{className:"flex items-center justify-between",children:[jsxs("div",{className:"flex items-center gap-4",children:[jsx("h2",{className:y("text-xl font-semibold capitalize",g?"text-white":"text-gray-900"),children:Na}),jsx("button",{onClick:Zt,className:y("px-3 py-1.5 text-sm rounded-lg transition-colors",g?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:w.navigation.today})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("button",{onClick:ke,className:y("p-2 rounded-lg transition-colors",g?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:y("w-5 h-5",g?"text-[#9CA3AF]":"text-gray-600")})}),jsx("button",{onClick:Ie,className:y("p-2 rounded-lg transition-colors",g?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:y("w-5 h-5",g?"text-[#9CA3AF]":"text-gray-600")})})]})]})}),jsx("div",{className:"flex-1 p-6 min-h-0",children:jsxs("div",{className:"flex flex-col",children:[jsx("div",{className:"grid grid-cols-7 gap-px mb-2",children:sa.map(A=>jsx("div",{className:y("py-2 text-center text-xs font-medium uppercase",g?"text-[#9CA3AF]":"text-gray-500"),children:A},A))}),jsx("div",{className:y("grid grid-cols-7 auto-rows-min gap-px rounded-lg",g?"bg-[#2D2D2D]":"bg-gray-300"),children:vt.map((A,ue)=>{let _=A.date.getDay()===0||A.date.getDay()===6;return jsxs("div",{className:y("min-h-[120px] p-2 transition-colors flex flex-col relative group",g?_?"bg-[#1C1F26]":A.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":_?"bg-gray-100":A.isCurrentMonth?"bg-white":"bg-gray-50",A.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let Z=C[ue]||F,ve=A.events.slice(0,Z),Y=A.events.length-Z;return jsxs("div",{className:"space-y-1 flex-1",children:[ve.map(ne=>jsx("div",{className:"relative group",children:jsxs(motion.button,{onClick:()=>{x(ne.task),a.onEventClick?.(ne);},whileHover:{scale:1.02},className:y("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",ne.task.progress===100?g?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":g?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsx(Ic,{task:ne.task}),jsx("span",{className:"truncate",children:ne.title})]})},ne.id)),Y>0&&jsxs("button",{onClick:ne=>{ne.stopPropagation(),G(R=>({...R,[ue]:Z+J}));},className:y("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",g?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",Y," ",d==="es"?"M\xC1S":"MORE"]}),Z>F&&A.events.length>F&&jsx("button",{onClick:ne=>{ne.stopPropagation(),G(R=>({...R,[ue]:F}));},className:y("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",g?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:d==="es"?"MENOS":"LESS"})]})})(),jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let Z=ue>=28,ve=ue%7>=5;return jsxs("div",{className:"relative",children:[jsx("button",{onClick:Y=>{Y.stopPropagation(),P===ue?Q(null):(Q(ue),H(""),Ee(void 0),xe(null),Ke(null),ae(false),_e(false),re(false),fe(A.date));},className:y("w-5 h-5 rounded flex items-center justify-center transition-all",P===ue?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",g?"hover:bg-[#7C3AED] text-[#6B7280] hover:text-white":"hover:bg-[#7C3AED] text-gray-400 hover:text-white"),children:jsx(Plus,{className:y("w-3.5 h-3.5 transition-transform",P===ue&&"rotate-45")})}),jsx(AnimatePresence,{children:P===ue&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Q(null),H(""),Ee(void 0),xe(null),Ke(null),ae(false),_e(false),re(false);}}),jsxs(motion.div,{initial:{opacity:0,y:Z?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:Z?-5:5,scale:.95},transition:{duration:.12},className:y("absolute w-[320px] rounded-lg shadow-2xl z-50",Z?"bottom-full mb-1":"top-full mt-1",ve?"right-0":"left-0",g?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:Y=>{Y.stopPropagation(),ae(false),_e(false),re(false);},children:[jsx("div",{className:"p-2.5",children:jsx("input",{type:"text",value:ee,onChange:Y=>H(Y.target.value),placeholder:d==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:y("w-full bg-transparent text-sm outline-none placeholder:opacity-40",g?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:Y=>{if(Y.key==="Enter"&&ee.trim()){let ne=t.availableUsers?.find(W=>W.id===Be),R=qe||A.date;a.onTaskCreate?.({name:ee.trim(),startDate:R,endDate:R,priority:De,assignees:ne?[ne]:void 0}),H(""),Ee(void 0),xe(null),Ke(null),Q(null);}Y.key==="Escape"&&(Q(null),H(""),Ee(void 0),xe(null),Ke(null));}})}),jsxs("div",{className:y("px-2.5 py-2 flex items-center justify-between border-t",g?"border-white/10":"border-gray-100"),children:[jsxs("div",{className:"flex items-center gap-1",children:[jsxs("div",{className:"relative",children:[jsx("button",{onClick:Y=>{Y.stopPropagation(),ae(!U),_e(false);},className:y("p-1 rounded transition-colors",De?De==="urgent"||De==="high"?"text-red-400 bg-red-500/20":De==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":g?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsx(Flag,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:U&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:y("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",g?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:Y=>Y.stopPropagation(),children:[{id:"urgent",label:d==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:d==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:d==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:d==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:d==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(Y=>jsxs("button",{onClick:()=>{Ee(Y.id),ae(false);},className:y("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",g?"hover:bg-white/5":"hover:bg-gray-50",De===Y.id&&(g?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:y("w-2 h-2 rounded-full",Y.color)}),jsx("span",{className:g?"text-white":"text-gray-900",children:Y.label})]},Y.id||"none"))})})]}),jsxs("div",{className:"relative",children:[jsxs("button",{onClick:Y=>{Y.stopPropagation(),re(!O),ae(false),_e(false),fe(qe||A.date);},className:y("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",qe?"bg-[#7C3AED]/20 text-[#7C3AED]":g?"bg-white/5 text-[#9CA3AF] hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsx(CalendarDays,{className:"w-3 h-3"}),(qe||A.date).toLocaleDateString(d==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsx(AnimatePresence,{children:O&&jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:y("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",g?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:Y=>Y.stopPropagation(),children:[jsx("div",{className:y("w-40 py-2 border-r",g?"border-white/10":"border-gray-200"),children:(()=>{let Y=new Date,ne=new Date(Y);ne.setDate(Y.getDate()+1);let R=new Date(Y);R.setDate(Y.getDate()+((6-Y.getDay()+7)%7||7));let W=new Date(Y);W.setDate(Y.getDate()+((1-Y.getDay()+7)%7||7));let Ne=new Date(Y);Ne.setDate(Y.getDate()+14);let et=new Date(Y);return et.setDate(Y.getDate()+28),[{label:d==="es"?"Hoy":"Today",date:Y,display:Y.toLocaleDateString(d==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:d==="es"?"Ma\xF1ana":"Tomorrow",date:ne,display:ne.toLocaleDateString(d==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:d==="es"?"Este fin de semana":"This weekend",date:R,display:d==="es"?"s\xE1b.":"sat."},{label:d==="es"?"Pr\xF3xima semana":"Next week",date:W,display:d==="es"?"lun.":"mon."},{label:d==="es"?"2 semanas":"2 weeks",date:Ne,display:Ne.toLocaleDateString(d==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:d==="es"?"4 semanas":"4 weeks",date:et,display:et.toLocaleDateString(d==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((mt,Re)=>jsxs("button",{className:y("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",g?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{Ke(mt.date),re(false);},children:[jsx("span",{children:mt.label}),jsx("span",{className:y("text-[10px]",g?"text-[#6B7280]":"text-gray-400"),children:mt.display})]},Re))})()}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("span",{className:y("text-xs font-medium",g?"text-white":"text-gray-900"),children:ce.toLocaleDateString(d==="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:y("px-1.5 py-0.5 rounded text-[10px] transition-colors",g?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:d==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>fe(new Date(ce.getFullYear(),ce.getMonth()-1)),className:y("p-0.5 rounded",g?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-3.5 h-3.5"})}),jsx("button",{onClick:()=>fe(new Date(ce.getFullYear(),ce.getMonth()+1)),className:y("p-0.5 rounded",g?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:(d==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(Y=>jsx("div",{className:y("w-6 h-6 flex items-center justify-center text-[10px]",g?"text-[#6B7280]":"text-gray-400"),children:Y},Y))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let Y=ce.getFullYear(),ne=ce.getMonth(),R=new Date(Y,ne,1).getDay(),W=new Date(Y,ne+1,0).getDate(),Ne=new Date(Y,ne,0).getDate(),et=new Date,$e=[];for(let Re=R-1;Re>=0;Re--)$e.push({dayNum:Ne-Re,isCurrentMonth:false,date:new Date(Y,ne-1,Ne-Re)});for(let Re=1;Re<=W;Re++)$e.push({dayNum:Re,isCurrentMonth:true,date:new Date(Y,ne,Re)});let mt=42-$e.length;for(let Re=1;Re<=mt;Re++)$e.push({dayNum:Re,isCurrentMonth:false,date:new Date(Y,ne+1,Re)});return $e.map((Re,ut)=>{let $t=Re.date.toDateString()===et.toDateString(),se=(qe||A.date).toDateString()===Re.date.toDateString();return jsx("button",{className:y("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!Re.isCurrentMonth&&(g?"text-[#4B5563]":"text-gray-300"),Re.isCurrentMonth&&(g?"text-white":"text-gray-900"),$t&&"ring-1 ring-[#3B82F6]",se&&"bg-[#7C3AED] text-white",!se&&(g?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{Ke(Re.date),re(false);},children:Re.dayNum},ut)})})()})]})]})})]}),jsxs("div",{className:"relative",children:[jsx("button",{onClick:Y=>{Y.stopPropagation(),_e(!Me),ae(false);},className:y("p-1 rounded transition-colors",Be?"text-[#7C3AED] bg-[#7C3AED]/20":g?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:Be?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(Y=>Y.id===Be)?.color||"#7C3AED"},children:t.availableUsers?.find(Y=>Y.id===Be)?.initials||t.availableUsers?.find(Y=>Y.id===Be)?.name?.slice(0,2).toUpperCase()}):jsx(User,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:Me&&jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:y("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",g?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:Y=>Y.stopPropagation(),children:[jsxs("button",{onClick:()=>{xe(null),_e(false);},className:y("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",g?"hover:bg-white/5":"hover:bg-gray-50",!Be&&(g?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:y("w-5 h-5 rounded-full flex items-center justify-center",g?"bg-white/10":"bg-gray-200"),children:jsx(User,{className:"w-3 h-3 text-gray-400"})}),jsx("span",{className:g?"text-[#9CA3AF]":"text-gray-500",children:d==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(Y=>jsxs("button",{onClick:()=>{xe(Y.id),_e(false);},className:y("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",g?"hover:bg-white/5":"hover:bg-gray-50",Be===Y.id&&(g?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-white text-[9px] font-medium",style:{backgroundColor:Y.color||"#7C3AED"},children:Y.initials||Y.name?.slice(0,2).toUpperCase()}),jsx("span",{className:g?"text-white":"text-gray-900",children:Y.name})]},Y.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsx("div",{className:y("px-3 py-2 text-xs",g?"text-[#6B7280]":"text-gray-400"),children:d==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsx("button",{onClick:()=>{if(ee.trim()){let Y=t.availableUsers?.find(R=>R.id===Be),ne=qe||A.date;a.onTaskCreate?.({name:ee.trim(),startDate:ne,endDate:ne,priority:De,assignees:Y?[Y]:void 0}),H(""),Ee(void 0),xe(null),Ke(null),Q(null);}},disabled:!ee.trim(),className:y("px-2.5 py-1 rounded text-xs font-medium transition-colors",ee.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":g?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:d==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsx("span",{className:y("text-sm font-medium",A.isToday?"text-[#3B82F6]":A.isCurrentMonth?g?"text-white":"text-gray-900":g?"text-[#6B7280]":"text-gray-400"),children:A.date.getDate()})]})]},ue)})})]})}),jsx(AnimatePresence,{children:f&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>x(null),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:y("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",g?"bg-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxs("div",{className:y("px-6 py-3 border-b flex items-center gap-3",g?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Circle,{className:y("w-4 h-4",g?"text-[#9CA3AF]":"text-gray-500")}),jsxs("span",{className:y("text-xs px-2 py-0.5 rounded",g?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[d==="es"?"Tarea":"Task"," \u2228"]}),jsx("span",{className:y("text-xs font-mono",g?"text-[#6B7280]":"text-gray-400"),children:f.id.slice(0,8)}),jsxs("button",{className:y("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",g?"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:y("p-1.5 rounded transition-colors",g?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(Maximize2,{className:"w-4 h-4"})}),jsx("button",{className:y("p-1.5 rounded transition-colors",g?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(MoreHorizontal,{className:"w-5 h-5"})}),jsx("button",{onClick:()=>x(null),className:y("p-1.5 rounded transition-colors",g?"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 A=f.progress===100?0:100,_={...f,progress:A,status:A===100?"completed":"todo"};x(_),a.onTaskUpdate?.(_);},className:y("mt-1 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors",f.progress===100?"bg-green-500 border-green-500":g?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:f.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("h2",{className:y("text-xl font-semibold flex-1",f.progress===100?"line-through text-[#6B7280]":g?"text-white":"text-gray-900"),children:f.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:y("w-4 h-4",g?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:y("text-sm w-24",g?"text-[#9CA3AF]":"text-gray-500"),children:d==="es"?"Estado":"Status"}),jsx("button",{onClick:()=>{he(),de(!K);},className:y("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",f.progress===100||f.status==="completed"?"bg-green-500/20 text-green-400":f.progress&&f.progress>0||f.status==="in-progress"?"bg-blue-500/20 text-blue-400":g?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:f.progress===100||f.status==="completed"?d==="es"?"COMPLETADO":"DONE":f.progress&&f.progress>0||f.status==="in-progress"?d==="es"?"EN PROGRESO":"IN PROGRESS":d==="es"?"POR HACER":"TO DO"}),jsx(AnimatePresence,{children:K&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>de(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:y("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",g?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:d==="es"?"Por hacer":"To Do",color:"bg-white/10 text-white"},{id:"in-progress",label:d==="es"?"En progreso":"In Progress",color:"bg-blue-500/20 text-blue-400"},{id:"completed",label:d==="es"?"Completado":"Done",color:"bg-green-500/20 text-green-400"}].map(A=>jsxs("button",{onClick:()=>Ue(A.id),className:y("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",g?"hover:bg-white/5":"hover:bg-gray-50",(f.status===A.id||A.id==="completed"&&f.progress===100||A.id==="in-progress"&&f.progress&&f.progress>0&&f.progress<100||A.id==="todo"&&(!f.progress||f.progress===0)&&f.status!=="in-progress"&&f.status!=="completed")&&(g?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:y("w-2 h-2 rounded-full",A.id==="completed"?"bg-green-500":A.id==="in-progress"?"bg-blue-500":"bg-gray-400")}),jsx("span",{className:g?"text-white":"text-gray-900",children:A.label})]},A.id))})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(User,{className:y("w-4 h-4",g?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:y("text-sm w-24",g?"text-[#9CA3AF]":"text-gray-500"),children:d==="es"?"Asignados":"Assignees"}),jsxs("button",{onClick:()=>{de(false),Te(false),k(null),z(!Ce);},className:y("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",g?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[f.assignees&&f.assignees.length>0?jsxs("div",{className:"flex items-center gap-1",children:[f.assignees.slice(0,3).map((A,ue)=>jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:A.color||"#8B5CF6"},title:A.name,children:A.initials||A.name.slice(0,2).toUpperCase()},ue)),f.assignees.length>3&&jsxs("span",{className:y("text-xs",g?"text-[#6B7280]":"text-gray-400"),children:["+",f.assignees.length-3]})]}):jsx("span",{className:y("text-sm",g?"text-[#6B7280]":"text-gray-400"),children:d==="es"?"Agregar":"Add"}),jsx(ChevronDown,{className:y("w-3 h-3",g?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:Ce&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>z(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:y("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",g?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:t.availableUsers&&t.availableUsers.length>0?t.availableUsers.map(A=>{let ue=f.assignees?.some(_=>_.name===A.name);return jsxs("button",{onClick:()=>{let _=f.assignees||[],Z;ue?Z=_.filter(ve=>ve.name!==A.name):Z=[..._,{name:A.name,avatar:A.avatar,initials:A.initials||A.name.slice(0,2).toUpperCase(),color:A.color||"#8B5CF6"}],Oe("assignees",Z);},className:y("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",g?"hover:bg-white/5":"hover:bg-gray-50",ue&&(g?"bg-white/5":"bg-gray-50")),children:[A.avatar?jsx("img",{src:A.avatar,alt:A.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:A.color||"#8B5CF6"},children:A.initials||A.name.slice(0,2).toUpperCase()}),jsx("span",{className:y("flex-1 text-left",g?"text-white":"text-gray-900"),children:A.name}),ue&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},A.id||A.name)}):jsx("div",{className:y("px-3 py-4 text-sm text-center",g?"text-[#6B7280]":"text-gray-400"),children:d==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CalendarDays,{className:y("w-4 h-4",g?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:y("text-sm w-24",g?"text-[#9CA3AF]":"text-gray-500"),children:d==="es"?"Fechas":"Dates"}),jsxs("button",{onClick:()=>{k(I?null:"start"),N(f.startDate||new Date);},className:y("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",g?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[f.startDate?.toLocaleDateString(d==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(d==="es"?"Inicio":"Start"),jsx("span",{className:y("mx-1",g?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),f.endDate?.toLocaleDateString(d==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(d==="es"?"Fin":"End"),(f.startDate||f.endDate)&&jsx(X,{className:"w-3.5 h-3.5 ml-1 opacity-50 hover:opacity-100",onClick:A=>{A.stopPropagation();}})]}),jsx(AnimatePresence,{children:I&&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:y("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",g?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:A=>A.stopPropagation(),children:[jsxs("div",{className:y("w-44 py-2 border-r",g?"border-white/10":"border-gray-200"),children:[(()=>{let A=new Date,ue=new Date(A);ue.setDate(A.getDate()+1);let _=new Date(A);_.setDate(A.getDate()+((6-A.getDay()+7)%7||7));let Z=new Date(A);Z.setDate(A.getDate()+((1-A.getDay()+7)%7||7));let ve=new Date(A);ve.setDate(A.getDate()+(6-A.getDay()+7)%7+7);let Y=new Date(A);Y.setDate(A.getDate()+14);let ne=new Date(A);return ne.setDate(A.getDate()+28),[{label:d==="es"?"Hoy":"Today",date:A,display:A.toLocaleDateString(d==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:d==="es"?"Ma\xF1ana":"Tomorrow",date:ue,display:ue.toLocaleDateString(d==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:d==="es"?"Este fin de semana":"This weekend",date:_,display:d==="es"?"s\xE1b.":"sat."},{label:d==="es"?"Pr\xF3xima semana":"Next week",date:Z,display:d==="es"?"lun.":"mon."},{label:d==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:ve,display:ve.toLocaleDateString(d==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:d==="es"?"2 semanas":"2 weeks",date:Y,display:Y.toLocaleDateString(d==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:d==="es"?"4 semanas":"4 weeks",date:ne,display:ne.toLocaleDateString(d==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((W,Ne)=>jsxs("button",{className:y("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",g?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(I==="start"){let et=f.endDate&&W.date>f.endDate?W.date:f.endDate;qt(W.date,et),k("end");}else {let et=f.startDate&&W.date<f.startDate?W.date:f.startDate;qt(et,W.date),k(null);}},children:[jsx("span",{children:W.label}),jsx("span",{className:y("text-xs",g?"text-[#6B7280]":"text-gray-400"),children:W.display})]},Ne))})(),jsx("div",{className:y("border-t mt-2 pt-2",g?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{qt(void 0,void 0),k(null);},className:y("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",g?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:d==="es"?"Quitar fechas":"Clear dates"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[jsx("div",{className:y("text-xs mb-3 px-2 py-1 rounded",g?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:I==="start"?d==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":d==="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:y("font-medium",g?"text-white":"text-gray-900"),children:L.toLocaleDateString(d==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>N(new Date),className:y("p-1 rounded text-sm transition-colors",g?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:d==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>N(new Date(L.getFullYear(),L.getMonth()-1)),className:y("p-1 rounded",g?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-4 h-4"})}),jsx("button",{onClick:()=>N(new Date(L.getFullYear(),L.getMonth()+1)),className:y("p-1 rounded",g?"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:(d==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(A=>jsx("div",{className:y("w-8 h-8 flex items-center justify-center text-xs",g?"text-[#6B7280]":"text-gray-400"),children:A},A))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let A=L.getFullYear(),ue=L.getMonth(),_=new Date(A,ue,1).getDay(),Z=new Date(A,ue+1,0).getDate(),ve=new Date(A,ue,0).getDate(),Y=new Date,ne=[];for(let W=_-1;W>=0;W--)ne.push({day:ve-W,isCurrentMonth:false,date:new Date(A,ue-1,ve-W)});for(let W=1;W<=Z;W++)ne.push({day:W,isCurrentMonth:true,date:new Date(A,ue,W)});let R=42-ne.length;for(let W=1;W<=R;W++)ne.push({day:W,isCurrentMonth:false,date:new Date(A,ue+1,W)});return ne.map((W,Ne)=>{let et=W.date.toDateString()===Y.toDateString(),$e=f.startDate?.toDateString()===W.date.toDateString(),mt=f.endDate?.toDateString()===W.date.toDateString(),Re=$e||mt,ut=f.startDate&&f.endDate&&W.date>=f.startDate&&W.date<=f.endDate;return jsx("button",{className:y("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!W.isCurrentMonth&&(g?"text-[#4B5563]":"text-gray-300"),W.isCurrentMonth&&(g?"text-white":"text-gray-900"),et&&"ring-2 ring-[#3B82F6]",$e&&"bg-[#3B82F6] text-white",mt&&!$e&&"bg-[#7C3AED] text-white",ut&&!Re&&(g?"bg-[#7C3AED]/20":"bg-purple-100"),!Re&&(g?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{let $t=new Date(W.date);if(I==="start"){let se=f.endDate&&$t>f.endDate?$t:f.endDate;qt($t,se),k("end");}else {let se=f.startDate&&$t<f.startDate?$t:f.startDate;qt(se,$t),k(null);}},children:W.day},Ne)})})()})]})]})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Flag,{className:y("w-4 h-4",g?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:y("text-sm w-24",g?"text-[#9CA3AF]":"text-gray-500"),children:d==="es"?"Prioridad":"Priority"}),jsx("button",{onClick:()=>{he(),Te(!ge);},className:y("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",f.priority==="high"||f.priority==="urgent"?"bg-red-500/20 text-red-400":f.priority==="medium"?"bg-yellow-500/20 text-yellow-400":f.priority==="low"?"bg-green-500/20 text-green-400":g?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:f.priority?f.priority==="high"||f.priority==="urgent"?d==="es"?"Urgente":"Urgent":f.priority==="medium"?d==="es"?"Media":"Medium":d==="es"?"Baja":"Low":d==="es"?"Sin prioridad":"No priority"}),jsx(AnimatePresence,{children:ge&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Te(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:y("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",g?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:d==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:d==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:d==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:d==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:d==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(A=>jsxs("button",{onClick:()=>{Oe("priority",A.id),Te(false);},className:y("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",g?"hover:bg-white/5":"hover:bg-gray-50",f.priority===A.id&&(g?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:y("w-2 h-2 rounded-full",A.color)}),jsx("span",{className:g?"text-white":"text-gray-900",children:A.label})]},A.id||"none"))})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:y("w-4 h-4",g?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:y("text-sm w-24",g?"text-[#9CA3AF]":"text-gray-500"),children:d==="es"?"Duraci\xF3n":"Duration"}),jsx("span",{className:y("text-sm",g?"text-white":"text-gray-900"),children:f.startDate&&f.endDate?`${Math.ceil((f.endDate.getTime()-f.startDate.getTime())/(1e3*60*60*24))} ${d==="es"?"d\xEDas":"days"}`:d==="es"?"Sin definir":"Not set"})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:y("w-4 h-4 rounded-full border-2",g?"border-[#6B7280]":"border-gray-400")}),jsx("span",{className:y("text-sm w-24",g?"text-[#9CA3AF]":"text-gray-500"),children:d==="es"?"Progreso":"Progress"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[B?jsx("input",{type:"range",min:"0",max:"100",step:"5",value:f.progress||0,onChange:A=>{let ue=parseInt(A.target.value),_=f.status;ue===100?_="completed":ue>0?_="in-progress":_="todo";let Z={...f,progress:ue,status:_};x(Z),a.onTaskUpdate?.(Z);},onBlur:()=>$(false),className:y("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",g?"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:()=>$(true),className:y("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",g?"bg-white/10":"bg-gray-200"),children:jsx("div",{className:y("h-full rounded-full transition-all",f.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${f.progress||0}%`}})}),jsxs("span",{className:y("text-sm font-medium min-w-[40px]",g?"text-white":"text-gray-900"),children:[f.progress||0,"%"]})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Tag,{className:y("w-4 h-4",g?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:y("text-sm w-24",g?"text-[#9CA3AF]":"text-gray-500"),children:d==="es"?"Etiquetas":"Tags"}),jsx(ja,{selectedTags:f.tags||[],availableTags:m,onChange:A=>{Oe("tags",A);},onCreateTag:l,theme:b})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Link2,{className:y("w-4 h-4",g?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:y("text-sm w-24",g?"text-[#9CA3AF]":"text-gray-500"),children:d==="es"?"Relaciones":"Relations"}),jsx("span",{className:y("text-sm",g?"text-[#6B7280]":"text-gray-400"),children:f.dependencies&&f.dependencies.length>0?`${f.dependencies.length} ${d==="es"?"dependencias":"dependencies"}`:d==="es"?"Vac\xEDo":"Empty"})]})]}),jsxs("div",{className:y("mt-6 pt-4 border-t",g?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsx(FileText,{className:y("w-4 h-4",g?"text-[#6B7280]":"text-gray-400")}),jsx("h3",{className:y("text-sm font-semibold",g?"text-white":"text-gray-900"),children:d==="es"?"Descripci\xF3n":"Description"})]}),jsx("textarea",{value:f.description||"",onChange:A=>Oe("description",A.target.value),placeholder:d==="es"?"Agregar descripci\xF3n...":"Add description...",className:y("w-full min-h-[100px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors",g?"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:y("flex items-center gap-2 text-sm mt-2 transition-colors",g?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsx(Sparkles,{className:"w-4 h-4"}),d==="es"?"Escribe con IA":"Write with AI"]})]}),jsxs("div",{className:y("mt-6 pt-4 border-t",g?"border-white/10":"border-gray-200"),children:[jsx("h3",{className:y("text-sm font-semibold mb-3",g?"text-white":"text-gray-900"),children:d==="es"?"Campos personalizados":"Custom fields"}),jsxs("button",{className:y("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",g?"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"}),d==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxs("div",{className:y("mt-6 pt-4 border-t",g?"border-white/10":"border-gray-200"),children:[jsx("h3",{className:y("text-sm font-semibold mb-3",g?"text-white":"text-gray-900"),children:d==="es"?"Agregar subtarea":"Add subtask"}),f.subtasks&&f.subtasks.length>0&&jsx("div",{className:"space-y-2 mb-3",children:f.subtasks.map(A=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:y("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",A.progress===100?"bg-green-500 border-green-500":g?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:A.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("span",{className:y("text-sm",A.progress===100?"line-through text-[#6B7280]":g?"text-white":"text-gray-900"),children:A.name})]},A.id))}),jsxs("button",{className:y("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",g?"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"}),d==="es"?"Add Tarea":"Add Task"]})]}),jsxs("div",{className:y("mt-6 pt-4 border-t",g?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("h3",{className:y("text-sm font-semibold",g?"text-white":"text-gray-900"),children:d==="es"?"Listas de control":"Checklists"}),jsx("button",{className:y("p-1 rounded transition-colors",g?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsx(Plus,{className:"w-4 h-4"})})]}),jsxs("button",{className:y("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",g?"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"}),d==="es"?"Crear lista de control":"Create checklist"]})]}),jsxs("div",{className:y("mt-6 pt-4 border-t",g?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:y("text-sm font-semibold mb-3",g?"text-white":"text-gray-900"),children:[d==="es"?"Adjuntos":"Attachments",Qe.length>0&&jsxs("span",{className:y("ml-2 text-xs font-normal",g?"text-[#6B7280]":"text-gray-400"),children:["(",Qe.length,")"]})]}),Qe.length>0&&jsx("div",{className:"space-y-2 mb-4",children:Qe.map(A=>{let ue=st(A.type),_=A.type.startsWith("image/");return jsxs("div",{className:y("flex items-center gap-3 p-2 rounded-lg group transition-colors",g?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[_&&A.thumbnailUrl?jsx("img",{src:A.thumbnailUrl,alt:A.name,className:"w-10 h-10 rounded object-cover"}):jsx("div",{className:y("w-10 h-10 rounded flex items-center justify-center",g?"bg-white/10":"bg-gray-200"),children:jsx(ue,{className:y("w-5 h-5",g?"text-[#9CA3AF]":"text-gray-500")})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("a",{href:A.url,target:"_blank",rel:"noopener noreferrer",className:y("text-sm font-medium truncate block hover:underline",g?"text-white":"text-gray-900"),children:A.name}),jsx("p",{className:y("text-xs",g?"text-[#6B7280]":"text-gray-400"),children:wt(A.size)})]}),a.onDeleteAttachment&&jsx("button",{onClick:()=>a.onDeleteAttachment?.(A.id),className:y("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",g?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:d==="es"?"Eliminar":"Delete",children:jsx(Trash2,{className:"w-4 h-4"})})]},A.id)})}),jsxs("div",{onDragOver:tt,onDragLeave:Xe,onDrop:Ge,className:y("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",Ae?g?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":g?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",kt&&"pointer-events-none opacity-50"),children:[jsx("input",{type:"file",multiple:true,onChange:Fe,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!a.onUploadAttachments||kt}),kt?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:y("text-sm",g?"text-[#9CA3AF]":"text-gray-500"),children:d==="es"?"Subiendo...":"Uploading..."})]}):jsxs(Fragment,{children:[jsx(Upload,{className:y("w-6 h-6 mx-auto mb-2",Ae?"text-blue-500":g?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:y("text-sm",g?"text-[#9CA3AF]":"text-gray-500"),children:Ae?d==="es"?"Suelta los archivos aqu\xED":"Drop files here":d==="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:y("text-xs mt-1",g?"text-[#6B7280]":"text-gray-400"),children:d==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxs("div",{className:y("w-[280px] border-l flex flex-col",g?"border-white/10 bg-[#141619]":"border-gray-200 bg-gray-50"),children:[jsx("div",{className:y("px-4 py-3 border-b flex items-center justify-between",g?"border-white/10":"border-gray-200"),children:jsx("span",{className:y("font-medium",g?"text-white":"text-gray-900"),children:d==="es"?"Actividad":"Activity"})}),jsx("div",{className:"flex-1 p-4 overflow-y-auto",children:jsxs("div",{className:y("text-sm text-center py-8",g?"text-[#6B7280]":"text-gray-400"),children:[jsx(MessageSquare,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),d==="es"?"Sin actividad reciente":"No recent activity"]})}),jsx("div",{className:y("p-3 border-t",g?"border-white/10":"border-gray-200"),children:jsx("div",{className:y("flex items-center gap-2 px-3 py-2 rounded-lg",g?"bg-white/5":"bg-white border border-gray-200"),children:jsx("input",{type:"text",placeholder:d==="es"?"Escribe un comentario...":"Write a comment...",className:y("flex-1 bg-transparent text-sm outline-none",g?"text-white placeholder-[#6B7280]":"text-gray-900 placeholder-gray-400")})})})]})]})]})}),jsx(AnimatePresence,{children:T&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>D(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:y("fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[320px] max-h-[400px] rounded-xl shadow-2xl z-50 overflow-hidden",g?"bg-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:y("px-4 py-3 border-b flex items-center justify-between",g?"border-white/10":"border-gray-200"),children:[jsx("span",{className:y("font-medium",g?"text-white":"text-gray-900"),children:T.date.toLocaleDateString(d==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsx("button",{onClick:()=>D(null),className:y("p-1 rounded",g?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-4 h-4"})})]}),jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-2",children:T.events.map(A=>jsxs("button",{onClick:()=>{D(null),x(A.task);},className:y("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",g?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx(Ic,{task:A.task}),jsx("span",{className:y("text-sm truncate flex-1",g?"text-white":"text-gray-900"),children:A.title}),A.task.priority==="high"||A.task.priority==="urgent"?jsx(Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},A.id))})]})]})})]})}var Mi={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"},Ai={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"},Ii={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"},zn={dark:Mi,light:Ai,neutral:Ii};function Bc(e){return zn[e]||zn.dark}function rh({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:n,onDeleteStack:s,className:p}){let[m,l]=useState(false),u=useMemo(()=>t.filter(i=>e.cardIds.includes(i.id)),[t,e.cardIds]),c=useMemo(()=>{let i=u.length,w=new Set(u.flatMap(h=>h.assignedUserIds||[])).size,g=u.map(h=>h.priority).filter(Boolean),b=new Set(u.flatMap(h=>h.labels||[])).size;return {totalCards:i,uniqueAssignees:w,priorities:g,labels:b}},[u]),d=()=>{o?.(e.id);};return jsxs("div",{className:y("card-stack",!e.isExpanded&&"card-stack-collapsed",p),onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxs("div",{className:"card-stack-header",onClick:d,children:[jsxs("div",{className:"card-stack-header-left",children:[jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:y("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:c.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:i=>{i.stopPropagation(),s?.(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:[c.uniqueAssignees," assignees"]})]}),c.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:[c.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(i=>jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsx("div",{onClick:()=>r?.(i),children:a(i)}):jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(i),children:[jsx("h4",{children:i.title}),i.description&&jsxs("p",{children:[i.description.substring(0,100),"..."]})]}),jsx("button",{className:"card-stack-unstack-btn",onClick:w=>{w.stopPropagation(),n?.(e.id,i.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"})]})})]},i.id))})})]})}var Oc={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function Bo(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 Ro(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 zc(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 $c({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:n,config:s,className:p}){let m=useMemo(()=>({...Oc,...s}),[s]),[l,u]=useState(new Set),c=useRef(null),d=useMemo(()=>{if(!m.groupByDay)return [{date:null,events:e}];let v=new Map;return e.forEach(f=>{let x=f.timestamp.toISOString().split("T")[0],T=v.get(x);T?T.push(f):v.set(x,[f]);}),Array.from(v.entries()).sort((f,x)=>x[0].localeCompare(f[0])).map(([f,x])=>({date:new Date(f),events:x.sort((T,D)=>D.timestamp.getTime()-T.timestamp.getTime())}))},[e,m.groupByDay]),{uniqueUsers:i,uniqueTypes:w}=useMemo(()=>{let v=new Set,f=new Set;return e.forEach(x=>{v.add(x.userId),f.add(x.type);}),{uniqueUsers:Array.from(v),uniqueTypes:Array.from(f)}},[e]),g=v=>{u(f=>{let x=new Set(f);return x.has(v)?x.delete(v):x.add(v),x});},b=v=>{let x=new Date().getTime()-v.getTime(),T=Math.floor(x/6e4),D=Math.floor(x/36e5),I=Math.floor(x/864e5);return T<1?"just now":T<60?`${T}m ago`:D<24?`${D}h ago`:I<7?`${I}d ago`:v.toLocaleDateString()},h=useMemo(()=>{let v=0;return t.types&&t.types.length>0&&v++,t.users&&t.users.length>0&&v++,t.dateRange&&v++,t.searchTerm&&v++,v},[t]);return useEffect(()=>{if(n&&c.current){let v=c.current.querySelector(`[data-event-id="${n}"]`);v&&v.scrollIntoView({behavior:"smooth",block:"center"});}},[n]),e.length===0?jsxs("div",{className:y("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:y("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:v=>{let f=v.target.value;a({...t,types:f?[f]:void 0});},children:[jsx("option",{value:"",children:"All Events"}),w.map(v=>jsxs("option",{value:v,children:[Ro(v)," ",v.replace("_"," ")]},v))]}),i.length>1&&jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:v=>{let f=v.target.value;a({...t,users:f?[f]:void 0});},children:[jsx("option",{value:"",children:"All Users"}),i.map(v=>jsx("option",{value:v,children:v},v))]}),jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:v=>a({...t,searchTerm:v.target.value})})]}),h>0&&jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",h,")"]})]}),jsx("div",{className:"history-timeline-container",ref:c,children:d.map(v=>jsxs("div",{className:"history-timeline-group",children:[m.groupByDay&&v.date&&jsxs("div",{className:"history-timeline-day-header",children:[jsx("span",{className:"history-timeline-day-date",children:v.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxs("span",{className:"history-timeline-day-count",children:[v.events.length," events"]})]}),jsx("div",{className:"history-timeline-events",children:v.events.map((f,x)=>{let T=l.has(f.id),D=n===f.id,I=zc(f.type);return jsxs("div",{"data-event-id":f.id,className:y("history-timeline-event",T&&"expanded",D&&"selected"),onClick:()=>o?.(f),children:[jsxs("div",{className:"history-timeline-line",children:[jsx("div",{className:"history-timeline-dot",style:{backgroundColor:I},children:m.showIcons&&jsx("span",{className:"history-timeline-dot-icon",children:Ro(f.type)})}),x<v.events.length-1&&jsx("div",{className:"history-timeline-connector",style:{borderColor:I}})]}),jsxs("div",{className:"history-timeline-event-content",children:[jsxs("div",{className:"history-timeline-event-header",children:[jsxs("div",{className:"history-timeline-event-header-left",children:[m.showAvatars&&f.userAvatar&&jsx("img",{src:f.userAvatar,alt:f.userName||f.userId,className:"history-timeline-event-avatar"}),jsxs("div",{className:"history-timeline-event-description",children:[jsx("span",{className:"history-timeline-event-user",children:f.userName||f.userId}),jsx("span",{className:"history-timeline-event-action",children:Bo(f)})]})]}),jsx("div",{className:"history-timeline-event-time",children:m.useRelativeTime?b(f.timestamp):f.timestamp.toLocaleString()})]}),Object.keys(f.changes).length>0&&jsxs("button",{className:"history-timeline-event-toggle",onClick:k=>{k.stopPropagation(),g(f.id);},children:[T?"\u25BC":"\u25B6"," Show changes"]}),T&&jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(f.changes).map(([k,L])=>jsxs("div",{className:"history-timeline-event-change",children:[jsxs("span",{className:"history-timeline-event-change-key",children:[k,":"]}),jsxs("div",{className:"history-timeline-event-change-values",children:[jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(L.from)}),jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(L.to)})]})]},k)),f.metadata&&Object.keys(f.metadata).length>0&&jsxs("div",{className:"history-timeline-event-metadata",children:[jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(f.metadata).map(([k,L])=>jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxs("span",{className:"history-timeline-event-metadata-key",children:[k,":"]}),jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(L)})]},k))]})]})]})]},f.id)})})]},v.date?.toISOString()||"all"))})]})}function Wc({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:n,onNext:s,onGoToEvent:p,onSpeedChange:m,className:l}){let u=[.5,1,1.5,2,3],c=useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),d=useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxs("div",{className:y("history-replay-empty",l),children:[jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxs("div",{className:y("history-replay",l),children:[jsxs("div",{className:"history-replay-current-event",children:[jsx("div",{className:"history-replay-event-icon",children:c&&Ro(c.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:c&&Bo(c)}),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:c&&c.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:i=>p(parseInt(i.target.value))}),jsx("div",{className:"history-replay-progress-fill",style:{width:`${d}%`}}),jsx("div",{className:"history-replay-progress-markers",children:t.map((i,w)=>jsx("div",{className:y("history-replay-progress-marker",w===e.currentIndex&&"active"),style:{left:`${w/(e.totalEvents-1)*100}%`},onClick:()=>p(w),title:Bo(i)},i.id))})]}),jsxs("div",{className:"history-replay-controls",children:[jsx("button",{className:"history-replay-control-btn",onClick:n,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:s,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(i=>jsxs("button",{className:y("history-replay-speed-btn",e.speed===i&&"active"),onClick:()=>m(i),children:[i,"x"]},i))})]}),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:c&&c.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(i=>jsx("span",{className:"history-replay-card-preview-label-tag",children:i},i))})]})]})]})]}):jsxs("div",{className:y("history-replay-start",l),children:[jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsx("span",{children:"Start Time Travel"})]}),jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function Fi(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 Li(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 Hc(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 Gc(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function dh(e,t,a,r,o,n=100){let s=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(s.map(m=>[m.id,m]));for(let m=0;m<n;m++){let l=1-m/n;s.forEach(u=>{let c=a/2,d=r/2;u.vx+=(c-u.x)*o.centerForce*l,u.vy+=(d-u.y)*o.centerForce*l,s.forEach(i=>{if(u.id===i.id)return;let w=u.x-i.x,g=u.y-i.y,b=Math.sqrt(w*w+g*g)||1,h=o.chargeStrength*l/(b*b);u.vx+=w/b*h,u.vy+=g/b*h;});}),t.forEach(u=>{let c=p.get(typeof u.source=="string"?u.source:u.source.id),d=p.get(typeof u.target=="string"?u.target:u.target.id);if(!c||!d)return;let i=d.x-c.x,w=d.y-c.y,g=Math.sqrt(i*i+w*w)||1,b=(g-o.linkDistance)/g*o.forceStrength*l;c.vx+=i*b,c.vy+=w*b,d.vx-=i*b,d.vy-=w*b;}),s.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 s}function _c({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:n,stats:s,onInteraction:p,className:m}){let l=useRef(null),[u,c]=useState([]),[d,i]=useState(null),[w,g]=useState(null),[b,h]=useState(null),[v,f]=useState(1),[x,T]=useState({x:0,y:0});useEffect(()=>{if(e.length===0)return;let F=dh(e,t,a.width,a.height,a,150);c(F);},[e,t,a]);let D=useCallback((F,J)=>{a.enableDragging&&(J.stopPropagation(),i(F));},[a.enableDragging]),I=useCallback(F=>{if(!d||!l.current)return;let K=l.current.getBoundingClientRect(),de=(F.clientX-K.left-x.x)/v,ge=(F.clientY-K.top-x.y)/v;c(Te=>Te.map(Ce=>Ce.id===d?{...Ce,x:de,y:ge,fx:de,fy:ge}:Ce));},[d,v,x]),k=useCallback(()=>{i(null);},[]),L=useCallback((F,J)=>{J.stopPropagation(),p?.({type:"node-click",node:F,position:{x:J.clientX,y:J.clientY}});},[p]),N=useCallback((F,J)=>{J.stopPropagation(),p?.({type:"edge-click",edge:F,position:{x:J.clientX,y:J.clientY}});},[p]),C=useCallback(F=>{let J=u.find(K=>K.id===F);return J?{x:J.x,y:J.y}:{x:0,y:0}},[u]),G=useCallback(F=>{if(F.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return F.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let J=F.card.priority;return J==="URGENT"?"#ef4444":J==="HIGH"?"#f59e0b":J==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return F.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxs("div",{className:y("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:y("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:s.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:s.totalEdges}),jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),n&&jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsx("span",{className:"relationships-graph-stat-value",children:n.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:()=>f(F=>Math.min(F+.2,3)),children:"+"}),jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(v*100),"%"]}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>f(F=>Math.max(F-.2,.5)),children:"\u2212"}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{f(1),T({x:0,y:0});},children:"Reset"})]})]}),jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(F=>F.type))).map(F=>jsxs("div",{className:"relationships-graph-legend-item",children:[jsx("div",{className:"relationships-graph-legend-color",style:{background:Fi(F)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[Hc(F)," ",Li(F)]})]},F))}),jsxs("svg",{ref:l,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:I,onMouseUp:k,onMouseLeave:k,children:[jsxs("g",{transform:`translate(${x.x}, ${x.y}) scale(${v})`,children:[jsx("g",{className:"relationships-graph-edges",children:t.map(F=>{let J=C(typeof F.source=="string"?F.source:F.source.id),K=C(typeof F.target=="string"?F.target:F.target.id),de=Gc(F.type),ge=b===F.id,Te=F.onCriticalPath;return jsxs("g",{className:y("relationships-graph-edge",ge&&"hovered",Te&&"critical"),onMouseEnter:()=>h(F.id),onMouseLeave:()=>h(null),onClick:Ce=>N(F,Ce),children:[jsx("line",{x1:J.x,y1:J.y,x2:K.x,y2:K.y,stroke:Fi(F.type),strokeWidth:Te?a.edgeWidth*2:a.edgeWidth,strokeOpacity:ge?1:.6,markerEnd:de?"url(#arrowhead)":void 0}),a.showEdgeLabels&&ge&&jsx("text",{x:(J.x+K.x)/2,y:(J.y+K.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Li(F.type)})]},F.id)})}),jsx("g",{className:"relationships-graph-nodes",children:u.map(F=>{let J=w===F.id,K=F.onCriticalPath;return jsxs("g",{className:y("relationships-graph-node",J&&"hovered",K&&"critical"),transform:`translate(${F.x}, ${F.y})`,onMouseDown:de=>D(F.id,de),onMouseEnter:()=>g(F.id),onMouseLeave:()=>g(null),onClick:de=>L(F,de),children:[jsx("circle",{r:K?a.nodeSize*1.2:a.nodeSize,fill:G(F),stroke:K?"#fbbf24":"#ffffff",strokeWidth:K?3:2,opacity:J?1:.9}),a.showLabels&&jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:F.card.title.length>20?F.card.title.substring(0,20)+"...":F.card.title})]},F.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 Kc({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[n,s]=useState(""),[p,m]=useState(false),[l,u]=useState(null),[c,d]=useState(null),i=useRef(null),w=p||o;useEffect(()=>{e&&i.current&&i.current.focus();},[e]),useEffect(()=>{let v=f=>{f.key==="Escape"&&!w&&g();};if(e)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[e,w]);let g=()=>{w||(s(""),u(null),d(null),t());},b=async()=>{if(!(!n.trim()||w)){m(true),u(null),d(null);try{let v=await r(n.trim());d(v);}catch(v){u(v instanceof Error?v.message:"Failed to generate plan");}finally{m(false);}}},h=()=>{c&&(a(c),g());};return e?jsxs(it,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:g}),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:v=>v.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:g,disabled:w,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:"Plan Generated Successfully!"})]}),c.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:c.explanation})}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",c.columns.length,")"]}),jsx("div",{className:"flex gap-2 flex-wrap",children:c.columns.map((v,f)=>jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:v.title},f))})]}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",c.cards.length,")"]}),jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[c.cards.slice(0,10).map((v,f)=>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:v.title}),v.description&&jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:v.description})]}),v.priority&&jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${v.priority==="URGENT"?"bg-red-500/20 text-red-400":v.priority==="HIGH"?"bg-orange-500/20 text-orange-400":v.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:v.priority})]})},f)),c.cards.length>10&&jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",c.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:i,value:n,onChange:v=>s(v.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:w}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),l&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:l}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((v,f)=>jsx("button",{onClick:()=>s(v),disabled:w,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:v},f))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:w&&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:g,disabled:w,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:h,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:b,disabled:!n.trim()||w,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:w?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Bi={"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 ph={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},mh={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 uh(e,t,a){let r=Bi[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,n=a/1e3*r.costPer1kOutput;return o+n}function Oo(e){return `$${e.toFixed(4)}`}var Ri=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=uh(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(c=>c.timestamp>=t.start&&c.timestamp<=t.end));let r=a.length,o=a.reduce((c,d)=>c+d.cost,0),n=a.reduce((c,d)=>c+d.inputTokens,0),s=a.reduce((c,d)=>c+d.outputTokens,0),p=a.filter(c=>c.success),m=a.reduce((c,d)=>c+d.duration,0),l={},u={};return a.forEach(c=>{l[c.feature]=(l[c.feature]||0)+1,u[c.feature]=(u[c.feature]||0)+c.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:n,totalOutputTokens:s,operationsByFeature:l,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],n=new Date,s=new Date;a==="month"?s.setMonth(n.getMonth()-1):s.setDate(n.getDate()-1);let p=this.operations.filter(u=>u.timestamp>=s).length,m=Math.max(0,o-p),l=p/o*100;return {used:p,limit:o,remaining:m,percentUsed:l,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)}},Ur=new Ri;function Xc({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=useState(Ur.getStats()),[n,s]=useState(Ur.checkLimit(a));if(useEffect(()=>{if(!e)return;let m=setInterval(()=>{o(Ur.getStats()),s(Ur.checkLimit(a));},1e3);return ()=>clearInterval(m)},[e,a]),useEffect(()=>{let m=l=>{l.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[e,t]),!e)return null;let p=Ur.getRecentOperations(5);return jsxs(it,{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:[n.used," / ",n.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,n.percentUsed)}%`,background:n.percentUsed>90?"#EF4444":n.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxs("p",{className:"text-xs text-white/60 mt-2",children:[n.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:Oo(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,l])=>{let u=r.costsByFeature[m]||0,c=r.totalOperations>0?l/r.totalOperations*100:0;return jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children: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:[l," ops"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:Oo(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:`${c}%`}})})]},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:Oo(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 Qc({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:n}){let[s,p]=useState(""),[m,l]=useState(""),[u,c]=useState(""),[d,i]=useState(false),[w,g]=useState(null),[b,h]=useState(null),[v,f]=useState(null),x=useRef(null),T=d||o;useEffect(()=>{e&&x.current&&x.current.focus();},[e]),useEffect(()=>{let N=C=>{C.key==="Escape"&&!T&&D();};if(e)return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[e,T]);let D=()=>{T||(p(""),l(""),c(""),g(null),h(null),f(null),t());},I=async()=>{if(!(!s.trim()||T)){i(true),g(null),h(null),f(null);try{let N=await r({prompt:s.trim(),projectName:n||"Mi Proyecto",startDate:m||void 0,endDate:u||void 0});h(N.tasks.tasks),f({from_cache:N.from_cache,tokens_used:N.tokens_used,mock_mode:N.mock_mode,similarity:N.similarity,tokens_saved:N.tokens_saved});}catch(N){g(N instanceof Error?N.message:"Failed to generate tasks");}finally{i(false);}}},k=()=>{b&&(a(b),D());};if(!e)return null;let L=v?.similarity?((v.similarity||0)*100).toFixed(0):"0";return jsxs(it,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:D}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:N=>N.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsx("button",{onClick:D,disabled:T,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:b?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:[v?.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"}),v?.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 (",L,"% 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:[v?.tokens_used||0," tokens"]}),v?.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:[v.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:[b.length," tasks"]})]}),jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:b.map((N,C)=>jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-colors",children:jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxs("span",{className:"text-xs text-white/50",children:["#",C+1]}),jsx("p",{className:"text-sm font-medium text-white/90",children:N.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"})]}),N.start," \u2192 ",N.end]}),jsxs("span",{children:[N.duration," days"]}),N.dependencies.length>0&&jsxs("span",{className:"text-blue-400",children:["Depends: ",N.dependencies.join(", ")]})]})]}),jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${N.priority==="high"?"bg-red-500/20 text-red-400":N.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:N.priority})]})},N.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:s,onChange:N=>p(N.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:T}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsx("input",{type:"date",value:m,onChange:N=>l(N.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:T})]}),jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsx("input",{type:"date",value:u,onChange:N=>c(N.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:T})]})]}),w&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:w}),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((N,C)=>jsx("button",{onClick:()=>p(N),disabled:T,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:N},C))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:T&&jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:D,disabled:T,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),b?jsx("button",{onClick:k,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsx("button",{onClick:I,disabled:!s.trim()||T,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:T?"Generating...":"Generate Tasks"})]})]})]})})]})}function Wn({initialBoard:e,onPersist:t}){let[a,r]=useState(e),o=useCallback(b=>{t&&Ko(()=>Promise.resolve(t(b)),{maxAttempts:3,initialDelay:1e3,onRetry:(h,v,f)=>{console.warn(`Retry attempt ${v} after ${f}ms: ${h.message}`);}}).then(h=>{h.success||console.error(`Failed to persist board after ${h.attempts} attempts:`,h.error);});},[t]),n=useCallback(async(b,h,v)=>{r(f=>{let x=f.cards.find(N=>N.id===b);if(!x)return f;let T=x.columnId,D={...x,columnId:h,position:v},I=f.cards.map(N=>N.id===b?D:N),k=f.columns.map(N=>{if(N.id===T)return {...N,cardIds:N.cardIds.filter(C=>C!==b)};if(N.id===h){let C=I.filter(G=>G.columnId===h).sort((G,F)=>G.position-F.position);return {...N,cardIds:C.map(G=>G.id)}}return N}),L={...f,cards:I,columns:k};return o(L),L});},[o]),s=useCallback(async(b,h)=>{r(v=>{let f=v.cards.map(T=>T.id===b?{...T,...h}:T),x={...v,cards:f};return o(x),x});},[o]),p=useCallback(async b=>{let h=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(v=>{let f={...b,id:h},x=v.columns.map(D=>D.id===b.columnId?{...D,cardIds:[...D.cardIds,h]}:D),T={...v,cards:[...v.cards,f],columns:x};return o(T),T});},[o]),m=useCallback(async b=>{r(h=>{let v=h.cards.find(D=>D.id===b);if(!v)return h;let f=h.cards.filter(D=>D.id!==b),x=h.columns.map(D=>D.id===v.columnId?{...D,cardIds:D.cardIds.filter(I=>I!==b)}:D),T={...h,cards:f,columns:x};return o(T),T});},[o]),l=useCallback(async b=>{let h=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(v=>{let f={...b,id:h,cardIds:[]},x={...v,columns:[...v.columns,f]};return o(x),x});},[o]),u=useCallback(async(b,h)=>{r(v=>{let f=v.columns.map(T=>T.id===b?{...T,...h}:T),x={...v,columns:f};return o(x),x});},[o]),c=useCallback(async b=>{r(h=>{let v=h.cards.filter(T=>T.columnId!==b),f=h.columns.filter(T=>T.id!==b),x={...h,cards:v,columns:f};return o(x),x});},[o]),d=useCallback(b=>{let h=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return p(b),h},[p]),i=useCallback(b=>{let h=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(b),h},[l]),w=useCallback(()=>{r(b=>{let h={...b,cards:[],columns:[]};return o(h),h});},[o]);return {board:a,callbacks:{onCardMove:n,onCardUpdate:s,onCardCreate:p,onCardDelete:m,onColumnCreate:l,onColumnUpdate:u,onColumnDelete:c},setBoard:r,helpers:{addCard:d,addColumn:i,deleteCard:m,deleteColumn:c,clearBoard:w}}}function tp({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:n}=Wn({initialBoard:e,onPersist:a}),s=useMemo(()=>({addCard:(m,l,u={})=>{n.addCard({title:l,columnId:m,position:r.cards.filter(c=>c.columnId===m).length,...u});},addColumn:(m,l)=>{let u=r.columns.length>0?Math.max(...r.columns.map(c=>c.position)):0;n.addColumn({title:m,position:l??u+1e3});},reset:n.clearBoard}),[r.cards,r.columns,n]);return {props:useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:s}}var zo={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},rp={by:"none",order:"asc"};function op({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=useState({...zo,...e}),[n,s]=useState({...rp,...t}),p=useCallback(g=>{o(b=>({...b,...g}));},[]),m=useCallback(g=>{s(b=>({...b,...g}));},[]),l=useCallback(()=>{o(zo),s(rp);},[]),u=useCallback(()=>{a&&o({...zo,assignees:[a]});},[a]),c=useCallback(()=>{o({...zo,dateFilter:"overdue"});},[]),d=useCallback(()=>{o({...zo,priorities:["HIGH","URGENT"]});},[]),i=useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||n.by!=="none",[r,n]),w=useCallback(g=>{let b=[...g];if(r.search){let h=r.search.toLowerCase();b=b.filter(v=>v.title.toLowerCase().includes(h)||v.description?.toLowerCase().includes(h));}if(r.dateFilter!=="all"){let h=new Date,v=h.getFullYear(),f=String(h.getMonth()+1).padStart(2,"0"),x=String(h.getDate()).padStart(2,"0"),T=`${v}-${f}-${x}`;b=b.filter(D=>{if(!D.endDate&&!D.dueDate)return false;let I=D.endDate||D.dueDate;if(!I)return false;let k;if(typeof I=="string")k=I.split("T")[0]||I;else {let L=I.getUTCFullYear(),N=String(I.getUTCMonth()+1).padStart(2,"0"),C=String(I.getUTCDate()).padStart(2,"0");k=`${L}-${N}-${C}`;}switch(r.dateFilter){case "overdue":return k<T;case "today":return k===T;case "this-week":let L=new Date(T+"T00:00:00"),N=new Date(k+"T00:00:00"),C=new Date(L);return C.setDate(C.getDate()+7),N>=L&&N<=C;case "custom":if(r.dateRange){let G=typeof I=="string"?new Date(I):I;return G>=r.dateRange.start&&G<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(b=b.filter(h=>h.priority&&r.priorities.includes(h.priority))),r.assignees.length>0&&(b=b.filter(h=>(h.assignedUserIds||(h.assigneeId?[h.assigneeId]:[])).some(f=>r.assignees.includes(f)))),r.labels.length>0&&(b=b.filter(h=>h.labels&&h.labels.some(v=>r.labels.includes(v)))),r.columns.length>0&&(b=b.filter(h=>r.columns.includes(h.columnId))),n.by!=="none"&&b.sort((h,v)=>{let f=0;switch(n.by){case "created":let x=h.createdAt?new Date(h.createdAt).getTime():0,T=v.createdAt?new Date(v.createdAt).getTime():0;f=x-T;break;case "priority":let D={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},I=D[h.priority||"LOW"],k=D[v.priority||"LOW"];f=I-k;break;case "dueDate":let L=h.endDate||h.dueDate,N=v.endDate||v.dueDate;if(!L)return 1;if(!N)return -1;let C=typeof L=="string"?new Date(L).getTime():L.getTime(),G=typeof N=="string"?new Date(N).getTime():N.getTime();f=C-G;break;case "title":f=h.title.localeCompare(v.title);break;case "estimate":let F=h.estimatedTime||0,J=v.estimatedTime||0;f=F-J;break;default:f=0;}return n.order==="asc"?f:-f}),b},[r,n]);return {filters:r,sort:n,setFilters:p,setSort:m,resetFilters:l,filterMyTasks:u,filterOverdue:c,filterHighPriority:d,applyFilters:w,hasActiveFilters:i}}var sp,ip;if(typeof window<"u")try{let e=_o("ai");sp=e.generateObject,ip=e.generateText;}catch{}function lp(e={}){let[t,a]=useState(false),[r,o]=useState(null),n=!!(sp&&ip&&e.apiKey),s=useCallback(async c=>{if(!n)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:",c),{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: ${c}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(d){let i=d instanceof Error?d:new Error("Failed to generate plan");throw o(i),i}finally{a(false);}},[n]),p=useCallback(async c=>{if(!n)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",c.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(d){let i=d instanceof Error?d:new Error("Failed to suggest assignee");throw o(i),i}finally{a(false);}},[n]),m=useCallback(async c=>{if(!n)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(d){let i=d instanceof Error?d:new Error("Failed to predict risks");throw o(i),i}finally{a(false);}},[n]),l=useCallback(async c=>{if(!n)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",c.title),[{title:`Subtask 1 for: ${c.title}`,position:c.position+.1,columnId:c.columnId},{title:`Subtask 2 for: ${c.title}`,position:c.position+.2,columnId:c.columnId}]}catch(d){let i=d instanceof Error?d:new Error("Failed to generate subtasks");throw o(i),i}finally{a(false);}},[n]),u=useCallback(async c=>{if(!n)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",c.title),{hours:8,confidence:.75}}catch(d){let i=d instanceof Error?d:new Error("Failed to estimate effort");throw o(i),i}finally{a(false);}},[n]);return {onGeneratePlan:s,onSuggestAssignee:p,onPredictRisks:m,onGenerateSubtasks:l,onEstimateEffort:u,isAvailable:n,isLoading:t,error:r}}function zi(){let[e,t]=useState(()=>selectionStore.getState());useEffect(()=>selectionStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{selectionStore.setState(r);},[]);return [e,a]}function dp(e){let{cards:t}=e,[a,r]=zi(),o=useCallback(c=>a.selectedCardIds.includes(c),[a.selectedCardIds]),n=useCallback((c,d)=>{if(!d){r({selectedCardIds:[c],lastSelectedCardId:c});return}let i=d.ctrlKey||d.metaKey,w=d.shiftKey;if(i)a.selectedCardIds.includes(c)?r({selectedCardIds:a.selectedCardIds.filter(g=>g!==c),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,c],lastSelectedCardId:c});else if(w&&a.lastSelectedCardId){let g=t.find(h=>h.id===c),b=t.find(h=>h.id===a.lastSelectedCardId);if(g&&b&&g.columnId===b.columnId){let h=t.filter(k=>k.columnId===g.columnId).sort((k,L)=>k.position-L.position),v=h.findIndex(k=>k.id===a.lastSelectedCardId),f=h.findIndex(k=>k.id===c),[x,T]=v<f?[v,f]:[f,v],D=h.slice(x,T+1).map(k=>k.id),I=Array.from(new Set([...a.selectedCardIds,...D]));r({selectedCardIds:I,lastSelectedCardId:c});}else r({selectedCardIds:[c],lastSelectedCardId:c});}else r({selectedCardIds:[c],lastSelectedCardId:c});},[t,a,r]),s=useCallback(c=>{r({selectedCardIds:a.selectedCardIds.filter(d=>d!==c),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),p=useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),m=useCallback(()=>{r({selectedCardIds:t.map(c=>c.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),l=useCallback(c=>{a.selectedCardIds.includes(c)?s(c):r({selectedCardIds:[...a.selectedCardIds,c],lastSelectedCardId:c});},[a,s,r]),u=useCallback(()=>t.filter(c=>a.selectedCardIds.includes(c.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:n,deselectCard:s,clearSelection:p,selectAll:m,toggleCard:l,getSelectedCards:u}}var cp={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function pp(e){let{cards:t,config:a,aiService:r}=e,o=useMemo(()=>({...cp,...a}),[a]),[n,s]=useState([]),p=useCallback((g,b,h,v,f)=>{if(b.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:g,cardIds:b,columnId:h,strategy:v,color:f,isExpanded:true,position:n.filter(T=>T.columnId===h).length,createdAt:new Date};s(T=>[...T,x]);},[o.minCardsPerStack,n]),m=useCallback(g=>{s(b=>b.filter(h=>h.id!==g));},[]),l=useCallback(g=>{s(b=>b.map(h=>h.id===g?{...h,isExpanded:!h.isExpanded}:h));},[]),u=useCallback((g,b)=>{s(h=>h.map(v=>v.id===g&&!v.cardIds.includes(b)?{...v,cardIds:[...v.cardIds,b]}:v));},[]),c=useCallback((g,b)=>{s(h=>h.map(v=>{if(v.id===g){let f=v.cardIds.filter(x=>x!==b);return f.length<o.minCardsPerStack?null:{...v,cardIds:f}}return v}).filter(v=>v!==null));},[o.minCardsPerStack]),d=useCallback(g=>n.filter(b=>b.columnId===g).sort((b,h)=>b.position-h.position),[n]),i=useCallback(async g=>{let b=t.filter(T=>T.columnId===g);if(b.length<o.minCardsPerStack*2)return [];let h=[],v=new Map;b.forEach(T=>{T.labels&&T.labels.length>0&&T.labels.forEach(D=>{v.has(D)||v.set(D,[]),v.get(D).push(T);});}),v.forEach((T,D)=>{T.length>=o.minCardsPerStack&&h.push({stack:{title:`\u{1F4CC} ${D}`,cardIds:T.map(I=>I.id),columnId:g,strategy:"labels",color:"#3b82f6"},reason:`${T.length} cards with label "${D}"`,confidence:.85});});let f=new Map;b.forEach(T=>{T.assignedUserIds&&T.assignedUserIds.length>0&&T.assignedUserIds.forEach(D=>{f.has(D)||f.set(D,[]),f.get(D).push(T);});}),f.forEach((T,D)=>{T.length>=o.minCardsPerStack&&h.push({stack:{title:`\u{1F464} Assigned to user-${D.slice(-4)}`,cardIds:T.map(I=>I.id),columnId:g,strategy:"assignee",color:"#8b5cf6"},reason:`${T.length} cards assigned to the same user`,confidence:.8});});let x=new Map;if(b.forEach(T=>{T.priority&&(x.has(T.priority)||x.set(T.priority,[]),x.get(T.priority).push(T));}),x.forEach((T,D)=>{if(T.length>=o.minCardsPerStack){let I={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[D.toLowerCase()]||"\u26AA";h.push({stack:{title:`${I} ${D} Priority`,cardIds:T.map(k=>k.id),columnId:g,strategy:"priority",color:D==="high"||D==="urgent"?"#ef4444":"#10b981"},reason:`${T.length} cards with ${D} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let T of b){let I=(await r.findSimilar(T,b)).filter(k=>k.similarity>=o.autoStackConfidenceThreshold);if(I.length>=o.minCardsPerStack-1){let k=[T.id,...I.map(N=>N.card.id)],L=I.reduce((N,C)=>N+C.similarity,0)/I.length;h.push({stack:{title:`\u2728 Similar to "${T.title.substring(0,30)}${T.title.length>30?"...":""}"`,cardIds:k,columnId:g,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${I.length+1} similar tasks`,confidence:L});}}return h.filter(T=>T.confidence>=o.autoStackConfidenceThreshold).sort((T,D)=>D.confidence-T.confidence).slice(0,5)},[t,o,r]),w=useCallback(g=>{p(g.stack.title,g.stack.cardIds,g.stack.columnId,g.stack.strategy,g.stack.color);},[p]);return useEffect(()=>{o.enableAutoStacking&&n.length===0&&new Set(t.map(b=>b.columnId)).forEach(async b=>{let h=await i(b),v=h[0];h.length>0&&v&&v.confidence>=.9&&w(v);});},[]),{stacks:n,createStack:p,deleteStack:m,toggleStack:l,addToStack:u,removeFromStack:c,getStacksForColumn:d,getSuggestions:i,applySuggestion:w,config:o}}var mp=createContext(null);function up({children:e,initialData:t,onStateChange:a}){let r=useRef();if(!r.current){let n=new Map,s=new Map;t?.columns?.forEach(m=>{let{Column:l}=_o("@libxai/core");n.set(m.id,new l(m));}),t?.cards?.forEach(m=>{let{Card:l}=_o("@libxai/core");s.set(m.id,new l(m));});let p=null;if(t?.board){let{Board:m}=_o("@libxai/core");p=new m(t.board);}r.current=new BoardStore({board:p,columns:n,cards:s});}let o=r.current;return useEffect(()=>{if(a)return o.subscribeAll(n=>{a(o.getState());})},[o,a]),jsx(mp.Provider,{value:{store:o},children:e})}function Hn(){let e=useContext(mp);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Uo(){let e=Hn(),[t,a]=useState(e.getBoard()),[r,o]=useState(e.getAllColumns()),[n,s]=useState(e.getAllCards());useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),s(e.getAllCards());}),[e]);let p=useCallback(v=>{e.updateBoard(v);},[e]),m=useCallback(v=>{e.addColumn(v);},[e]),l=useCallback((v,f)=>{e.updateColumn(v,f);},[e]),u=useCallback(v=>{e.deleteColumn(v);},[e]),c=useCallback(v=>e.getColumn(v),[e]),d=useCallback(v=>{e.addCard(v);},[e]),i=useCallback((v,f)=>{e.updateCard(v,f);},[e]),w=useCallback(v=>{e.deleteCard(v);},[e]),g=useCallback((v,f,x)=>{e.moveCard(v,f,x);},[e]),b=useCallback(v=>e.getCard(v),[e]),h=useCallback(v=>e.getCardsByColumn(v),[e]);return {board:t,columns:r,cards:n,updateBoard:p,addColumn:m,updateColumn:l,deleteColumn:u,getColumn:c,addCard:d,updateCard:i,deleteCard:w,moveCard:g,getCard:b,getCardsByColumn:h}}function fp(e){let{cards:t}=Uo();return useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let r=e.searchQuery.toLowerCase(),o=a.title.toLowerCase().includes(r),n=a.description?.toLowerCase().includes(r);if(!o&&!n)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 hp(e="position",t="asc"){let{cards:a}=Uo();return useMemo(()=>[...a].sort((o,n)=>{let s=0;switch(e){case "title":s=o.title.localeCompare(n.title);break;case "priority":{let p={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},m=o.priority?p[o.priority]:0,l=n.priority?p[n.priority]:0;s=m-l;break}case "createdAt":s=o.createdAt.getTime()-n.createdAt.getTime();break;case "updatedAt":s=o.updatedAt.getTime()-n.updatedAt.getTime();break;case "position":s=o.position-n.position;break}return t==="asc"?s:-s}),[a,e,t])}var Gn=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=hl.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 n of this.plugins.values()){if(!this.enabled.has(n.id))continue;let s=n[t];if(typeof s=="function")try{let p=await Promise.resolve(s.apply(n,a));p!==void 0&&(o=p,a[0]=p);}catch(p){this.pluginLogger.error(`Plugin hook failed: ${n.id}.${t}`,p,{plugin:n.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 n=o[t];typeof n=="function"&&r.push(Promise.resolve(n.apply(o,a)).catch(s=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,s,{plugin:o.id,hook:t});}));}await Promise.all(r);}},Mh=new Gn;function yp({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:n=5,horizontal:s=false,gap:p=0,getItemKey:m}){let l=useRef(null),u=useVirtualizer({count:e.length,getScrollElement:()=>l.current,estimateSize:()=>a,overscan:n,horizontal:s,gap:p}),c=u.getVirtualItems(),d={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},i=s?{width:`${u.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${u.getTotalSize()}px`,width:"100%",position:"relative"};return jsx("div",{ref:l,style:d,className:o,children:jsx("div",{style:i,children:c.map(w=>{let g=e[w.index];if(!g)return null;let b=m?m(g,w.index):w.index,h={position:"absolute",top:s?0:w.start,left:s?w.start:0,width:s?w.size:"100%",height:s?"100%":w.size};return jsx("div",{style:h,"data-index":w.index,children:r(g,w.index)},b)})})})}function vp(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 kp({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:n="",overscan:s=3,gap:p=16,getItemKey:m,horizontal:l=true}){let u=useRef(null),c=useVirtualizer({horizontal:l,count:e.length,getScrollElement:()=>u.current,estimateSize:()=>r,overscan:s,gap:p}),d=c.getVirtualItems(),i={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},w={width:`${c.getTotalSize()}px`,height:"100%",position:"relative"};return jsx("div",{ref:u,style:i,className:n,children:jsx("div",{style:w,children:d.map(g=>{let b=e[g.index];if(!b)return null;let h=m?m(b,g.index):g.index,v={position:"absolute",top:0,left:g.start,width:g.size,height:"100%"};return jsx("div",{style:v,"data-index":g.index,children:o(b,g.index)},h)})})})}function wp(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 Cp(e,t=10){return e>t}var Hi={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Gi={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},_i={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Vi={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},ji={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Ki={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Yi={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},qi={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)"},Xi={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)"},Ji={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Zi={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}},Qi={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}},_n={spacing:Hi,borderRadius:Gi,fontSize:_i,fontWeight:Vi,lineHeight:ji,zIndex:Ki,duration:Yi,easing:qi,shadows:Xi,opacity:Ji,kanban:Zi,gantt:Qi};function Tp(e,t,a){return e[t]??a}function el(e,t="",a={}){for(let[r,o]of Object.entries(e)){let n=t?`${t}-${r}`:r;typeof o=="object"&&o!==null&&!Array.isArray(o)?el(o,n,a):(typeof o=="string"||typeof o=="number")&&(a[n]=o);}return a}function Fh(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function tl(e="asakaa"){let t=el(_n),a=[];for(let[r,o]of Object.entries(t)){let n=`--${e}-${r}`,s=Fh(o);a.push(` ${n}: ${s};`);}return `:root {
|
|
389
|
+
Today's date: ${new Date().toISOString().split("T")[0]}`}function yc(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function lr(e,t){let a=yc(e),r=t.toLowerCase().trim(),o=a.find(c=>c.name.toLowerCase()===r);if(o)return o;let n=a.find(c=>c.name.toLowerCase().includes(r));if(n)return n;let s=r.split(/\s+/);return a.find(c=>{let p=c.name.toLowerCase();return s.every(i=>p.includes(i))})}function gi(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 l=new Date(r);return l.setDate(l.getDate()+1),l}if(a==="yesterday"||a==="ayer"){let l=new Date(r);return l.setDate(l.getDate()-1),l}if(a==="next week"||a==="la pr\xF3xima semana"){let l=new Date(r);return l.setDate(l.getDate()+7),l}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 b=new Date(r),m=b.getDay(),v=h-m;return v<=0&&(v+=7),b.setDate(b.getDate()+v),b}}let n=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(n&&n[1]&&n[2]){let l=parseInt(n[1],10),h=n[2].toLowerCase(),b=new Date(r);return h==="day"||h==="d\xEDa"||h==="dias"?b.setDate(b.getDate()+l):h==="week"||h==="semana"||h==="semanas"?b.setDate(b.getDate()+l*7):(h==="month"||h==="mes"||h==="meses")&&b.setMonth(b.getMonth()+l),b}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let c=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(c&&c[1]&&c[2]&&c[3]){let l=parseInt(c[1],10),h=parseInt(c[2],10)-1,b=parseInt(c[3],10);return new Date(b,h,l)}let p={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 l=parseInt(i[1],10),h=p[i[2].toLowerCase()],b=i[3]?parseInt(i[3],10):r.getFullYear();if(h!==void 0)return new Date(b,h,l)}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 l=u[d[1].toLowerCase()],h=parseInt(d[2],10),b=d[3]?parseInt(d[3],10):r.getFullYear();if(l!==void 0)return new Date(b,l,h)}return null}function fi(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 hi(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 vc(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 xc(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=lr(t,i),l=gi(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(!l)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,b=new Date(l);return b.setDate(b.getDate()+h),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:l,endDate:b},message:`Moved "${d.name}" to ${l.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=lr(t,i),l=fi(u);if(!d)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!l||!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()+l),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:h},message:`Extended "${d.name}" by ${l} days. New end date: ${h.toLocaleDateString()}.`,success:true}}let n=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),u=n[2].trim(),d=lr(t,i),l=hi(u);return d?l===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:l},message:`Set "${d.name}" progress to ${l}%.`,success:true}:{type:"set_progress",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let s=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(s&&s[1]&&s[2]){let i=s[1].trim(),u=s[2].trim(),d=lr(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 c=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]&&c[2]){let i=c[1].trim(),u=c[2].trim(),d=lr(t,i),l=lr(t,u);return d?l?{type:"link_tasks",taskId:l.id,taskName:l.name,dependencyFrom:d.id,dependencyTo:l.id,message:`Linked "${d.name}" \u2192 "${l.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 p=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(p&&p[1]){let i=p[1].trim(),u=lr(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 kc(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 D0(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 S0(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function An(e,t=[],a=[]){let r=e.assignedUserIds?.map(u=>{let d=a.find(l=>l.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=>An(u,t,a)),n;e.dependencies&&(typeof e.dependencies[0]=="string"?n=e.dependencies:n=e.dependencies.filter(u=>u.type==="finish-to-start").map(u=>u.taskId));let s=u=>{if(u)return typeof u=="string"?new Date(u):u},c=s(e.startDate),p=s(e.endDate),i=e.metadata?.isMilestone===true||c&&p&&Math.abs(p.getTime()-c.getTime())<=864e5;return {id:e.id,name:e.title,startDate:c,endDate:p,progress:e.progress||0,status:D0(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:n?.length?n:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:i,isCriticalPath:e.metadata?.isCriticalPath===true}}function wc(e,t=[]){let a;return e.assignees&&e.assignees.length>0&&(a=e.assignees.map(r=>t.find(n=>n.name===r.name||n.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:S0(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function Cc(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>An(r,e,t))}var bi={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"}},yi={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"}},Fn={en:bi,es:yi};function vi(e){return Fn[e]||Fn.en}function In(e,t){let a=vi(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 Sc(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(...Sc(r.subtasks,t+1));return a}function z0({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 Ec({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:n,style:s}){let{theme:c="dark",locale:p="en",customTranslations:i,showSearch:u=true,showHierarchy:d=true}=t,l=In(p,i),h=c==="dark",[b,m]=useState(new Set),[v,w]=useState("startDate"),[g,f]=useState("asc"),[x,N]=useState("");useMemo(()=>{let S=new Set;function C(H){for(let B of H)B.subtasks?.length&&(S.add(B.id),C(B.subtasks));}C(e),m(S);},[e]);let D=useCallback(S=>{m(C=>{let H=new Set(C);return H.has(S)?H.delete(S):H.add(S),H}),a.onTaskToggleExpand?.(S);},[a]),I=useCallback(S=>{v===S?f(C=>C==="asc"?"desc":"asc"):(w(S),f("asc")),a.onSortChange?.({column:S,direction:g==="asc"?"desc":"asc"});},[v,g,a]),k=useMemo(()=>{let S=Sc(e);if(x.trim()){let H=x.toLowerCase();S=S.filter(B=>B.name.toLowerCase().includes(H));}let C=[];for(let H of S){let B=H.level===0;H.level>0&&(B=true),(B||x.trim())&&C.push(H);}return x.trim()&&C.sort((H,B)=>{let J,ne;switch(v){case "name":J=H.name.toLowerCase(),ne=B.name.toLowerCase();break;case "startDate":J=H.startDate?.getTime()||0,ne=B.startDate?.getTime()||0;break;case "endDate":J=H.endDate?.getTime()||0,ne=B.endDate?.getTime()||0;break;case "progress":J=H.progress||0,ne=B.progress||0;break;case "status":J=H.status||"todo",ne=B.status||"todo";break;default:return 0}return J<ne?g==="asc"?-1:1:J>ne?g==="asc"?1:-1:0}),C},[e,x,v,g]),$=S=>S?(S instanceof Date?S:new Date(S)).toLocaleDateString(p==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-";return r?jsx("div",{className:y("flex-1 flex items-center justify-center",h?"bg-[#0F1117]":"bg-white",n),style:s,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:y("text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:[l.empty.noTasks,"..."]})]})}):o?jsx("div",{className:y("flex-1 flex items-center justify-center",h?"bg-[#0F1117]":"bg-white",n),style:s,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:y("text-lg font-semibold mb-2",h?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:y("text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsx("div",{className:y("flex-1 flex items-center justify-center",h?"bg-[#0F1117]":"bg-white",n),style:s,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:y("text-lg font-semibold mb-2",h?"text-white":"text-gray-900"),children:l.empty.noTasks}),jsx("p",{className:y("text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:l.empty.addFirstTask})]})}):jsxs("div",{className:y("flex-1 flex flex-col w-full h-full overflow-hidden",h?"bg-[#0F1117]":"bg-white",n),style:s,children:[jsx("div",{className:y("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:y("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:S=>N(S.target.value),placeholder:l.toolbar.searchPlaceholder,className:y("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:y("text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:[k.length," ",l.pagination.tasks]})]})}),jsxs("div",{className:y("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:()=>I("name"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[l.columns.name,jsx(ArrowUpDown,{className:"w-3 h-3"})]})}),jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxs("button",{onClick:()=>I("status"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[l.columns.status,jsx(ArrowUpDown,{className:"w-3 h-3"})]})}),jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxs("button",{onClick:()=>I("startDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[l.columns.startDate,jsx(ArrowUpDown,{className:"w-3 h-3"})]})}),jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxs("button",{onClick:()=>I("endDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[l.columns.endDate,jsx(ArrowUpDown,{className:"w-3 h-3"})]})}),jsx("div",{className:"col-span-1 flex items-center gap-1",children:jsxs("button",{onClick:()=>I("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:k.map((S,C)=>{let H=b.has(S.id);return jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:C*.02},className:y("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+S.level*24}px`:void 0},onClick:()=>a.onTaskClick?.(S),onDoubleClick:()=>a.onTaskDoubleClick?.(S),children:[jsxs("div",{className:"col-span-5 flex items-center gap-2 min-w-0",children:[d&&S.hasChildren&&jsx("button",{onClick:B=>{B.stopPropagation(),D(S.id);},className:y("p-0.5 rounded",h?"hover:bg-white/10":"hover:bg-gray-200"),children:H?jsx(ChevronDown,{className:y("w-4 h-4",h?"text-[#9CA3AF]":"text-gray-400")}):jsx(ChevronRight,{className:y("w-4 h-4",h?"text-[#9CA3AF]":"text-gray-400")})}),d&&!S.hasChildren&&jsx("div",{className:"w-5"}),jsx("button",{onClick:B=>{B.stopPropagation(),a.onTaskUpdate?.({...S,progress:S.progress===100?0:100,status:S.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsx(z0,{status:S.status,progress:S.progress})}),jsx("span",{className:y("truncate",h?"text-white":"text-gray-900",S.progress===100&&(h?"line-through text-[#6B7280]":"line-through text-gray-400")),children:S.name})]}),jsx("div",{className:"col-span-2 flex items-center",children:jsx("span",{className:y("px-2 py-1 rounded-full text-xs font-medium",S.progress===100||S.status==="completed"?"bg-green-500/10 text-green-500":S.progress&&S.progress>0||S.status==="in-progress"?"bg-blue-500/10 text-blue-500":h?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:S.progress===100||S.status==="completed"?l.status.completed:S.progress&&S.progress>0||S.status==="in-progress"?l.status.inProgress:l.status.todo})}),jsxs("div",{className:y("col-span-2 flex items-center gap-1 text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:[jsx(Calendar,{className:"w-4 h-4"}),$(S.startDate)]}),jsxs("div",{className:y("col-span-2 flex items-center gap-1 text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:[jsx(Clock,{className:"w-4 h-4"}),$(S.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:y("flex-1 h-1.5 rounded-full overflow-hidden",h?"bg-white/10":"bg-gray-200"),children:jsx("div",{className:y("h-full rounded-full transition-all",S.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${S.progress||0}%`}})}),jsxs("span",{className:y("text-xs w-8",h?"text-[#9CA3AF]":"text-gray-500"),children:[S.progress||0,"%"]})]})})]},S.id)})}),k.length===0&&x&&jsx("div",{className:"flex items-center justify-center py-12",children:jsxs("div",{className:"text-center",children:[jsx(List,{className:y("w-12 h-12 mx-auto mb-4",h?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:y(h?"text-[#9CA3AF]":"text-gray-600"),children:l.empty.noResults})]})})]})]})}var xi={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"},ki={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"},wi={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"},Bn={dark:xi,light:ki,neutral:wi};function Pc(e){return Bn[e]||Bn.dark}var Ci={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"}},Ti={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"}},Rn={en:Ci,es:Ti};function Bo(e){return Rn[e]||Rn.en}function On(e,t){let a=Bo(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 Mc(e){let t=Bo(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 Ac(e,t=0,a=true){let r=Bo(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 th(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 Pi(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 Rc({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 zc({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:n,className:s,style:c,availableTags:p=[],onCreateTag:i,attachmentsByTask:u}){let{theme:d="dark",locale:l="en",customTranslations:h}=t,b=On(l,h),m=d==="dark",v={textTertiary:m?"#6B7280":"#9CA3AF",textSecondary:m?"#9CA3AF":"#6B7280",textPrimary:m?"#FFFFFF":"#111827",borderLight:m?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:m?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:m?"#1A1D25":"#FFFFFF",bgSecondary:m?"#0F1117":"#F9FAFB",hoverBg:m?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},[w,g]=useState(r||new Date),[f,x]=useState(null),[N,D]=useState(null),[I,k]=useState(null),[$,S]=useState(new Date),[C,H]=useState({}),B=4,J=3,[ne,xe]=useState(false),[Pe,Re]=useState(false),[le,z]=useState(false),[L,W]=useState(false),[E,q]=useState(null),[Z,U]=useState(""),[ke,Ne]=useState(void 0),[Fe,ye]=useState(null),[tt,Ie]=useState(false),[st,it]=useState(false),[dt,O]=useState(null),[F,K]=useState(false),[ae,ge]=useState(new Date),[Se,Ke]=useState(false),[yt,Be]=useState(false),[pe,Ee]=useState(false),[jt,ut]=useState(""),sa=useCallback(()=>{g(new Date(w.getFullYear(),w.getMonth()-1,1));},[w]),Sa=useCallback(()=>{g(new Date(w.getFullYear(),w.getMonth()+1,1));},[w]),He=useCallback(()=>{g(new Date);},[]),$e=useMemo(()=>{let T=w.getFullYear(),ee=w.getMonth(),ie=new Date(T,ee,1),R=new Date(T,ee+1,0),Y=ie.getDay(),V=R.getDate(),we=th(e),Le=new Date;Le.setHours(0,0,0,0);let Me=[],Kt=Y,$t=new Date(T,ee,0).getDate();for(let re=Kt-1;re>=0;re--){let Ce=new Date(T,ee-1,$t-re);Me.push({date:Ce,isCurrentMonth:false,isToday:false,isWeekend:Ce.getDay()===0||Ce.getDay()===6,events:we.filter(Je=>Pi(Ce,Je)).map(Je=>({id:Je.id,title:Je.name,start:Je.startDate,end:Je.endDate,task:Je}))});}for(let re=1;re<=V;re++){let Ce=new Date(T,ee,re),Je=Ce.getTime()===Le.getTime();Me.push({date:Ce,isCurrentMonth:true,isToday:Je,isWeekend:Ce.getDay()===0||Ce.getDay()===6,events:we.filter(At=>Pi(Ce,At)).map(At=>({id:At.id,title:At.name,start:At.startDate,end:At.endDate,task:At}))});}let Qt=42-Me.length;for(let re=1;re<=Qt;re++){let Ce=new Date(T,ee+1,re);Me.push({date:Ce,isCurrentMonth:false,isToday:false,isWeekend:Ce.getDay()===0||Ce.getDay()===6,events:we.filter(Je=>Pi(Ce,Je)).map(Je=>({id:Je.id,title:Je.name,start:Je.startDate,end:Je.endDate,task:Je}))});}return Me},[w,e]),ia=l==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],fe=w.toLocaleDateString(l==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),Oe=useCallback((T,ee)=>{if(!f)return;let ie={...f,[T]:ee};x(ie),a.onTaskUpdate?.(ie);},[f,a]),Ae=useCallback(T=>{if(!f)return;let ee=f.progress||0;T==="completed"?ee=100:T==="todo"&&(ee=0);let ie={...f,status:T,progress:ee};x(ie),a.onTaskUpdate?.(ie),xe(false);},[f,a]),Ge=useCallback((T,ee)=>{if(!f)return;let ie={...f,startDate:T,endDate:ee};x(ie),a.onTaskUpdate?.(ie);},[f,a]),_e=useCallback(()=>{xe(false),Re(false),z(false),k(null),Ee(false),ut("");},[]),kt=useCallback(async T=>{if(T.preventDefault(),T.stopPropagation(),Ke(false),!f||!a.onUploadAttachments)return;let ee=Array.from(T.dataTransfer.files);if(ee.length!==0){Be(true);try{await a.onUploadAttachments(f.id,ee);}finally{Be(false);}}},[f,a]),rt=useCallback(async T=>{if(!f||!a.onUploadAttachments||!T.target.files)return;let ee=Array.from(T.target.files);if(ee.length!==0){Be(true);try{await a.onUploadAttachments(f.id,ee);}finally{Be(false);}T.target.value="";}},[f,a]),Qe=useCallback(T=>{T.preventDefault(),T.stopPropagation(),Ke(true);},[]),ct=useCallback(T=>{T.preventDefault(),T.stopPropagation(),Ke(false);},[]),Ht=useCallback(T=>T<1024?`${T} B`:T<1024*1024?`${(T/1024).toFixed(1)} KB`:`${(T/(1024*1024)).toFixed(1)} MB`,[]),Q=useCallback(T=>T.startsWith("image/")?Image:T.includes("pdf")||T.includes("document")?FileText:File,[]),oe=useMemo(()=>!f||!u?[]:u.get(f.id)||[],[f,u]);return o?jsx("div",{className:y("flex-1 flex items-center justify-center",m?"bg-[#0F1117]":"bg-white",s),style:c,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:y("text-sm",m?"text-[#9CA3AF]":"text-gray-600"),children:[b.labels.noEvents,"..."]})]})}):n?jsx("div",{className:y("flex-1 flex items-center justify-center",m?"bg-[#0F1117]":"bg-white",s),style:c,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:y("text-lg font-semibold mb-2",m?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:y("text-sm",m?"text-[#9CA3AF]":"text-gray-600"),children:typeof n=="string"?n:n.message})]})]})}):e.length===0?jsx("div",{className:y("flex-1 flex items-center justify-center",m?"bg-[#0F1117]":"bg-white",s),style:c,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:y("text-lg font-semibold mb-2",m?"text-white":"text-gray-900"),children:b.labels.noEvents}),jsx("p",{className:y("text-sm",m?"text-[#9CA3AF]":"text-gray-600"),children:b.labels.newTask})]})}):jsxs("div",{className:y("flex-1 flex flex-col w-full h-full overflow-auto",m?"bg-[#0F1117]":"bg-white",s),style:c,children:[jsx("div",{className:y("flex-shrink-0 px-6 py-4 border-b",m?"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:y("text-xl font-semibold capitalize",m?"text-white":"text-gray-900"),children:fe}),jsx("button",{onClick:He,className:y("px-3 py-1.5 text-sm rounded-lg transition-colors",m?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:b.navigation.today})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("button",{onClick:sa,className:y("p-2 rounded-lg transition-colors",m?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:y("w-5 h-5",m?"text-[#9CA3AF]":"text-gray-600")})}),jsx("button",{onClick:Sa,className:y("p-2 rounded-lg transition-colors",m?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:y("w-5 h-5",m?"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:ia.map(T=>jsx("div",{className:y("py-2 text-center text-xs font-medium uppercase",m?"text-[#9CA3AF]":"text-gray-500"),children:T},T))}),jsx("div",{className:y("grid grid-cols-7 auto-rows-min gap-px rounded-lg",m?"bg-[#2D2D2D]":"bg-gray-300"),children:$e.map((T,ee)=>{let ie=T.date.getDay()===0||T.date.getDay()===6;return jsxs("div",{className:y("min-h-[120px] p-2 transition-colors flex flex-col relative group",m?ie?"bg-[#1C1F26]":T.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":ie?"bg-gray-100":T.isCurrentMonth?"bg-white":"bg-gray-50",T.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let R=C[ee]||B,Y=T.events.slice(0,R),V=T.events.length-R;return jsxs("div",{className:"space-y-1 flex-1",children:[Y.map(we=>jsx("div",{className:"relative group",children:jsxs(motion.button,{onClick:()=>{x(we.task),a.onEventClick?.(we);},whileHover:{scale:1.02},className:y("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",we.task.progress===100?m?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":m?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsx(Rc,{task:we.task}),jsx("span",{className:"truncate",children:we.title})]})},we.id)),V>0&&jsxs("button",{onClick:we=>{we.stopPropagation(),H(Le=>({...Le,[ee]:R+J}));},className:y("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",m?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",V," ",l==="es"?"M\xC1S":"MORE"]}),R>B&&T.events.length>B&&jsx("button",{onClick:we=>{we.stopPropagation(),H(Le=>({...Le,[ee]:B}));},className:y("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",m?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:l==="es"?"MENOS":"LESS"})]})})(),jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let R=ee>=28,Y=ee%7>=5;return jsxs("div",{className:"relative",children:[jsx("button",{onClick:V=>{V.stopPropagation(),E===ee?q(null):(q(ee),U(""),Ne(void 0),ye(null),O(null),Ie(false),it(false),K(false),ge(T.date));},className:y("w-5 h-5 rounded flex items-center justify-center transition-all",E===ee?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",m?"hover:bg-[#7C3AED] text-[#6B7280] hover:text-white":"hover:bg-[#7C3AED] text-gray-400 hover:text-white"),children:jsx(Plus,{className:y("w-3.5 h-3.5 transition-transform",E===ee&&"rotate-45")})}),jsx(AnimatePresence,{children:E===ee&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{q(null),U(""),Ne(void 0),ye(null),O(null),Ie(false),it(false),K(false);}}),jsxs(motion.div,{initial:{opacity:0,y:R?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:R?-5:5,scale:.95},transition:{duration:.12},className:y("absolute w-[320px] rounded-lg shadow-2xl z-50",R?"bottom-full mb-1":"top-full mt-1",Y?"right-0":"left-0",m?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:V=>{V.stopPropagation(),Ie(false),it(false),K(false);},children:[jsx("div",{className:"p-2.5",children:jsx("input",{type:"text",value:Z,onChange:V=>U(V.target.value),placeholder:l==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:y("w-full bg-transparent text-sm outline-none placeholder:opacity-40",m?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:V=>{if(V.key==="Enter"&&Z.trim()){let we=t.availableUsers?.find(Me=>Me.id===Fe),Le=dt||T.date;a.onTaskCreate?.({name:Z.trim(),startDate:Le,endDate:Le,priority:ke,assignees:we?[we]:void 0}),U(""),Ne(void 0),ye(null),O(null),q(null);}V.key==="Escape"&&(q(null),U(""),Ne(void 0),ye(null),O(null));}})}),jsxs("div",{className:y("px-2.5 py-2 flex items-center justify-between border-t",m?"border-white/10":"border-gray-100"),children:[jsxs("div",{className:"flex items-center gap-1",children:[jsxs("div",{className:"relative",children:[jsx("button",{onClick:V=>{V.stopPropagation(),Ie(!tt),it(false);},className:y("p-1 rounded transition-colors",ke?ke==="urgent"||ke==="high"?"text-red-400 bg-red-500/20":ke==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":m?"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:tt&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:y("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",m?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:V=>V.stopPropagation(),children:[{id:"urgent",label:l==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:l==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:l==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:l==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:l==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(V=>jsxs("button",{onClick:()=>{Ne(V.id),Ie(false);},className:y("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",m?"hover:bg-white/5":"hover:bg-gray-50",ke===V.id&&(m?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:y("w-2 h-2 rounded-full",V.color)}),jsx("span",{className:m?"text-white":"text-gray-900",children:V.label})]},V.id||"none"))})})]}),jsxs("div",{className:"relative",children:[jsxs("button",{onClick:V=>{V.stopPropagation(),K(!F),Ie(false),it(false),ge(dt||T.date);},className:y("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",dt?"bg-[#7C3AED]/20 text-[#7C3AED]":m?"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"}),(dt||T.date).toLocaleDateString(l==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsx(AnimatePresence,{children:F&&jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:y("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",m?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:V=>V.stopPropagation(),children:[jsx("div",{className:y("w-40 py-2 border-r",m?"border-white/10":"border-gray-200"),children:(()=>{let V=new Date,we=new Date(V);we.setDate(V.getDate()+1);let Le=new Date(V);Le.setDate(V.getDate()+((6-V.getDay()+7)%7||7));let Me=new Date(V);Me.setDate(V.getDate()+((1-V.getDay()+7)%7||7));let Kt=new Date(V);Kt.setDate(V.getDate()+14);let $t=new Date(V);return $t.setDate(V.getDate()+28),[{label:l==="es"?"Hoy":"Today",date:V,display:V.toLocaleDateString(l==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:l==="es"?"Ma\xF1ana":"Tomorrow",date:we,display:we.toLocaleDateString(l==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:l==="es"?"Este fin de semana":"This weekend",date:Le,display:l==="es"?"s\xE1b.":"sat."},{label:l==="es"?"Pr\xF3xima semana":"Next week",date:Me,display:l==="es"?"lun.":"mon."},{label:l==="es"?"2 semanas":"2 weeks",date:Kt,display:Kt.toLocaleDateString(l==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:l==="es"?"4 semanas":"4 weeks",date:$t,display:$t.toLocaleDateString(l==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((re,Ce)=>jsxs("button",{className:y("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",m?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{O(re.date),K(false);},children:[jsx("span",{children:re.label}),jsx("span",{className:y("text-[10px]",m?"text-[#6B7280]":"text-gray-400"),children:re.display})]},Ce))})()}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("span",{className:y("text-xs font-medium",m?"text-white":"text-gray-900"),children:ae.toLocaleDateString(l==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{onClick:()=>ge(new Date),className:y("px-1.5 py-0.5 rounded text-[10px] transition-colors",m?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:l==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>ge(new Date(ae.getFullYear(),ae.getMonth()-1)),className:y("p-0.5 rounded",m?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-3.5 h-3.5"})}),jsx("button",{onClick:()=>ge(new Date(ae.getFullYear(),ae.getMonth()+1)),className:y("p-0.5 rounded",m?"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:(l==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(V=>jsx("div",{className:y("w-6 h-6 flex items-center justify-center text-[10px]",m?"text-[#6B7280]":"text-gray-400"),children:V},V))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let V=ae.getFullYear(),we=ae.getMonth(),Le=new Date(V,we,1).getDay(),Me=new Date(V,we+1,0).getDate(),Kt=new Date(V,we,0).getDate(),$t=new Date,Qt=[];for(let Ce=Le-1;Ce>=0;Ce--)Qt.push({dayNum:Kt-Ce,isCurrentMonth:false,date:new Date(V,we-1,Kt-Ce)});for(let Ce=1;Ce<=Me;Ce++)Qt.push({dayNum:Ce,isCurrentMonth:true,date:new Date(V,we,Ce)});let re=42-Qt.length;for(let Ce=1;Ce<=re;Ce++)Qt.push({dayNum:Ce,isCurrentMonth:false,date:new Date(V,we+1,Ce)});return Qt.map((Ce,Je)=>{let At=Ce.date.toDateString()===$t.toDateString(),Oa=(dt||T.date).toDateString()===Ce.date.toDateString();return jsx("button",{className:y("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!Ce.isCurrentMonth&&(m?"text-[#4B5563]":"text-gray-300"),Ce.isCurrentMonth&&(m?"text-white":"text-gray-900"),At&&"ring-1 ring-[#3B82F6]",Oa&&"bg-[#7C3AED] text-white",!Oa&&(m?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{O(Ce.date),K(false);},children:Ce.dayNum},Je)})})()})]})]})})]}),jsxs("div",{className:"relative",children:[jsx("button",{onClick:V=>{V.stopPropagation(),it(!st),Ie(false);},className:y("p-1 rounded transition-colors",Fe?"text-[#7C3AED] bg-[#7C3AED]/20":m?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:Fe?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(V=>V.id===Fe)?.color||"#7C3AED"},children:t.availableUsers?.find(V=>V.id===Fe)?.initials||t.availableUsers?.find(V=>V.id===Fe)?.name?.slice(0,2).toUpperCase()}):jsx(User,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:st&&jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:y("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",m?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:V=>V.stopPropagation(),children:[jsxs("button",{onClick:()=>{ye(null),it(false);},className:y("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",m?"hover:bg-white/5":"hover:bg-gray-50",!Fe&&(m?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:y("w-5 h-5 rounded-full flex items-center justify-center",m?"bg-white/10":"bg-gray-200"),children:jsx(User,{className:"w-3 h-3 text-gray-400"})}),jsx("span",{className:m?"text-[#9CA3AF]":"text-gray-500",children:l==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(V=>jsxs("button",{onClick:()=>{ye(V.id),it(false);},className:y("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",m?"hover:bg-white/5":"hover:bg-gray-50",Fe===V.id&&(m?"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:V.color||"#7C3AED"},children:V.initials||V.name?.slice(0,2).toUpperCase()}),jsx("span",{className:m?"text-white":"text-gray-900",children:V.name})]},V.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsx("div",{className:y("px-3 py-2 text-xs",m?"text-[#6B7280]":"text-gray-400"),children:l==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsx("button",{onClick:()=>{if(Z.trim()){let V=t.availableUsers?.find(Le=>Le.id===Fe),we=dt||T.date;a.onTaskCreate?.({name:Z.trim(),startDate:we,endDate:we,priority:ke,assignees:V?[V]:void 0}),U(""),Ne(void 0),ye(null),O(null),q(null);}},disabled:!Z.trim(),className:y("px-2.5 py-1 rounded text-xs font-medium transition-colors",Z.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":m?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:l==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsx("span",{className:y("text-sm font-medium",T.isToday?"text-[#3B82F6]":T.isCurrentMonth?m?"text-white":"text-gray-900":m?"text-[#6B7280]":"text-gray-400"),children:T.date.getDate()})]})]},ee)})})]})}),jsx(AnimatePresence,{children:f&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>x(null),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:y("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",m?"bg-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxs("div",{className:y("px-6 py-3 border-b flex items-center gap-3",m?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Circle,{className:y("w-4 h-4",m?"text-[#9CA3AF]":"text-gray-500")}),jsxs("span",{className:y("text-xs px-2 py-0.5 rounded",m?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[l==="es"?"Tarea":"Task"," \u2228"]}),jsx("span",{className:y("text-xs font-mono",m?"text-[#6B7280]":"text-gray-400"),children:f.id.slice(0,8)}),jsxs("button",{className:y("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",m?"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:y("p-1.5 rounded transition-colors",m?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(Maximize2,{className:"w-4 h-4"})}),jsx("button",{className:y("p-1.5 rounded transition-colors",m?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(MoreHorizontal,{className:"w-5 h-5"})}),jsx("button",{onClick:()=>x(null),className:y("p-1.5 rounded transition-colors",m?"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 T=f.progress===100?0:100,ie={...f,progress:T,status:T===100?"completed":"todo"};x(ie),a.onTaskUpdate?.(ie);},className:y("mt-1 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors",f.progress===100?"bg-green-500 border-green-500":m?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:f.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("h2",{className:y("text-xl font-semibold flex-1",f.progress===100?"line-through text-[#6B7280]":m?"text-white":"text-gray-900"),children:f.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:y("w-4 h-4",m?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:y("text-sm w-24",m?"text-[#9CA3AF]":"text-gray-500"),children:l==="es"?"Estado":"Status"}),jsx("button",{onClick:()=>{_e(),xe(!ne);},className:y("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",f.progress===100||f.status==="completed"?"bg-green-500/20 text-green-400":f.progress&&f.progress>0||f.status==="in-progress"?"bg-blue-500/20 text-blue-400":m?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:f.progress===100||f.status==="completed"?l==="es"?"COMPLETADO":"DONE":f.progress&&f.progress>0||f.status==="in-progress"?l==="es"?"EN PROGRESO":"IN PROGRESS":l==="es"?"POR HACER":"TO DO"}),jsx(AnimatePresence,{children:ne&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>xe(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:y("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",m?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:l==="es"?"Por hacer":"To Do",color:"bg-white/10 text-white"},{id:"in-progress",label:l==="es"?"En progreso":"In Progress",color:"bg-blue-500/20 text-blue-400"},{id:"completed",label:l==="es"?"Completado":"Done",color:"bg-green-500/20 text-green-400"}].map(T=>jsxs("button",{onClick:()=>Ae(T.id),className:y("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",m?"hover:bg-white/5":"hover:bg-gray-50",(f.status===T.id||T.id==="completed"&&f.progress===100||T.id==="in-progress"&&f.progress&&f.progress>0&&f.progress<100||T.id==="todo"&&(!f.progress||f.progress===0)&&f.status!=="in-progress"&&f.status!=="completed")&&(m?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:y("w-2 h-2 rounded-full",T.id==="completed"?"bg-green-500":T.id==="in-progress"?"bg-blue-500":"bg-gray-400")}),jsx("span",{className:m?"text-white":"text-gray-900",children:T.label})]},T.id))})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(User,{className:y("w-4 h-4",m?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:y("text-sm w-24",m?"text-[#9CA3AF]":"text-gray-500"),children:l==="es"?"Asignados":"Assignees"}),jsxs("button",{onClick:()=>{xe(false),Re(false),k(null),z(!le);},className:y("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",m?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[f.assignees&&f.assignees.length>0?jsxs("div",{className:"flex items-center gap-1",children:[f.assignees.slice(0,3).map((T,ee)=>jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:T.color||"#8B5CF6"},title:T.name,children:T.initials||T.name.slice(0,2).toUpperCase()},ee)),f.assignees.length>3&&jsxs("span",{className:y("text-xs",m?"text-[#6B7280]":"text-gray-400"),children:["+",f.assignees.length-3]})]}):jsx("span",{className:y("text-sm",m?"text-[#6B7280]":"text-gray-400"),children:l==="es"?"Agregar":"Add"}),jsx(ChevronDown,{className:y("w-3 h-3",m?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:le&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>z(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:y("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",m?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:t.availableUsers&&t.availableUsers.length>0?t.availableUsers.map(T=>{let ee=f.assignees?.some(ie=>ie.name===T.name);return jsxs("button",{onClick:()=>{let ie=f.assignees||[],R;ee?R=ie.filter(Y=>Y.name!==T.name):R=[...ie,{name:T.name,avatar:T.avatar,initials:T.initials||T.name.slice(0,2).toUpperCase(),color:T.color||"#8B5CF6"}],Oe("assignees",R);},className:y("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",m?"hover:bg-white/5":"hover:bg-gray-50",ee&&(m?"bg-white/5":"bg-gray-50")),children:[T.avatar?jsx("img",{src:T.avatar,alt:T.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:T.color||"#8B5CF6"},children:T.initials||T.name.slice(0,2).toUpperCase()}),jsx("span",{className:y("flex-1 text-left",m?"text-white":"text-gray-900"),children:T.name}),ee&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},T.id||T.name)}):jsx("div",{className:y("px-3 py-4 text-sm text-center",m?"text-[#6B7280]":"text-gray-400"),children:l==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CalendarDays,{className:y("w-4 h-4",m?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:y("text-sm w-24",m?"text-[#9CA3AF]":"text-gray-500"),children:l==="es"?"Fechas":"Dates"}),jsxs("button",{onClick:()=>{k(I?null:"start"),S(f.startDate||new Date);},className:y("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",m?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[f.startDate?.toLocaleDateString(l==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(l==="es"?"Inicio":"Start"),jsx("span",{className:y("mx-1",m?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),f.endDate?.toLocaleDateString(l==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(l==="es"?"Fin":"End"),(f.startDate||f.endDate)&&jsx(X,{className:"w-3.5 h-3.5 ml-1 opacity-50 hover:opacity-100",onClick:T=>{T.stopPropagation();}})]}),jsx(AnimatePresence,{children:I&&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:y("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",m?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:T=>T.stopPropagation(),children:[jsxs("div",{className:y("w-44 py-2 border-r",m?"border-white/10":"border-gray-200"),children:[(()=>{let T=new Date,ee=new Date(T);ee.setDate(T.getDate()+1);let ie=new Date(T);ie.setDate(T.getDate()+((6-T.getDay()+7)%7||7));let R=new Date(T);R.setDate(T.getDate()+((1-T.getDay()+7)%7||7));let Y=new Date(T);Y.setDate(T.getDate()+(6-T.getDay()+7)%7+7);let V=new Date(T);V.setDate(T.getDate()+14);let we=new Date(T);return we.setDate(T.getDate()+28),[{label:l==="es"?"Hoy":"Today",date:T,display:T.toLocaleDateString(l==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:l==="es"?"Ma\xF1ana":"Tomorrow",date:ee,display:ee.toLocaleDateString(l==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:l==="es"?"Este fin de semana":"This weekend",date:ie,display:l==="es"?"s\xE1b.":"sat."},{label:l==="es"?"Pr\xF3xima semana":"Next week",date:R,display:l==="es"?"lun.":"mon."},{label:l==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:Y,display:Y.toLocaleDateString(l==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:l==="es"?"2 semanas":"2 weeks",date:V,display:V.toLocaleDateString(l==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:l==="es"?"4 semanas":"4 weeks",date:we,display:we.toLocaleDateString(l==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Me,Kt)=>jsxs("button",{className:y("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",m?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(I==="start"){let $t=f.endDate&&Me.date>f.endDate?Me.date:f.endDate;Ge(Me.date,$t),k("end");}else {let $t=f.startDate&&Me.date<f.startDate?Me.date:f.startDate;Ge($t,Me.date),k(null);}},children:[jsx("span",{children:Me.label}),jsx("span",{className:y("text-xs",m?"text-[#6B7280]":"text-gray-400"),children:Me.display})]},Kt))})(),jsx("div",{className:y("border-t mt-2 pt-2",m?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{Ge(void 0,void 0),k(null);},className:y("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",m?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:l==="es"?"Quitar fechas":"Clear dates"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[jsx("div",{className:y("text-xs mb-3 px-2 py-1 rounded",m?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:I==="start"?l==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":l==="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:y("font-medium",m?"text-white":"text-gray-900"),children:$.toLocaleDateString(l==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>S(new Date),className:y("p-1 rounded text-sm transition-colors",m?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:l==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>S(new Date($.getFullYear(),$.getMonth()-1)),className:y("p-1 rounded",m?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-4 h-4"})}),jsx("button",{onClick:()=>S(new Date($.getFullYear(),$.getMonth()+1)),className:y("p-1 rounded",m?"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:(l==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(T=>jsx("div",{className:y("w-8 h-8 flex items-center justify-center text-xs",m?"text-[#6B7280]":"text-gray-400"),children:T},T))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let T=$.getFullYear(),ee=$.getMonth(),ie=new Date(T,ee,1).getDay(),R=new Date(T,ee+1,0).getDate(),Y=new Date(T,ee,0).getDate(),V=new Date,we=[];for(let Me=ie-1;Me>=0;Me--)we.push({day:Y-Me,isCurrentMonth:false,date:new Date(T,ee-1,Y-Me)});for(let Me=1;Me<=R;Me++)we.push({day:Me,isCurrentMonth:true,date:new Date(T,ee,Me)});let Le=42-we.length;for(let Me=1;Me<=Le;Me++)we.push({day:Me,isCurrentMonth:false,date:new Date(T,ee+1,Me)});return we.map((Me,Kt)=>{let $t=Me.date.toDateString()===V.toDateString(),Qt=f.startDate?.toDateString()===Me.date.toDateString(),re=f.endDate?.toDateString()===Me.date.toDateString(),Ce=Qt||re,Je=f.startDate&&f.endDate&&Me.date>=f.startDate&&Me.date<=f.endDate;return jsx("button",{className:y("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!Me.isCurrentMonth&&(m?"text-[#4B5563]":"text-gray-300"),Me.isCurrentMonth&&(m?"text-white":"text-gray-900"),$t&&"ring-2 ring-[#3B82F6]",Qt&&"bg-[#3B82F6] text-white",re&&!Qt&&"bg-[#7C3AED] text-white",Je&&!Ce&&(m?"bg-[#7C3AED]/20":"bg-purple-100"),!Ce&&(m?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{let At=new Date(Me.date);if(I==="start"){let Oa=f.endDate&&At>f.endDate?At:f.endDate;Ge(At,Oa),k("end");}else {let Oa=f.startDate&&At<f.startDate?At:f.startDate;Ge(Oa,At),k(null);}},children:Me.day},Kt)})})()})]})]})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Flag,{className:y("w-4 h-4",m?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:y("text-sm w-24",m?"text-[#9CA3AF]":"text-gray-500"),children:l==="es"?"Prioridad":"Priority"}),jsx("button",{onClick:()=>{_e(),Re(!Pe);},className:y("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",f.priority==="high"||f.priority==="urgent"?"bg-red-500/20 text-red-400":f.priority==="medium"?"bg-yellow-500/20 text-yellow-400":f.priority==="low"?"bg-green-500/20 text-green-400":m?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:f.priority?f.priority==="high"||f.priority==="urgent"?l==="es"?"Urgente":"Urgent":f.priority==="medium"?l==="es"?"Media":"Medium":l==="es"?"Baja":"Low":l==="es"?"Sin prioridad":"No priority"}),jsx(AnimatePresence,{children:Pe&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Re(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:y("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",m?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:l==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:l==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:l==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:l==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:l==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(T=>jsxs("button",{onClick:()=>{Oe("priority",T.id),Re(false);},className:y("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",m?"hover:bg-white/5":"hover:bg-gray-50",f.priority===T.id&&(m?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:y("w-2 h-2 rounded-full",T.color)}),jsx("span",{className:m?"text-white":"text-gray-900",children:T.label})]},T.id||"none"))})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:y("w-4 h-4",m?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:y("text-sm w-24",m?"text-[#9CA3AF]":"text-gray-500"),children:l==="es"?"Duraci\xF3n":"Duration"}),jsx("span",{className:y("text-sm",m?"text-white":"text-gray-900"),children:f.startDate&&f.endDate?`${Math.ceil((f.endDate.getTime()-f.startDate.getTime())/(1e3*60*60*24))} ${l==="es"?"d\xEDas":"days"}`:l==="es"?"Sin definir":"Not set"})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:y("w-4 h-4 rounded-full border-2",m?"border-[#6B7280]":"border-gray-400")}),jsx("span",{className:y("text-sm w-24",m?"text-[#9CA3AF]":"text-gray-500"),children:l==="es"?"Progreso":"Progress"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[L?jsx("input",{type:"range",min:"0",max:"100",step:"5",value:f.progress||0,onChange:T=>{let ee=parseInt(T.target.value),ie=f.status;ee===100?ie="completed":ee>0?ie="in-progress":ie="todo";let R={...f,progress:ee,status:ie};x(R),a.onTaskUpdate?.(R);},onBlur:()=>W(false),className:y("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",m?"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:()=>W(true),className:y("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",m?"bg-white/10":"bg-gray-200"),children:jsx("div",{className:y("h-full rounded-full transition-all",f.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${f.progress||0}%`}})}),jsxs("span",{className:y("text-sm font-medium min-w-[40px]",m?"text-white":"text-gray-900"),children:[f.progress||0,"%"]})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Tag,{className:y("w-4 h-4",m?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:y("text-sm w-24",m?"text-[#9CA3AF]":"text-gray-500"),children:l==="es"?"Etiquetas":"Tags"}),jsx(Xa,{selectedTags:f.tags||[],availableTags:p,onChange:T=>{Oe("tags",T);},onCreateTag:i,theme:v})]}),jsxs("div",{className:"flex items-start gap-3 relative",children:[jsx(Link2,{className:y("w-4 h-4 mt-1.5",m?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:y("text-sm w-24 mt-1",m?"text-[#9CA3AF]":"text-gray-500"),children:l==="es"?"Relaciones":"Relations"}),jsxs("div",{className:"flex-1",children:[f.dependencies&&f.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:f.dependencies.map(T=>{let ee=e.find(ie=>ie.id===T);return jsxs("span",{className:y("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",m?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[ee?.name||T.slice(0,8),jsx("button",{onClick:()=>{let ie=(f.dependencies||[]).filter(R=>R!==T);Oe("dependencies",ie);},className:y("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsx(X,{className:"w-3 h-3"})})]},T)})}),jsxs("button",{onClick:()=>{_e(),Ee(!pe);},className:y("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",m?"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:y("text-sm",m?"text-[#9CA3AF]":"text-gray-500"),children:l==="es"?"Agregar dependencia":"Add dependency"})]}),jsx(AnimatePresence,{children:pe&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Ee(false),ut("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:y("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",m?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsx("div",{className:y("p-2 border-b",m?"border-white/10":"border-gray-200"),children:jsx("input",{type:"text",value:jt,onChange:T=>ut(T.target.value),placeholder:l==="es"?"Buscar tarea...":"Search task...",className:y("w-full px-3 py-2 rounded-md text-sm outline-none",m?"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(T=>T.id!==f.id).filter(T=>jt===""||T.name.toLowerCase().includes(jt.toLowerCase())).map(T=>{let ee=f.dependencies?.includes(T.id);return jsxs("button",{onClick:()=>{let ie=f.dependencies||[],R;ee?R=ie.filter(Y=>Y!==T.id):R=[...ie,T.id],Oe("dependencies",R);},className:y("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",m?"hover:bg-white/5":"hover:bg-gray-50",ee&&(m?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:y("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",ee?"bg-blue-500 border-blue-500":m?"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:y("block truncate",m?"text-white":"text-gray-900"),children:T.name}),jsx("span",{className:y("text-xs",m?"text-[#6B7280]":"text-gray-400"),children:T.id.slice(0,8)})]})]},T.id)}):jsx("div",{className:y("px-3 py-4 text-sm text-center",m?"text-[#6B7280]":"text-gray-500"),children:l==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]})]}),jsxs("div",{className:y("mt-6 pt-4 border-t",m?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsx(FileText,{className:y("w-4 h-4",m?"text-[#6B7280]":"text-gray-400")}),jsx("h3",{className:y("text-sm font-semibold",m?"text-white":"text-gray-900"),children:l==="es"?"Descripci\xF3n":"Description"})]}),jsx("textarea",{value:f.description||"",onChange:T=>Oe("description",T.target.value),placeholder:l==="es"?"Agregar descripci\xF3n...":"Add description...",className:y("w-full min-h-[100px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors",m?"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:y("flex items-center gap-2 text-sm mt-2 transition-colors",m?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsx(Sparkles,{className:"w-4 h-4"}),l==="es"?"Escribe con IA":"Write with AI"]})]}),jsxs("div",{className:y("mt-6 pt-4 border-t",m?"border-white/10":"border-gray-200"),children:[jsx("h3",{className:y("text-sm font-semibold mb-3",m?"text-white":"text-gray-900"),children:l==="es"?"Campos personalizados":"Custom fields"}),jsxs("button",{className:y("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",m?"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"}),l==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxs("div",{className:y("mt-6 pt-4 border-t",m?"border-white/10":"border-gray-200"),children:[jsx("h3",{className:y("text-sm font-semibold mb-3",m?"text-white":"text-gray-900"),children:l==="es"?"Agregar subtarea":"Add subtask"}),f.subtasks&&f.subtasks.length>0&&jsx("div",{className:"space-y-2 mb-3",children:f.subtasks.map(T=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:y("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",T.progress===100?"bg-green-500 border-green-500":m?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:T.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("span",{className:y("text-sm",T.progress===100?"line-through text-[#6B7280]":m?"text-white":"text-gray-900"),children:T.name})]},T.id))}),jsxs("button",{className:y("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",m?"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"}),l==="es"?"Add Tarea":"Add Task"]})]}),jsxs("div",{className:y("mt-6 pt-4 border-t",m?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("h3",{className:y("text-sm font-semibold",m?"text-white":"text-gray-900"),children:l==="es"?"Listas de control":"Checklists"}),jsx("button",{className:y("p-1 rounded transition-colors",m?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsx(Plus,{className:"w-4 h-4"})})]}),jsxs("button",{className:y("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",m?"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"}),l==="es"?"Crear lista de control":"Create checklist"]})]}),jsxs("div",{className:y("mt-6 pt-4 border-t",m?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:y("text-sm font-semibold mb-3",m?"text-white":"text-gray-900"),children:[l==="es"?"Adjuntos":"Attachments",oe.length>0&&jsxs("span",{className:y("ml-2 text-xs font-normal",m?"text-[#6B7280]":"text-gray-400"),children:["(",oe.length,")"]})]}),oe.length>0&&jsx("div",{className:"space-y-2 mb-4",children:oe.map(T=>{let ee=Q(T.type),ie=T.type.startsWith("image/");return jsxs("div",{className:y("flex items-center gap-3 p-2 rounded-lg group transition-colors",m?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[ie&&T.thumbnailUrl?jsx("img",{src:T.thumbnailUrl,alt:T.name,className:"w-10 h-10 rounded object-cover"}):jsx("div",{className:y("w-10 h-10 rounded flex items-center justify-center",m?"bg-white/10":"bg-gray-200"),children:jsx(ee,{className:y("w-5 h-5",m?"text-[#9CA3AF]":"text-gray-500")})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",className:y("text-sm font-medium truncate block hover:underline",m?"text-white":"text-gray-900"),children:T.name}),jsx("p",{className:y("text-xs",m?"text-[#6B7280]":"text-gray-400"),children:Ht(T.size)})]}),a.onDeleteAttachment&&jsx("button",{onClick:()=>a.onDeleteAttachment?.(T.id),className:y("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",m?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:l==="es"?"Eliminar":"Delete",children:jsx(Trash2,{className:"w-4 h-4"})})]},T.id)})}),jsxs("div",{onDragOver:Qe,onDragLeave:ct,onDrop:kt,className:y("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",Se?m?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":m?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",yt&&"pointer-events-none opacity-50"),children:[jsx("input",{type:"file",multiple:true,onChange:rt,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!a.onUploadAttachments||yt}),yt?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:y("text-sm",m?"text-[#9CA3AF]":"text-gray-500"),children:l==="es"?"Subiendo...":"Uploading..."})]}):jsxs(Fragment,{children:[jsx(Upload,{className:y("w-6 h-6 mx-auto mb-2",Se?"text-blue-500":m?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:y("text-sm",m?"text-[#9CA3AF]":"text-gray-500"),children:Se?l==="es"?"Suelta los archivos aqu\xED":"Drop files here":l==="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:y("text-xs mt-1",m?"text-[#6B7280]":"text-gray-400"),children:l==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxs("div",{className:y("w-[280px] border-l flex flex-col",m?"border-white/10 bg-[#141619]":"border-gray-200 bg-gray-50"),children:[jsx("div",{className:y("px-4 py-3 border-b flex items-center justify-between",m?"border-white/10":"border-gray-200"),children:jsx("span",{className:y("font-medium",m?"text-white":"text-gray-900"),children:l==="es"?"Actividad":"Activity"})}),jsx("div",{className:"flex-1 p-4 overflow-y-auto",children:jsxs("div",{className:y("text-sm text-center py-8",m?"text-[#6B7280]":"text-gray-400"),children:[jsx(MessageSquare,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),l==="es"?"Sin actividad reciente":"No recent activity"]})}),jsx("div",{className:y("p-3 border-t",m?"border-white/10":"border-gray-200"),children:jsx("div",{className:y("flex items-center gap-2 px-3 py-2 rounded-lg",m?"bg-white/5":"bg-white border border-gray-200"),children:jsx("input",{type:"text",placeholder:l==="es"?"Escribe un comentario...":"Write a comment...",className:y("flex-1 bg-transparent text-sm outline-none",m?"text-white placeholder-[#6B7280]":"text-gray-900 placeholder-gray-400")})})})]})]})]})}),jsx(AnimatePresence,{children:N&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>D(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:y("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",m?"bg-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:y("px-4 py-3 border-b flex items-center justify-between",m?"border-white/10":"border-gray-200"),children:[jsx("span",{className:y("font-medium",m?"text-white":"text-gray-900"),children:N.date.toLocaleDateString(l==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsx("button",{onClick:()=>D(null),className:y("p-1 rounded",m?"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:N.events.map(T=>jsxs("button",{onClick:()=>{D(null),x(T.task);},className:y("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",m?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx(Rc,{task:T.task}),jsx("span",{className:y("text-sm truncate flex-1",m?"text-white":"text-gray-900"),children:T.title}),T.task.priority==="high"||T.task.priority==="urgent"?jsx(Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},T.id))})]})]})})]})}var Mi={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"},Ai={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"},Fi={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"},$n={dark:Mi,light:Ai,neutral:Fi};function $c(e){return $n[e]||$n.dark}function rh({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:n,onDeleteStack:s,className:c}){let[p,i]=useState(false),u=useMemo(()=>t.filter(h=>e.cardIds.includes(h.id)),[t,e.cardIds]),d=useMemo(()=>{let h=u.length,b=new Set(u.flatMap(w=>w.assignedUserIds||[])).size,m=u.map(w=>w.priority).filter(Boolean),v=new Set(u.flatMap(w=>w.labels||[])).size;return {totalCards:h,uniqueAssignees:b,priorities:m,labels:v}},[u]),l=()=>{o?.(e.id);};return jsxs("div",{className:y("card-stack",!e.isExpanded&&"card-stack-collapsed",c),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxs("div",{className:"card-stack-header",onClick:l,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:y("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"]})]}),p&&jsx("div",{className:"card-stack-actions",children:jsx("button",{className:"card-stack-action",onClick:h=>{h.stopPropagation(),s?.(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:b=>{b.stopPropagation(),n?.(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 Wc={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function zo(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 $o(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 Hc(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 Gc({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:n,config:s,className:c}){let p=useMemo(()=>({...Wc,...s}),[s]),[i,u]=useState(new Set),d=useRef(null),l=useMemo(()=>{if(!p.groupByDay)return [{date:null,events:e}];let g=new Map;return e.forEach(f=>{let x=f.timestamp.toISOString().split("T")[0],N=g.get(x);N?N.push(f):g.set(x,[f]);}),Array.from(g.entries()).sort((f,x)=>x[0].localeCompare(f[0])).map(([f,x])=>({date:new Date(f),events:x.sort((N,D)=>D.timestamp.getTime()-N.timestamp.getTime())}))},[e,p.groupByDay]),{uniqueUsers:h,uniqueTypes:b}=useMemo(()=>{let g=new Set,f=new Set;return e.forEach(x=>{g.add(x.userId),f.add(x.type);}),{uniqueUsers:Array.from(g),uniqueTypes:Array.from(f)}},[e]),m=g=>{u(f=>{let x=new Set(f);return x.has(g)?x.delete(g):x.add(g),x});},v=g=>{let x=new Date().getTime()-g.getTime(),N=Math.floor(x/6e4),D=Math.floor(x/36e5),I=Math.floor(x/864e5);return N<1?"just now":N<60?`${N}m ago`:D<24?`${D}h ago`:I<7?`${I}d ago`:g.toLocaleDateString()},w=useMemo(()=>{let g=0;return t.types&&t.types.length>0&&g++,t.users&&t.users.length>0&&g++,t.dateRange&&g++,t.searchTerm&&g++,g},[t]);return useEffect(()=>{if(n&&d.current){let g=d.current.querySelector(`[data-event-id="${n}"]`);g&&g.scrollIntoView({behavior:"smooth",block:"center"});}},[n]),e.length===0?jsxs("div",{className:y("history-timeline-empty",c),children:[jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxs("div",{className:y("history-timeline",p.compact&&"compact",c),children:[jsxs("div",{className:"history-timeline-filters",children:[jsxs("div",{className:"history-timeline-filter-group",children:[jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:g=>{let f=g.target.value;a({...t,types:f?[f]:void 0});},children:[jsx("option",{value:"",children:"All Events"}),b.map(g=>jsxs("option",{value:g,children:[$o(g)," ",g.replace("_"," ")]},g))]}),h.length>1&&jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:g=>{let f=g.target.value;a({...t,users:f?[f]:void 0});},children:[jsx("option",{value:"",children:"All Users"}),h.map(g=>jsx("option",{value:g,children:g},g))]}),jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:g=>a({...t,searchTerm:g.target.value})})]}),w>0&&jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",w,")"]})]}),jsx("div",{className:"history-timeline-container",ref:d,children:l.map(g=>jsxs("div",{className:"history-timeline-group",children:[p.groupByDay&&g.date&&jsxs("div",{className:"history-timeline-day-header",children:[jsx("span",{className:"history-timeline-day-date",children:g.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxs("span",{className:"history-timeline-day-count",children:[g.events.length," events"]})]}),jsx("div",{className:"history-timeline-events",children:g.events.map((f,x)=>{let N=i.has(f.id),D=n===f.id,I=Hc(f.type);return jsxs("div",{"data-event-id":f.id,className:y("history-timeline-event",N&&"expanded",D&&"selected"),onClick:()=>o?.(f),children:[jsxs("div",{className:"history-timeline-line",children:[jsx("div",{className:"history-timeline-dot",style:{backgroundColor:I},children:p.showIcons&&jsx("span",{className:"history-timeline-dot-icon",children:$o(f.type)})}),x<g.events.length-1&&jsx("div",{className:"history-timeline-connector",style:{borderColor:I}})]}),jsxs("div",{className:"history-timeline-event-content",children:[jsxs("div",{className:"history-timeline-event-header",children:[jsxs("div",{className:"history-timeline-event-header-left",children:[p.showAvatars&&f.userAvatar&&jsx("img",{src:f.userAvatar,alt:f.userName||f.userId,className:"history-timeline-event-avatar"}),jsxs("div",{className:"history-timeline-event-description",children:[jsx("span",{className:"history-timeline-event-user",children:f.userName||f.userId}),jsx("span",{className:"history-timeline-event-action",children:zo(f)})]})]}),jsx("div",{className:"history-timeline-event-time",children:p.useRelativeTime?v(f.timestamp):f.timestamp.toLocaleString()})]}),Object.keys(f.changes).length>0&&jsxs("button",{className:"history-timeline-event-toggle",onClick:k=>{k.stopPropagation(),m(f.id);},children:[N?"\u25BC":"\u25B6"," Show changes"]}),N&&jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(f.changes).map(([k,$])=>jsxs("div",{className:"history-timeline-event-change",children:[jsxs("span",{className:"history-timeline-event-change-key",children:[k,":"]}),jsxs("div",{className:"history-timeline-event-change-values",children:[jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify($.from)}),jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify($.to)})]})]},k)),f.metadata&&Object.keys(f.metadata).length>0&&jsxs("div",{className:"history-timeline-event-metadata",children:[jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(f.metadata).map(([k,$])=>jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxs("span",{className:"history-timeline-event-metadata-key",children:[k,":"]}),jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify($)})]},k))]})]})]})]},f.id)})})]},g.date?.toISOString()||"all"))})]})}function Vc({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:n,onNext:s,onGoToEvent:c,onSpeedChange:p,className:i}){let u=[.5,1,1.5,2,3],d=useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),l=useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxs("div",{className:y("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:y("history-replay",i),children:[jsxs("div",{className:"history-replay-current-event",children:[jsx("div",{className:"history-replay-event-icon",children:d&&$o(d.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:d&&zo(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=>c(parseInt(h.target.value))}),jsx("div",{className:"history-replay-progress-fill",style:{width:`${l}%`}}),jsx("div",{className:"history-replay-progress-markers",children:t.map((h,b)=>jsx("div",{className:y("history-replay-progress-marker",b===e.currentIndex&&"active"),style:{left:`${b/(e.totalEvents-1)*100}%`},onClick:()=>c(b),title:zo(h)},h.id))})]}),jsxs("div",{className:"history-replay-controls",children:[jsx("button",{className:"history-replay-control-btn",onClick:n,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:s,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:y("history-replay-speed-btn",e.speed===h&&"active"),onClick:()=>p(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:y("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 Ii(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 Li(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 jc(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 Kc(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function dh(e,t,a,r,o,n=100){let s=e.map(p=>({...p,x:p.x??a/2+Math.random()*100-50,y:p.y??r/2+Math.random()*100-50,vx:0,vy:0})),c=new Map(s.map(p=>[p.id,p]));for(let p=0;p<n;p++){let i=1-p/n;s.forEach(u=>{let d=a/2,l=r/2;u.vx+=(d-u.x)*o.centerForce*i,u.vy+=(l-u.y)*o.centerForce*i,s.forEach(h=>{if(u.id===h.id)return;let b=u.x-h.x,m=u.y-h.y,v=Math.sqrt(b*b+m*m)||1,w=o.chargeStrength*i/(v*v);u.vx+=b/v*w,u.vy+=m/v*w;});}),t.forEach(u=>{let d=c.get(typeof u.source=="string"?u.source:u.source.id),l=c.get(typeof u.target=="string"?u.target:u.target.id);if(!d||!l)return;let h=l.x-d.x,b=l.y-d.y,m=Math.sqrt(h*h+b*b)||1,v=(m-o.linkDistance)/m*o.forceStrength*i;d.vx+=h*v,d.vy+=b*v,l.vx-=h*v,l.vy-=b*v;}),s.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 s}function Yc({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:n,stats:s,onInteraction:c,className:p}){let i=useRef(null),[u,d]=useState([]),[l,h]=useState(null),[b,m]=useState(null),[v,w]=useState(null),[g,f]=useState(1),[x,N]=useState({x:0,y:0});useEffect(()=>{if(e.length===0)return;let B=dh(e,t,a.width,a.height,a,150);d(B);},[e,t,a]);let D=useCallback((B,J)=>{a.enableDragging&&(J.stopPropagation(),h(B));},[a.enableDragging]),I=useCallback(B=>{if(!l||!i.current)return;let ne=i.current.getBoundingClientRect(),xe=(B.clientX-ne.left-x.x)/g,Pe=(B.clientY-ne.top-x.y)/g;d(Re=>Re.map(le=>le.id===l?{...le,x:xe,y:Pe,fx:xe,fy:Pe}:le));},[l,g,x]),k=useCallback(()=>{h(null);},[]),$=useCallback((B,J)=>{J.stopPropagation(),c?.({type:"node-click",node:B,position:{x:J.clientX,y:J.clientY}});},[c]),S=useCallback((B,J)=>{J.stopPropagation(),c?.({type:"edge-click",edge:B,position:{x:J.clientX,y:J.clientY}});},[c]),C=useCallback(B=>{let J=u.find(ne=>ne.id===B);return J?{x:J.x,y:J.y}:{x:0,y:0}},[u]),H=useCallback(B=>{if(B.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return B.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let J=B.card.priority;return J==="URGENT"?"#ef4444":J==="HIGH"?"#f59e0b":J==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return B.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxs("div",{className:y("relationships-graph-empty",p),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:y("relationships-graph",p),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:s.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:s.totalEdges}),jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),n&&jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsx("span",{className:"relationships-graph-stat-value",children:n.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:()=>f(B=>Math.min(B+.2,3)),children:"+"}),jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(g*100),"%"]}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>f(B=>Math.max(B-.2,.5)),children:"\u2212"}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{f(1),N({x:0,y:0});},children:"Reset"})]})]}),jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(B=>B.type))).map(B=>jsxs("div",{className:"relationships-graph-legend-item",children:[jsx("div",{className:"relationships-graph-legend-color",style:{background:Ii(B)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[jc(B)," ",Li(B)]})]},B))}),jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:I,onMouseUp:k,onMouseLeave:k,children:[jsxs("g",{transform:`translate(${x.x}, ${x.y}) scale(${g})`,children:[jsx("g",{className:"relationships-graph-edges",children:t.map(B=>{let J=C(typeof B.source=="string"?B.source:B.source.id),ne=C(typeof B.target=="string"?B.target:B.target.id),xe=Kc(B.type),Pe=v===B.id,Re=B.onCriticalPath;return jsxs("g",{className:y("relationships-graph-edge",Pe&&"hovered",Re&&"critical"),onMouseEnter:()=>w(B.id),onMouseLeave:()=>w(null),onClick:le=>S(B,le),children:[jsx("line",{x1:J.x,y1:J.y,x2:ne.x,y2:ne.y,stroke:Ii(B.type),strokeWidth:Re?a.edgeWidth*2:a.edgeWidth,strokeOpacity:Pe?1:.6,markerEnd:xe?"url(#arrowhead)":void 0}),a.showEdgeLabels&&Pe&&jsx("text",{x:(J.x+ne.x)/2,y:(J.y+ne.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Li(B.type)})]},B.id)})}),jsx("g",{className:"relationships-graph-nodes",children:u.map(B=>{let J=b===B.id,ne=B.onCriticalPath;return jsxs("g",{className:y("relationships-graph-node",J&&"hovered",ne&&"critical"),transform:`translate(${B.x}, ${B.y})`,onMouseDown:xe=>D(B.id,xe),onMouseEnter:()=>m(B.id),onMouseLeave:()=>m(null),onClick:xe=>$(B,xe),children:[jsx("circle",{r:ne?a.nodeSize*1.2:a.nodeSize,fill:H(B),stroke:ne?"#fbbf24":"#ffffff",strokeWidth:ne?3:2,opacity:J?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 Jc({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[n,s]=useState(""),[c,p]=useState(false),[i,u]=useState(null),[d,l]=useState(null),h=useRef(null),b=c||o;useEffect(()=>{e&&h.current&&h.current.focus();},[e]),useEffect(()=>{let g=f=>{f.key==="Escape"&&!b&&m();};if(e)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[e,b]);let m=()=>{b||(s(""),u(null),l(null),t());},v=async()=>{if(!(!n.trim()||b)){p(true),u(null),l(null);try{let g=await r(n.trim());l(g);}catch(g){u(g instanceof Error?g.message:"Failed to generate plan");}finally{p(false);}}},w=()=>{d&&(a(d),m());};return e?jsxs(ot,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:m}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-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:g=>g.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:m,disabled:b,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((g,f)=>jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:g.title},f))})]}),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((g,f)=>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:g.title}),g.description&&jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:g.description})]}),g.priority&&jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${g.priority==="URGENT"?"bg-red-500/20 text-red-400":g.priority==="HIGH"?"bg-orange-500/20 text-orange-400":g.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:g.priority})]})},f)),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:n,onChange:g=>s(g.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:b}),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((g,f)=>jsx("button",{onClick:()=>s(g),disabled:b,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:g},f))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:b&&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:m,disabled:b,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: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 Plan to Board"}):jsx("button",{onClick:v,disabled:!n.trim()||b,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:b?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Bi={"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 ph={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},mh={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 uh(e,t,a){let r=Bi[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,n=a/1e3*r.costPer1kOutput;return o+n}function Uo(e){return `$${e.toFixed(4)}`}var Ri=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=uh(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,l)=>d+l.cost,0),n=a.reduce((d,l)=>d+l.inputTokens,0),s=a.reduce((d,l)=>d+l.outputTokens,0),c=a.filter(d=>d.success),p=a.reduce((d,l)=>d+l.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:n,totalOutputTokens:s,operationsByFeature:i,costsByFeature:u,averageDuration:r>0?p/r:0,successRate:r>0?c.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],n=new Date,s=new Date;a==="month"?s.setMonth(n.getMonth()-1):s.setDate(n.getDate()-1);let c=this.operations.filter(u=>u.timestamp>=s).length,p=Math.max(0,o-c),i=c/o*100;return {used:c,limit:o,remaining:p,percentUsed:i,isExceeded:c>=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)}},Gr=new Ri;function ep({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=useState(Gr.getStats()),[n,s]=useState(Gr.checkLimit(a));if(useEffect(()=>{if(!e)return;let p=setInterval(()=>{o(Gr.getStats()),s(Gr.checkLimit(a));},1e3);return ()=>clearInterval(p)},[e,a]),useEffect(()=>{let p=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[e,t]),!e)return null;let c=Gr.getRecentOperations(5);return jsxs(ot,{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:p=>p.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[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:[n.used," / ",n.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,n.percentUsed)}%`,background:n.percentUsed>90?"#EF4444":n.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxs("p",{className:"text-xs text-white/60 mt-2",children:[n.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:Uo(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(([p,i])=>{let u=r.costsByFeature[p]||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:p.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:Uo(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}%`}})})]},p)})})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),c.length===0?jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsx("div",{className:"space-y-2",children:c.map(p=>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:p.feature.replace(/([A-Z])/g," $1").trim()}),jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(p.timestamp).toLocaleTimeString()," \u2022"," ",p.duration,"ms"]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[p.inputTokens+p.outputTokens," tokens"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:Uo(p.cost)}),jsx("div",{className:`w-2 h-2 rounded-full ${p.success?"bg-green-400":"bg-red-400"}`})]})]},p.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 rp({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:n}){let[s,c]=useState(""),[p,i]=useState(""),[u,d]=useState(""),[l,h]=useState(false),[b,m]=useState(null),[v,w]=useState(null),[g,f]=useState(null),x=useRef(null),N=l||o;useEffect(()=>{e&&x.current&&x.current.focus();},[e]),useEffect(()=>{let S=C=>{C.key==="Escape"&&!N&&D();};if(e)return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[e,N]);let D=()=>{N||(c(""),i(""),d(""),m(null),w(null),f(null),t());},I=async()=>{if(!(!s.trim()||N)){h(true),m(null),w(null),f(null);try{let S=await r({prompt:s.trim(),projectName:n||"Mi Proyecto",startDate:p||void 0,endDate:u||void 0});w(S.tasks.tasks),f({from_cache:S.from_cache,tokens_used:S.tokens_used,mock_mode:S.mock_mode,similarity:S.similarity,tokens_saved:S.tokens_saved});}catch(S){m(S instanceof Error?S.message:"Failed to generate tasks");}finally{h(false);}}},k=()=>{v&&(a(v),D());};if(!e)return null;let $=g?.similarity?((g.similarity||0)*100).toFixed(0):"0";return jsxs(ot,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:D}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:S=>S.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsx("button",{onClick:D,disabled:N,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:v?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:[g?.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"}),g?.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 (",$,"% 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:[g?.tokens_used||0," tokens"]}),g?.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:[g.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:[v.length," tasks"]})]}),jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:v.map((S,C)=>jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-colors",children:jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxs("span",{className:"text-xs text-white/50",children:["#",C+1]}),jsx("p",{className:"text-sm font-medium text-white/90",children:S.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"})]}),S.start," \u2192 ",S.end]}),jsxs("span",{children:[S.duration," days"]}),S.dependencies.length>0&&jsxs("span",{className:"text-blue-400",children:["Depends: ",S.dependencies.join(", ")]})]})]}),jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${S.priority==="high"?"bg-red-500/20 text-red-400":S.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:S.priority})]})},S.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:s,onChange:S=>c(S.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:N}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsx("input",{type:"date",value:p,onChange:S=>i(S.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:N})]}),jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsx("input",{type:"date",value:u,onChange:S=>d(S.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:N})]})]}),b&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:b}),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((S,C)=>jsx("button",{onClick:()=>c(S),disabled:N,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:S},C))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:N&&jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:D,disabled:N,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),v?jsx("button",{onClick:k,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsx("button",{onClick:I,disabled:!s.trim()||N,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:N?"Generating...":"Generate Tasks"})]})]})]})})]})}function Hn({initialBoard:e,onPersist:t}){let[a,r]=useState(e),o=useCallback(v=>{t&&qo(()=>Promise.resolve(t(v)),{maxAttempts:3,initialDelay:1e3,onRetry:(w,g,f)=>{console.warn(`Retry attempt ${g} after ${f}ms: ${w.message}`);}}).then(w=>{w.success||console.error(`Failed to persist board after ${w.attempts} attempts:`,w.error);});},[t]),n=useCallback(async(v,w,g)=>{r(f=>{let x=f.cards.find(S=>S.id===v);if(!x)return f;let N=x.columnId,D={...x,columnId:w,position:g},I=f.cards.map(S=>S.id===v?D:S),k=f.columns.map(S=>{if(S.id===N)return {...S,cardIds:S.cardIds.filter(C=>C!==v)};if(S.id===w){let C=I.filter(H=>H.columnId===w).sort((H,B)=>H.position-B.position);return {...S,cardIds:C.map(H=>H.id)}}return S}),$={...f,cards:I,columns:k};return o($),$});},[o]),s=useCallback(async(v,w)=>{r(g=>{let f=g.cards.map(N=>N.id===v?{...N,...w}:N),x={...g,cards:f};return o(x),x});},[o]),c=useCallback(async v=>{let w=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(g=>{let f={...v,id:w},x=g.columns.map(D=>D.id===v.columnId?{...D,cardIds:[...D.cardIds,w]}:D),N={...g,cards:[...g.cards,f],columns:x};return o(N),N});},[o]),p=useCallback(async v=>{r(w=>{let g=w.cards.find(D=>D.id===v);if(!g)return w;let f=w.cards.filter(D=>D.id!==v),x=w.columns.map(D=>D.id===g.columnId?{...D,cardIds:D.cardIds.filter(I=>I!==v)}:D),N={...w,cards:f,columns:x};return o(N),N});},[o]),i=useCallback(async v=>{let w=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(g=>{let f={...v,id:w,cardIds:[]},x={...g,columns:[...g.columns,f]};return o(x),x});},[o]),u=useCallback(async(v,w)=>{r(g=>{let f=g.columns.map(N=>N.id===v?{...N,...w}:N),x={...g,columns:f};return o(x),x});},[o]),d=useCallback(async v=>{r(w=>{let g=w.cards.filter(N=>N.columnId!==v),f=w.columns.filter(N=>N.id!==v),x={...w,cards:g,columns:f};return o(x),x});},[o]),l=useCallback(v=>{let w=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return c(v),w},[c]),h=useCallback(v=>{let w=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(v),w},[i]),b=useCallback(()=>{r(v=>{let w={...v,cards:[],columns:[]};return o(w),w});},[o]);return {board:a,callbacks:{onCardMove:n,onCardUpdate:s,onCardCreate:c,onCardDelete:p,onColumnCreate:i,onColumnUpdate:u,onColumnDelete:d},setBoard:r,helpers:{addCard:l,addColumn:h,deleteCard:p,deleteColumn:d,clearBoard:b}}}function np({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:n}=Hn({initialBoard:e,onPersist:a}),s=useMemo(()=>({addCard:(p,i,u={})=>{n.addCard({title:i,columnId:p,position:r.cards.filter(d=>d.columnId===p).length,...u});},addColumn:(p,i)=>{let u=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;n.addColumn({title:p,position:i??u+1e3});},reset:n.clearBoard}),[r.cards,r.columns,n]);return {props:useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:s}}var Wo={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},ip={by:"none",order:"asc"};function lp({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=useState({...Wo,...e}),[n,s]=useState({...ip,...t}),c=useCallback(m=>{o(v=>({...v,...m}));},[]),p=useCallback(m=>{s(v=>({...v,...m}));},[]),i=useCallback(()=>{o(Wo),s(ip);},[]),u=useCallback(()=>{a&&o({...Wo,assignees:[a]});},[a]),d=useCallback(()=>{o({...Wo,dateFilter:"overdue"});},[]),l=useCallback(()=>{o({...Wo,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!==""||n.by!=="none",[r,n]),b=useCallback(m=>{let v=[...m];if(r.search){let w=r.search.toLowerCase();v=v.filter(g=>g.title.toLowerCase().includes(w)||g.description?.toLowerCase().includes(w));}if(r.dateFilter!=="all"){let w=new Date,g=w.getFullYear(),f=String(w.getMonth()+1).padStart(2,"0"),x=String(w.getDate()).padStart(2,"0"),N=`${g}-${f}-${x}`;v=v.filter(D=>{if(!D.endDate&&!D.dueDate)return false;let I=D.endDate||D.dueDate;if(!I)return false;let k;if(typeof I=="string")k=I.split("T")[0]||I;else {let $=I.getUTCFullYear(),S=String(I.getUTCMonth()+1).padStart(2,"0"),C=String(I.getUTCDate()).padStart(2,"0");k=`${$}-${S}-${C}`;}switch(r.dateFilter){case "overdue":return k<N;case "today":return k===N;case "this-week":let $=new Date(N+"T00:00:00"),S=new Date(k+"T00:00:00"),C=new Date($);return C.setDate(C.getDate()+7),S>=$&&S<=C;case "custom":if(r.dateRange){let H=typeof I=="string"?new Date(I):I;return H>=r.dateRange.start&&H<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(v=v.filter(w=>w.priority&&r.priorities.includes(w.priority))),r.assignees.length>0&&(v=v.filter(w=>(w.assignedUserIds||(w.assigneeId?[w.assigneeId]:[])).some(f=>r.assignees.includes(f)))),r.labels.length>0&&(v=v.filter(w=>w.labels&&w.labels.some(g=>r.labels.includes(g)))),r.columns.length>0&&(v=v.filter(w=>r.columns.includes(w.columnId))),n.by!=="none"&&v.sort((w,g)=>{let f=0;switch(n.by){case "created":let x=w.createdAt?new Date(w.createdAt).getTime():0,N=g.createdAt?new Date(g.createdAt).getTime():0;f=x-N;break;case "priority":let D={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},I=D[w.priority||"LOW"],k=D[g.priority||"LOW"];f=I-k;break;case "dueDate":let $=w.endDate||w.dueDate,S=g.endDate||g.dueDate;if(!$)return 1;if(!S)return -1;let C=typeof $=="string"?new Date($).getTime():$.getTime(),H=typeof S=="string"?new Date(S).getTime():S.getTime();f=C-H;break;case "title":f=w.title.localeCompare(g.title);break;case "estimate":let B=w.estimatedTime||0,J=g.estimatedTime||0;f=B-J;break;default:f=0;}return n.order==="asc"?f:-f}),v},[r,n]);return {filters:r,sort:n,setFilters:c,setSort:p,resetFilters:i,filterMyTasks:u,filterOverdue:d,filterHighPriority:l,applyFilters:b,hasActiveFilters:h}}var cp,pp;if(typeof window<"u")try{let e=jo("ai");cp=e.generateObject,pp=e.generateText;}catch{}function mp(e={}){let[t,a]=useState(false),[r,o]=useState(null),n=!!(cp&&pp&&e.apiKey),s=useCallback(async d=>{if(!n)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(l){let h=l instanceof Error?l:new Error("Failed to generate plan");throw o(h),h}finally{a(false);}},[n]),c=useCallback(async d=>{if(!n)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(l){let h=l instanceof Error?l:new Error("Failed to suggest assignee");throw o(h),h}finally{a(false);}},[n]),p=useCallback(async d=>{if(!n)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(l){let h=l instanceof Error?l:new Error("Failed to predict risks");throw o(h),h}finally{a(false);}},[n]),i=useCallback(async d=>{if(!n)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(l){let h=l instanceof Error?l:new Error("Failed to generate subtasks");throw o(h),h}finally{a(false);}},[n]),u=useCallback(async d=>{if(!n)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(l){let h=l instanceof Error?l:new Error("Failed to estimate effort");throw o(h),h}finally{a(false);}},[n]);return {onGeneratePlan:s,onSuggestAssignee:c,onPredictRisks:p,onGenerateSubtasks:i,onEstimateEffort:u,isAvailable:n,isLoading:t,error:r}}function zi(){let[e,t]=useState(()=>selectionStore.getState());useEffect(()=>selectionStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{selectionStore.setState(r);},[]);return [e,a]}function up(e){let{cards:t}=e,[a,r]=zi(),o=useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),n=useCallback((d,l)=>{if(!l){r({selectedCardIds:[d],lastSelectedCardId:d});return}let h=l.ctrlKey||l.metaKey,b=l.shiftKey;if(h)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(m=>m!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(b&&a.lastSelectedCardId){let m=t.find(w=>w.id===d),v=t.find(w=>w.id===a.lastSelectedCardId);if(m&&v&&m.columnId===v.columnId){let w=t.filter(k=>k.columnId===m.columnId).sort((k,$)=>k.position-$.position),g=w.findIndex(k=>k.id===a.lastSelectedCardId),f=w.findIndex(k=>k.id===d),[x,N]=g<f?[g,f]:[f,g],D=w.slice(x,N+1).map(k=>k.id),I=Array.from(new Set([...a.selectedCardIds,...D]));r({selectedCardIds:I,lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});},[t,a,r]),s=useCallback(d=>{r({selectedCardIds:a.selectedCardIds.filter(l=>l!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),c=useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),p=useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=useCallback(d=>{a.selectedCardIds.includes(d)?s(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,s,r]),u=useCallback(()=>t.filter(d=>a.selectedCardIds.includes(d.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:n,deselectCard:s,clearSelection:c,selectAll:p,toggleCard:i,getSelectedCards:u}}var gp={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function fp(e){let{cards:t,config:a,aiService:r}=e,o=useMemo(()=>({...gp,...a}),[a]),[n,s]=useState([]),c=useCallback((m,v,w,g,f)=>{if(v.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:m,cardIds:v,columnId:w,strategy:g,color:f,isExpanded:true,position:n.filter(N=>N.columnId===w).length,createdAt:new Date};s(N=>[...N,x]);},[o.minCardsPerStack,n]),p=useCallback(m=>{s(v=>v.filter(w=>w.id!==m));},[]),i=useCallback(m=>{s(v=>v.map(w=>w.id===m?{...w,isExpanded:!w.isExpanded}:w));},[]),u=useCallback((m,v)=>{s(w=>w.map(g=>g.id===m&&!g.cardIds.includes(v)?{...g,cardIds:[...g.cardIds,v]}:g));},[]),d=useCallback((m,v)=>{s(w=>w.map(g=>{if(g.id===m){let f=g.cardIds.filter(x=>x!==v);return f.length<o.minCardsPerStack?null:{...g,cardIds:f}}return g}).filter(g=>g!==null));},[o.minCardsPerStack]),l=useCallback(m=>n.filter(v=>v.columnId===m).sort((v,w)=>v.position-w.position),[n]),h=useCallback(async m=>{let v=t.filter(N=>N.columnId===m);if(v.length<o.minCardsPerStack*2)return [];let w=[],g=new Map;v.forEach(N=>{N.labels&&N.labels.length>0&&N.labels.forEach(D=>{g.has(D)||g.set(D,[]),g.get(D).push(N);});}),g.forEach((N,D)=>{N.length>=o.minCardsPerStack&&w.push({stack:{title:`\u{1F4CC} ${D}`,cardIds:N.map(I=>I.id),columnId:m,strategy:"labels",color:"#3b82f6"},reason:`${N.length} cards with label "${D}"`,confidence:.85});});let f=new Map;v.forEach(N=>{N.assignedUserIds&&N.assignedUserIds.length>0&&N.assignedUserIds.forEach(D=>{f.has(D)||f.set(D,[]),f.get(D).push(N);});}),f.forEach((N,D)=>{N.length>=o.minCardsPerStack&&w.push({stack:{title:`\u{1F464} Assigned to user-${D.slice(-4)}`,cardIds:N.map(I=>I.id),columnId:m,strategy:"assignee",color:"#8b5cf6"},reason:`${N.length} cards assigned to the same user`,confidence:.8});});let x=new Map;if(v.forEach(N=>{N.priority&&(x.has(N.priority)||x.set(N.priority,[]),x.get(N.priority).push(N));}),x.forEach((N,D)=>{if(N.length>=o.minCardsPerStack){let I={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[D.toLowerCase()]||"\u26AA";w.push({stack:{title:`${I} ${D} Priority`,cardIds:N.map(k=>k.id),columnId:m,strategy:"priority",color:D==="high"||D==="urgent"?"#ef4444":"#10b981"},reason:`${N.length} cards with ${D} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let N of v){let I=(await r.findSimilar(N,v)).filter(k=>k.similarity>=o.autoStackConfidenceThreshold);if(I.length>=o.minCardsPerStack-1){let k=[N.id,...I.map(S=>S.card.id)],$=I.reduce((S,C)=>S+C.similarity,0)/I.length;w.push({stack:{title:`\u2728 Similar to "${N.title.substring(0,30)}${N.title.length>30?"...":""}"`,cardIds:k,columnId:m,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${I.length+1} similar tasks`,confidence:$});}}return w.filter(N=>N.confidence>=o.autoStackConfidenceThreshold).sort((N,D)=>D.confidence-N.confidence).slice(0,5)},[t,o,r]),b=useCallback(m=>{c(m.stack.title,m.stack.cardIds,m.stack.columnId,m.stack.strategy,m.stack.color);},[c]);return useEffect(()=>{o.enableAutoStacking&&n.length===0&&new Set(t.map(v=>v.columnId)).forEach(async v=>{let w=await h(v),g=w[0];w.length>0&&g&&g.confidence>=.9&&b(g);});},[]),{stacks:n,createStack:c,deleteStack:p,toggleStack:i,addToStack:u,removeFromStack:d,getStacksForColumn:l,getSuggestions:h,applySuggestion:b,config:o}}var hp=createContext(null);function bp({children:e,initialData:t,onStateChange:a}){let r=useRef();if(!r.current){let n=new Map,s=new Map;t?.columns?.forEach(p=>{let{Column:i}=jo("@libxai/core");n.set(p.id,new i(p));}),t?.cards?.forEach(p=>{let{Card:i}=jo("@libxai/core");s.set(p.id,new i(p));});let c=null;if(t?.board){let{Board:p}=jo("@libxai/core");c=new p(t.board);}r.current=new BoardStore({board:c,columns:n,cards:s});}let o=r.current;return useEffect(()=>{if(a)return o.subscribeAll(n=>{a(o.getState());})},[o,a]),jsx(hp.Provider,{value:{store:o},children:e})}function Gn(){let e=useContext(hp);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Go(){let e=Gn(),[t,a]=useState(e.getBoard()),[r,o]=useState(e.getAllColumns()),[n,s]=useState(e.getAllCards());useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),s(e.getAllCards());}),[e]);let c=useCallback(g=>{e.updateBoard(g);},[e]),p=useCallback(g=>{e.addColumn(g);},[e]),i=useCallback((g,f)=>{e.updateColumn(g,f);},[e]),u=useCallback(g=>{e.deleteColumn(g);},[e]),d=useCallback(g=>e.getColumn(g),[e]),l=useCallback(g=>{e.addCard(g);},[e]),h=useCallback((g,f)=>{e.updateCard(g,f);},[e]),b=useCallback(g=>{e.deleteCard(g);},[e]),m=useCallback((g,f,x)=>{e.moveCard(g,f,x);},[e]),v=useCallback(g=>e.getCard(g),[e]),w=useCallback(g=>e.getCardsByColumn(g),[e]);return {board:t,columns:r,cards:n,updateBoard:c,addColumn:p,updateColumn:i,deleteColumn:u,getColumn:d,addCard:l,updateCard:h,deleteCard:b,moveCard:m,getCard:v,getCardsByColumn:w}}function vp(e){let{cards:t}=Go();return useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let r=e.searchQuery.toLowerCase(),o=a.title.toLowerCase().includes(r),n=a.description?.toLowerCase().includes(r);if(!o&&!n)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 xp(e="position",t="asc"){let{cards:a}=Go();return useMemo(()=>[...a].sort((o,n)=>{let s=0;switch(e){case "title":s=o.title.localeCompare(n.title);break;case "priority":{let c={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},p=o.priority?c[o.priority]:0,i=n.priority?c[n.priority]:0;s=p-i;break}case "createdAt":s=o.createdAt.getTime()-n.createdAt.getTime();break;case "updatedAt":s=o.updatedAt.getTime()-n.updatedAt.getTime();break;case "position":s=o.position-n.position;break}return t==="asc"?s:-s}),[a,e,t])}var _n=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=hl.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 n of this.plugins.values()){if(!this.enabled.has(n.id))continue;let s=n[t];if(typeof s=="function")try{let c=await Promise.resolve(s.apply(n,a));c!==void 0&&(o=c,a[0]=c);}catch(c){this.pluginLogger.error(`Plugin hook failed: ${n.id}.${t}`,c,{plugin:n.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 n=o[t];typeof n=="function"&&r.push(Promise.resolve(n.apply(o,a)).catch(s=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,s,{plugin:o.id,hook:t});}));}await Promise.all(r);}},Mh=new _n;function wp({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:n=5,horizontal:s=false,gap:c=0,getItemKey:p}){let i=useRef(null),u=useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:n,horizontal:s,gap:c}),d=u.getVirtualItems(),l={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},h=s?{width:`${u.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${u.getTotalSize()}px`,width:"100%",position:"relative"};return jsx("div",{ref:i,style:l,className:o,children:jsx("div",{style:h,children:d.map(b=>{let m=e[b.index];if(!m)return null;let v=p?p(m,b.index):b.index,w={position:"absolute",top:s?0:b.start,left:s?b.start:0,width:s?b.size:"100%",height:s?"100%":b.size};return jsx("div",{style:w,"data-index":b.index,children:r(m,b.index)},v)})})})}function Cp(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 Np({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:n="",overscan:s=3,gap:c=16,getItemKey:p,horizontal:i=true}){let u=useRef(null),d=useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>u.current,estimateSize:()=>r,overscan:s,gap:c}),l=d.getVirtualItems(),h={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},b={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsx("div",{ref:u,style:h,className:n,children:jsx("div",{style:b,children:l.map(m=>{let v=e[m.index];if(!v)return null;let w=p?p(v,m.index):m.index,g={position:"absolute",top:0,left:m.start,width:m.size,height:"100%"};return jsx("div",{style:g,"data-index":m.index,children:o(v,m.index)},w)})})})}function Dp(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 Sp(e,t=10){return e>t}var Hi={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Gi={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},_i={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Vi={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},ji={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Ki={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Yi={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},qi={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)"},Xi={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)"},Ji={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Zi={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}},Qi={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}},Vn={spacing:Hi,borderRadius:Gi,fontSize:_i,fontWeight:Vi,lineHeight:ji,zIndex:Ki,duration:Yi,easing:qi,shadows:Xi,opacity:Ji,kanban:Zi,gantt:Qi};function Ep(e,t,a){return e[t]??a}function el(e,t="",a={}){for(let[r,o]of Object.entries(e)){let n=t?`${t}-${r}`:r;typeof o=="object"&&o!==null&&!Array.isArray(o)?el(o,n,a):(typeof o=="string"||typeof o=="number")&&(a[n]=o);}return a}function Ih(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function tl(e="asakaa"){let t=el(Vn),a=[];for(let[r,o]of Object.entries(t)){let n=`--${e}-${r}`,s=Ih(o);a.push(` ${n}: ${s};`);}return `:root {
|
|
390
390
|
${a.join(`
|
|
391
391
|
`)}
|
|
392
|
-
}`}function
|
|
392
|
+
}`}function _o(e,t="asakaa"){let a=[],r=el(e);for(let[o,n]of Object.entries(r)){let s=`--${t}-color-${o}`;a.push(` ${s}: ${n};`);}return `:root {
|
|
393
393
|
${a.join(`
|
|
394
394
|
`)}
|
|
395
|
-
}`}var
|
|
395
|
+
}`}var jn={background:{primary:"#1a1a1a",secondary:"#2a2a2a",tertiary:"#3a3a3a",card:"#2d2d2d",hover:"#353535",active:"#404040"},text:{primary:"#ffffff",secondary:"#b0b0b0",tertiary:"#808080",disabled:"#606060",inverse:"#1a1a1a"},border:{default:"#404040",hover:"#505050",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#3b82f6"},priority:{low:"#6b7280",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#404040",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#6b7280",weekend:"#2a2a2a"}},al={background:{primary:"#ffffff",secondary:"#f9fafb",tertiary:"#f3f4f6",card:"#ffffff",hover:"#f3f4f6",active:"#e5e7eb"},text:{primary:"#111827",secondary:"#6b7280",tertiary:"#9ca3af",disabled:"#d1d5db",inverse:"#ffffff"},border:{default:"#e5e7eb",hover:"#d1d5db",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#16a34a",warning:"#d97706",error:"#dc2626",info:"#2563eb"},priority:{low:"#9ca3af",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#e5e7eb",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#6b7280",weekend:"#f9fafb"}},rl={background:{primary:"#18181b",secondary:"#27272a",tertiary:"#3f3f46",card:"#27272a",hover:"#3f3f46",active:"#52525b"},text:{primary:"#fafafa",secondary:"#a1a1aa",tertiary:"#71717a",disabled:"#52525b",inverse:"#18181b"},border:{default:"#3f3f46",hover:"#52525b",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#3b82f6"},priority:{low:"#71717a",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#71717a",secondaryHover:"#52525b",secondaryActive:"#3f3f46"},gantt:{gridLine:"#3f3f46",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#71717a",weekend:"#27272a"}};function ol(e=jn,t="asakaa"){let a=tl(t),r=_o(e,t);return `${a}
|
|
396
396
|
|
|
397
|
-
${r}`}function
|
|
397
|
+
${r}`}function Pp(){return `/**
|
|
398
398
|
* ASAKAA Design Tokens
|
|
399
399
|
* Auto-generated from design-tokens.ts
|
|
400
400
|
* Do not edit this file directly
|
|
401
401
|
*/
|
|
402
402
|
|
|
403
|
-
${ol(
|
|
403
|
+
${ol(jn)}
|
|
404
404
|
|
|
405
405
|
/* Light theme */
|
|
406
406
|
[data-theme="light"] {
|
|
407
|
-
${
|
|
407
|
+
${_o(al,"asakaa").split(`
|
|
408
408
|
`).slice(1,-1).join(`
|
|
409
409
|
`)}
|
|
410
410
|
}
|
|
411
411
|
|
|
412
412
|
/* Neutral theme */
|
|
413
413
|
[data-theme="neutral"] {
|
|
414
|
-
${
|
|
414
|
+
${_o(rl,"asakaa").split(`
|
|
415
415
|
`).slice(1,-1).join(`
|
|
416
416
|
`)}
|
|
417
417
|
}
|
|
418
|
-
`}var Lh=({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
|
|
419
|
-
export{
|
|
418
|
+
`}var Lh=({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 Mp({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:n}=no();return jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(n).map(([s,c])=>{let p=s,i=p===r;return jsxs("button",{onClick:()=>o(p),className:`theme-switcher__button ${i?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${c.displayName} theme`,"aria-pressed":i,title:c.displayName,children:[jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsx(Lh,{theme:p})}),e&&!t&&jsx("span",{className:"theme-switcher__label",children:c.displayName})]},p)})})}
|
|
419
|
+
export{ep as AIUsageDashboard,mh as AI_FEATURES,Bi as AI_MODELS,vs as AddCardButton,ys as AddColumnButton,er as AttachmentUploader,bp as BoardProvider,dn as BulkOperationsToolbar,As as BurnDownChart,zc as CalendarBoard,or as Card,Ns as CardDetailModal,Es as CardDetailModalV2,Vc as CardHistoryReplay,Gc as CardHistoryTimeline,Yc as CardRelationshipsGraph,rh as CardStack,zs as CardTemplateSelector,es as CircuitBreaker,Zr as Column,fn as ColumnManager,ws as CommandPalette,Hs as ConfigMenu,lo as ContextMenu,Do as DEFAULT_SHORTCUTS,Os as DEFAULT_TEMPLATES,bo as DateRangePicker,vo as DependenciesSelector,wn as DependencyLine,Fs as DistributionCharts,ls as EditableColumnTitle,to as ErrorBoundary,Us as ExportImportModal,Ws as FilterBar,hc as GANTT_AI_SYSTEM_PROMPT,Pn as GanttAIAssistant,fc as GanttBoard,io as GanttI18nContext,Tn as GanttMilestone,gn as GanttToolbar,rp as GenerateGanttTasksDialog,Jc as GeneratePlanModal,Bs as GroupBySelector,br as KanbanBoard,hs as KanbanToolbar,Co as KanbanViewAdapter,Rs as KeyboardShortcutsHelp,Ec as ListView,St as MenuIcons,_n as PluginManager,Mr as PrioritySelector,ph as RATE_LIMITS,Is as SwimlaneBoardView,cs as TagBadge,jl as TagList,Xa as TagPicker,vn as TaskBar,En as TaskFormModal,yn as TaskGrid,js as ThemeModal,Pd as ThemeProvider,Mp as ThemeSwitcher,Dn as Timeline,Fr as UserAssignmentSelector,Ms as VelocityChart,Np as VirtualGrid,wp as VirtualList,Gr as aiUsageTracker,Gi as borderRadius,Yo as calculatePosition,Mi as calendarDarkTheme,Ci as calendarEnTranslations,Ti as calendarEsTranslations,Ai as calendarLightTheme,Fi as calendarNeutralTheme,$n as calendarThemes,Rn as calendarTranslations,An as cardToGanttTask,Cc as cardsToGanttTasks,y as cn,ld as createKanbanView,Yp as createRetryWrapper,Gs as darkTheme,jn as darkTokenTheme,pn as defaultTheme,Vn as designTokens,Yi as duration,qi as easing,Pp as exportTokensToCSS,lr as findTaskByName,_i as fontSize,Vi as fontWeight,Uo as formatCost,un as ganttEnTranslations,Ad as ganttEsTranslations,wc as ganttTaskToCardUpdate,Ve as ganttThemes,Qi as ganttTokens,Ks as ganttTranslations,me as ganttUtils,tl as generateCSSVariables,ol as generateCompleteCSS,_p as generateInitialPositions,bc as generateTasksContext,_o as generateThemeVariables,$c as getCalendarTheme,Bo as getCalendarTranslations,Pc as getListViewTheme,vi as getListViewTranslations,Mc as getMonthNames,Ep as getToken,Fd as getTranslations,Ac as getWeekdayNames,Zi as kanbanTokens,_s as lightTheme,al as lightTokenTheme,ji as lineHeight,xi as listViewDarkTheme,bi as listViewEnTranslations,yi as listViewEsTranslations,ki as listViewLightTheme,wi as listViewNeutralTheme,Bn as listViewThemes,Fn as listViewTranslations,On as mergeCalendarTranslations,In as mergeListViewTranslations,Ys as mergeTranslations,Vs as neutralTheme,rl as neutralTokenTheme,Ji as opacity,xc as parseLocalCommand,gi as parseNaturalDate,fi as parseNaturalDuration,hi as parseProgress,vc as parseStatus,Mh as pluginManager,Kp as retrySyncOperation,qo as retryWithBackoff,Xi as shadows,Sp as shouldVirtualizeGrid,Hi as spacing,Or as themes,mp as useAI,np as useBoard,Go as useBoardCore,Gn as useBoardStore,fp as useCardStacking,gs as useDragState,vp as useFilteredCards,lp as useFilters,So as useGanttI18n,Hn as useKanbanState,Dd as useKeyboardShortcuts,up as useMultiSelect,zi as useSelectionState,xp as useSortedCards,no as useTheme,Dp as useVirtualGrid,Cp as useVirtualList,kc as validateAIResponse,xs as withErrorBoundary,Jo as wouldCreateCircularDependency,Ki as zIndex};//# sourceMappingURL=index.js.map
|
|
420
420
|
//# sourceMappingURL=index.js.map
|