@libxai/board 0.17.409 → 0.17.410
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 +55 -55
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +55 -55
- package/dist/index.js.map +1 -1
- package/dist/styles.css +28 -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,useLayoutEffect,Component}from'react';import {useDroppable,useSensors,useSensor,PointerSensor,KeyboardSensor,DndContext,closestCorners,DragOverlay}from'@dnd-kit/core';import {useSortable,SortableContext,verticalListSortingStrategy,sortableKeyboardCoordinates}from'@dnd-kit/sortable';import {useVirtualizer}from'@tanstack/react-virtual';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {jsPDF}from'jspdf';import
|
|
2
|
-
`)}async function
|
|
3
|
-
`)?`"${e.replace(/"/g,'""')}"`:e}async function
|
|
4
|
-
`);if(t.length<1||!t[0])return {success:!1,errors:["CSV file is empty or invalid"]};let a=md(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let m=md(t[n]||"");if(m.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-m.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${m.length})`);continue}for(;m.length<a.length;)m.push("");let i={};a.forEach((v,k)=>{i[v]=m[k]||"";});let p=i.Column||"Unnamed";o.has(p)||o.set(p,{id:`col-${o.size+1}`,title:p,position:o.size+1,cardIds:[]});let l=o.get(p),b={id:i["Card ID"]||`card-${n}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:l.id,position:l.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};r.push(b),l.cardIds.push(b.id);}catch(m){s.push(`Line ${n+1}: ${m instanceof Error?m.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function md(e){let t=[],a="",r=false;for(let o=0;o<e.length;o++){let s=e[o],n=e[o+1];s==='"'&&r&&n==='"'?(a+='"',o++):s==='"'?r=!r:s===","&&!r?(t.push(a),a=""):a+=s;}return t.push(a),t}function pd(e,t){switch(t){case "json":return Bu(e);case "csv":return Ru(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function ud(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 gd(){return useContext(Rs)}var fd=createContext(null);function bd({children:e,themeName:t}){return jsx(fd.Provider,{value:{themeName:t},children:e})}function ko(){return useContext(fd)}function ft({children:e,container:t}){let[a,r]=useState(false),o=gd(),s=ko();if(useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let n=t||(typeof document<"u"?document.body:null);if(!n)return null;if(o){let{theme:m,themeName:g}=o,i={"--asakaa-color-background-primary":m.bgPrimary,"--asakaa-color-background-secondary":m.bgSecondary,"--asakaa-color-background-card":m.bgGrid,"--asakaa-color-background-hover":m.hoverBg,"--asakaa-color-text-primary":m.textPrimary,"--asakaa-color-text-secondary":m.textSecondary,"--asakaa-color-text-tertiary":m.textTertiary,"--asakaa-color-text-inverse":m.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":m.border,"--asakaa-color-border-hover":m.borderLight,"--asakaa-color-border-subtle":m.borderLight,"--asakaa-color-interactive-primary":m.accent,"--asakaa-color-interactive-primaryHover":m.accentHover,"--asakaa-color-interactive-primaryBorder":`${m.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${m.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${m.accent}33`,"--asakaa-color-status-success":m.statusCompleted,"--asakaa-color-status-warning":m.milestone,"--asakaa-color-status-error":m.criticalPath,"--asakaa-color-danger":m.criticalPath,"--asakaa-color-danger-border":`${m.criticalPath}4D`,"--asakaa-color-danger-background":`${m.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${m.criticalPath}26`};return createPortal(jsx("div",{"data-theme":g,"data-gantt-portal":"true",style:i,children:e}),n)}return s?createPortal(jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),n):createPortal(e,n)}var kd={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},_u="#BDC3C7",Vu=({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 eo({priority:e,onChange:t,className:a}){let[r,o]=useState(false),[s,n]=useState({top:0,left:0}),m=useRef(null),g=useRef(null),i=()=>{if(!g.current)return;let v=g.current.getBoundingClientRect(),k=window.innerHeight,C=window.innerWidth,h=160,f=220,u=4,x=v.right-h;x<10&&(x=v.left),x+h>C-10&&(x=C-h-10);let c=k-v.bottom,N=v.top,w;c>=f+u?w=v.bottom+u:N>=f+u?w=v.top-f-u:w=c>=N?v.bottom+u:Math.max(10,v.top-f-u),n({top:w,left:x}),o(true);};useEffect(()=>{let v=k=>{m.current&&!m.current.contains(k.target)&&!g.current?.contains(k.target)&&o(false);};if(r)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[r]),useEffect(()=>{let v=k=>{k.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[r]);let p=v=>{t(v),o(false);},l=e?kd[e]:null,b=l?.color||_u;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:g,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?`${b}10`:"transparent",boxShadow:e?`0 0 0 2px ${b}30 inset`:"none"},title:l?.label||"Set priority",children:jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:b,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:b,fillOpacity:e?"0.6":"0.4"})})}),r&&jsx(ft,{children:jsxs("div",{ref:m,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxs("div",{className:"py-1",children:[Object.entries(kd).map(([v,k])=>jsxs("button",{onClick:()=>p(v),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:k.color,background:"transparent"},onMouseEnter:C=>{C.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:C=>{C.currentTarget.style.background="transparent";},children:[jsx(Vu,{color:k.color}),jsx("span",{className:"font-semibold text-sm",children:k.label}),e===v&&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)),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:()=>p(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:v=>{v.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:v=>{v.currentTarget.style.background="transparent";},children:[jsx("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 ju=[{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 Ho({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=useState(false),[n,m]=useState({top:0,left:0}),g=useRef(null),i=useRef(null),b=(ko()?.themeName||"dark")==="dark",v=()=>{if(!i.current)return;let x=i.current.getBoundingClientRect(),c=window.innerHeight,N=window.innerWidth,w=320,B=380,y=4,I=x.left;I+w>N-10&&(I=N-w-10),I<10&&(I=10);let P=c-x.bottom,T=x.top,W;P>=B+y?W=x.bottom+y:T>=B+y?W=x.top-B-y:W=P>=T?x.bottom+y:Math.max(10,x.top-B-y),m({top:W,left:I}),s(true);};useEffect(()=>{let x=c=>{g.current&&!g.current.contains(c.target)&&!i.current?.contains(c.target)&&s(false);};if(o)return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[o]),useEffect(()=>{let x=c=>{c.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[o]);let k=x=>{let c=new Date,N=I=>{let P=I.getFullYear(),T=String(I.getMonth()+1).padStart(2,"0"),W=String(I.getDate()).padStart(2,"0");return `${P}-${T}-${W}`},w=N(c),B=new Date(c);B.setDate(B.getDate()+x);let y=N(B);a(w,y),s(false);},C=()=>{if(!e||!t)return "Set date";let x=B=>{if(B instanceof Date)return B;if(typeof B!="string"||!B.match(/^\d{4}-\d{2}-\d{2}$/))return null;let y=B.split("-").map(Number);if(y.length!==3||y.some(W=>isNaN(W)))return null;let I=y[0],P=y[1],T=y[2];return I===void 0||P===void 0||T===void 0?null:new Date(I,P-1,T)},c=x(e),N=x(t);if(!c||!N||isNaN(c.getTime())||isNaN(N.getTime()))return "Set date";let w=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${w[c.getMonth()]} ${c.getDate()} \u2013 ${w[N.getMonth()]} ${N.getDate()}`},h=e&&t,u=(()=>{if(!t)return false;let x=typeof t=="string"?new Date(t):t,c=new Date;return c.setHours(0,0,0,0),x<c})();return jsxs("div",{className:`relative ${r||""}`,children:[jsxs("button",{ref:i,onClick:()=>o?s(false):v(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${u?"asakaa-date-overdue":"asakaa-date"}`,title:h?`${C()}`:"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:C()})]}),o&&jsx(ft,{children:jsxs("div",{ref:g,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,background:b?"#1A1D25":"#FFFFFF",border:`1px solid ${b?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:b?"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:b?"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:b?"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:ju.map(x=>jsx("button",{onClick:()=>k(x.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:b?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${b?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:b?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:c=>{c.currentTarget.style.backgroundColor=b?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",c.currentTarget.style.border=`1px solid ${b?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:c=>{c.currentTarget.style.backgroundColor=b?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",c.currentTarget.style.border=`1px solid ${b?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:x.label},x.label))})]}),jsxs("div",{className:"p-4",children:[jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:b?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Custom Range"}),jsxs("div",{className:"space-y-3",children:[jsx("input",{type:"date",value:e||"",onChange:x=>a(x.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:b?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:b?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:b?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:b?"dark":"light"}}),jsx("input",{type:"date",value:t||"",onChange:x=>a(e,x.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:b?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:b?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:b?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:b?"dark":"light"}})]}),(e||t)&&jsx("button",{onClick:()=>{a(void 0,void 0),s(false);},className:"mt-4 w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all active:scale-95 border",style:{color:"#ef4444",borderColor:"rgba(239, 68, 68, 0.3)",background:"rgba(239, 68, 68, 0.1)"},onMouseEnter:x=>{x.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:x=>{x.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function ao({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=useState(false),[m,g]=useState(""),[i,p]=useState({top:0,left:0}),l=useRef(null),b=useRef(null),v=()=>{if(!b.current)return;let u=b.current.getBoundingClientRect(),x=window.innerHeight,c=window.innerWidth,N=300,w=380,B=4,y=u.right-N;y<10&&(y=u.left),y+N>c-10&&(y=c-N-10);let I=x-u.bottom,P=u.top,T;I>=w+B?T=u.bottom+B:P>=w+B?T=u.top-w-B:T=I>=P?u.bottom+B:Math.max(10,u.top-w-B),p({top:T,left:y}),n(true);};useEffect(()=>{let u=x=>{l.current&&!l.current.contains(x.target)&&!b.current?.contains(x.target)&&(n(false),g(""));};if(s)return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[s]),useEffect(()=>{let u=x=>{x.key==="Escape"&&(n(false),g(""));};if(s)return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[s]);let k=u=>{let x=e.some(c=>c.id===u.id);a(x?e.filter(c=>c.id!==u.id):[...e,u]);},C=t.filter(u=>u.name.toLowerCase().includes(m.toLowerCase())),h=e.slice(0,o),f=e.length-o;return jsxs("div",{className:`relative ${r||""}`,children:[jsx("button",{ref:b,onClick:()=>s?n(false):v(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxs("div",{className:"asakaa-avatar-group",children:[h.map(u=>jsx("div",{className:"asakaa-avatar",title:u.name,children:u.avatar?jsx("img",{src:u.avatar,alt:u.name,className:"asakaa-avatar-img"}):u.initials},u.id)),f>0&&jsxs("div",{className:"asakaa-avatar",children:["+",f]})]}):jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center transition-all",style:{background:"rgba(96, 165, 250, 0.15)",border:"1.5px solid rgba(96, 165, 250, 0.4)",color:"#60a5fa"},children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M8 8a3 3 0 100-6 3 3 0 000 6zM4 14c0-2.21 1.79-4 4-4s4 1.79 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),s&&jsx(ft,{children:jsxs("div",{ref:l,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("input",{type:"text",value:m,onChange:u=>g(u.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:C.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"}):C.map(u=>{let x=e.some(c=>c.id===u.id);return jsxs("button",{onClick:()=>k(u),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:c=>{c.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:c=>{c.currentTarget.style.background="transparent";},children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor:u.color,color:"#fff"},children:u.avatar?jsx("img",{src:u.avatar,alt:u.name,className:"w-full h-full rounded-full object-cover"}):u.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:u.name}),jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:x?"#3b82f6":"transparent"},children:x?"\u2713":""})]},u.id)})}),e.length>0&&jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsx("button",{onClick:()=>{a([]),n(false);},className:"w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all hover:bg-red-600/30 active:scale-95 border",style:{color:"#f87171",borderColor:"rgba(248, 113, 113, 0.3)",background:"rgba(248, 113, 113, 0.08)"},children:"Clear All"})})]})})]})}function Cn(e,t,a){let r=new Map;e.forEach(g=>{if(g.dependencies&&Array.isArray(g.dependencies)){let i=g.dependencies.map(p=>{if(typeof p=="string")return p;let l=p;return l.taskId||l.targetId||""}).filter(Boolean);r.set(g.id,i);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,m=g=>{if(!s.has(g)){s.add(g),n.add(g);let i=r.get(g)||[];for(let p of i){if(!s.has(p)&&m(p))return true;if(n.has(p))return true}}return n.delete(g),false};return m(a)}function Go({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[m,g]=useState(false),[i,p]=useState(""),[l,b]=useState(t.length>0),[v,k]=useState({top:0,left:0}),[C,h]=useState(null),f=useRef(null),u=useRef(null),x=()=>{if(!u.current)return;let y=u.current.getBoundingClientRect(),I=window.innerHeight,P=window.innerWidth,T=300,W=l?380:120,O=4,q=y.right-T;q<10&&(q=y.left),q+T>P-10&&(q=P-T-10);let te=I-y.bottom,ne=y.top,oe;te>=W+O?oe=y.bottom+O:ne>=W+O?oe=y.top-W-O:oe=te>=ne?y.bottom+O:Math.max(10,y.top-W-O),k({top:oe,left:q}),g(true);};useEffect(()=>{if(!m||!u.current)return;let y=u.current.getBoundingClientRect(),I=window.innerHeight,P=window.innerWidth,T=300,W=l?380:120,O=4,q=y.right-T;q<10&&(q=y.left),q+T>P-10&&(q=P-T-10);let te=I-y.bottom,ne=y.top,oe;te>=W+O?oe=y.bottom+O:ne>=W+O?oe=y.top-W-O:oe=te>=ne?y.bottom+O:Math.max(10,y.top-W-O),k({top:oe,left:q});},[l,m]),useEffect(()=>{let y=I=>{f.current&&!f.current.contains(I.target)&&!u.current?.contains(I.target)&&(g(false),p(""));};if(m)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[m]),useEffect(()=>{let y=I=>{I.key==="Escape"&&(g(false),p(""));};if(m)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[m]);let c=y=>{let I=t.includes(y),P=a.find(T=>T.id===y);if(h(null),I){let T=t.filter(W=>W!==y);r(T),T.length===0&&b(false);}else {if(s&&Cn(a,y,e)){let W=`Cannot add "${P?.title||y}" as dependency - would create circular reference`;h(W),n?.(y,P?.title||y),setTimeout(()=>h(null),3e3);return}r([...t,y]),b(true);}},N=()=>{let y=!l;b(y),y||r([]);},w=a.filter(y=>y.id!==e).filter(y=>y.title.toLowerCase().includes(i.toLowerCase())||y.id.toLowerCase().includes(i.toLowerCase())),B=t.length>0?"#3B82F6":"#BDC3C7";return jsxs("div",{className:`relative ${o||""}`,children:[jsxs("button",{ref:u,onClick:()=>m?g(false):x(),className:"flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5",title:t.length>0?`${t.length} dependencies`:"Add dependencies",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M7 9L9 7M11.5 3.5L10 2C8.89543 0.89543 7.10457 0.89543 6 2C4.89543 3.10457 4.89543 4.89543 6 6L7.5 7.5M4.5 12.5L6 14C7.10457 15.1046 8.89543 15.1046 10 14C11.1046 12.8954 11.1046 11.1046 10 10L8.5 8.5",stroke:B,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsx("span",{className:"text-xs font-medium",style:{color:B},children:t.length})]}),m&&jsx(ft,{children:jsxs("div",{ref:f,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${v.top}px`,left:`${v.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:[C&&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:C})]}),jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:N,children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:l?"#3b82f6":"transparent",borderColor:l?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:l&&jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),l&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsx("input",{type:"text",value:i,onChange:y=>p(y.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:w.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"}):w.map(y=>{let I=t.includes(y.id);return jsxs("button",{onClick:()=>c(y.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:P=>{P.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:P=>{P.currentTarget.style.background="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0 mt-0.5 transition-all",style:{background:I?"#3b82f6":"transparent",borderColor:I?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:I&&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:y.title}),jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:y.id})]})]},y.id)})})]}),t.length>0&&jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsx("button",{onClick:()=>{r([]),b(false),g(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 Dr=memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:m=[],allCards:g=[]})=>{let{attributes:i,listeners:p,setNodeRef:l,transform:b,transition:v,isDragging:k}=useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),C={transform:vn.Transform.toString(b),transition:v};if(t)return jsx("div",{ref:l,style:C,...i,...p,onClick:()=>a?.(e),children:t(e)});let h=m.filter(c=>e.assignedUserIds?.includes(c.id)),f=e.progress===100,u=(e.attachments||[]).filter(c=>c.type.startsWith("image/")),x={...C,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxs("div",{ref:l,style:x,className:d("asakaa-card",k&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...p,onClick:c=>{c.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||a?.(e);},children:[e.coverImage&&jsx("div",{className:"asakaa-card-cover mb-3",children:jsx("img",{src:e.coverImage,alt:`Cover for ${e.title}`,className:"w-full h-32 object-cover rounded-md",loading:"lazy",onError:c=>{c.currentTarget.style.display="none";}})}),u.length>0&&!e.coverImage&&jsx("div",{className:"asakaa-card-attachments mb-3",children:u.length===1&&u[0]?jsx("img",{src:u[0].url,alt:u[0].name,className:"w-full h-32 object-cover rounded-md",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:c=>{c.currentTarget.style.display="none";}}):jsx("div",{className:"grid grid-cols-2 gap-1",children:u.slice(0,4).map((c,N)=>jsxs("div",{className:"relative",children:[jsx("img",{src:c.url,alt:c.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:w=>{w.currentTarget.style.display="none";}}),N===3&&u.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:["+",u.length-4]})})]},c.id))})}),jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:f?"line-through":"none",opacity:f?.6:1},children:e.title}),e.description&&jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsx("div",{onClick:c=>c.stopPropagation(),className:"priority-selector",children:jsx(eo,{priority:e.priority,onChange:c=>n?.(e.id,{priority:c})})}),jsx("div",{onClick:c=>c.stopPropagation(),className:"date-picker",children:jsx(Ho,{startDate:e.startDate?typeof e.startDate=="string"?e.startDate:e.startDate.toISOString().split("T")[0]:void 0,endDate:e.endDate?typeof e.endDate=="string"?e.endDate:e.endDate.toISOString().split("T")[0]:void 0,onChange:(c,N)=>n?.(e.id,{startDate:c,endDate:N})})}),m.length>0&&jsx("div",{onClick:c=>c.stopPropagation(),className:"user-selector",children:jsx(ao,{assignedUsers:h,availableUsers:m,onChange:c=>n?.(e.id,{assignedUserIds:c.map(N=>N.id)})})}),jsx("div",{onClick:c=>c.stopPropagation(),className:"dependencies-selector",children:jsx(Go,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(c=>typeof c=="string"?c:c.taskId):[],availableTasks:g,onChange:c=>n?.(e.id,{dependencies:c})})})]}),e.labels&&e.labels.length>0&&jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(c=>jsx("span",{className:"asakaa-label",children:c},c))}),typeof e.progress=="number"&&jsxs("div",{className:"mt-3 pt-2 border-t border-white/5",children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:"text-[10px] text-[#6B7280]",children:"Progreso"}),jsxs("span",{className:"text-[10px] font-medium",style:{color:"#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)));Dr.displayName="Card";var Tn={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"}},Ad=({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 Fd({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=useState(false),[n,m]=useState({top:0,left:0}),g=useRef(null),i=useRef(null),p=[...Object.entries(Tn).map(([h,f])=>({id:h,label:f.label,color:f.color,icon:f.icon})),...r.filter(h=>!Object.keys(Tn).includes(h.id)).map(h=>({id:h.id,label:h.title,color:h.color||"#8B5CF6",icon:"circle-dot"}))],l=()=>{let h=Tn[e];if(h)return {...h,id:e};let f=r.find(u=>u.id===e);return f?{id:f.id,label:f.title,color:f.color||"#8B5CF6",icon:"circle-dot"}:{...Tn.todo,id:"todo"}},b=()=>{if(!i.current)return;let h=i.current.getBoundingClientRect(),f=window.innerHeight,u=window.innerWidth,x=180,c=280,N=4,w=h.right-x;w<10&&(w=h.left),w+x>u-10&&(w=u-x-10);let B=f-h.bottom,y=h.top,I;B>=c+N?I=h.bottom+N:y>=c+N?I=h.top-c-N:I=B>=y?h.bottom+N:Math.max(10,h.top-c-N),m({top:I,left:w}),s(true);};useEffect(()=>{let h=f=>{g.current&&!g.current.contains(f.target)&&!i.current?.contains(f.target)&&s(false);};if(o)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[o]),useEffect(()=>{let h=f=>{f.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[o]);let v=h=>{t(h),s(false);},k=l(),C=k.color;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:i,onClick:()=>o?s(false):b(),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:`${C}10`,boxShadow:`0 0 0 2px ${C}30 inset`},title:k.label,children:jsx(Ad,{icon:k.icon,color:C})}),o&&jsx(ft,{children:jsxs("div",{ref:g,className:"status-selector-menu",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsx("div",{className:"py-1",children:p.map(h=>jsxs("button",{onClick:()=>v(h.id),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:h.color,background:"transparent"},onMouseEnter:f=>{f.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:f=>{f.currentTarget.style.background="transparent";},children:[jsx(Ad,{icon:h.icon,color:h.color}),jsx("span",{className:"font-semibold",children:h.label}),e===h.id&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},h.id))})]})})]})}function Ld({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[s,n]=useState(false),[m,g]=useState(false),[i,p]=useState(e),[l,b]=useState({top:0,left:0}),v=useRef(null),k=useRef(null),C=useRef(null);useEffect(()=>{if(s&&k.current){let x=k.current.getBoundingClientRect();b({top:x.bottom+window.scrollY+8,left:x.left+window.scrollX});}},[s]),useEffect(()=>{let x=c=>{v.current&&!v.current.contains(c.target)&&!k.current?.contains(c.target)&&(n(false),g(false));};if(s)return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[s]),useEffect(()=>{let x=c=>{c.key==="Escape"&&(n(false),g(false),p(e));};if(s)return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[s,e]),useEffect(()=>{m&&C.current&&(C.current.focus(),C.current.select());},[m]);let h=()=>{g(true),p(e);},f=()=>{let x=i.trim();x&&x!==e&&t(x),g(false),n(false),p(e);},u=x=>{x.key==="Enter"?f():x.key==="Escape"&&(g(false),p(e));};return jsxs("div",{className:`relative ${o||""}`,children:[jsx("button",{ref:k,onClick:()=>n(!s),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:"Column options","aria-label":"Column menu",children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),s&&jsx(ft,{children:jsx("div",{ref:v,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${l.top}px`,left:`${l.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:m?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:C,type:"text",value:i,onChange:x=>p(x.target.value),onKeyDown:u,onBlur:f,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:h,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-white/90 hover:bg-white/10 transition-all",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-medium",children:"Rename"})]}),r&&a&&jsxs(Fragment,{children:[jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxs("button",{onClick:()=>{a(),n(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-red-400 hover:bg-red-500/10 transition-all",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M2 4H14M5 4V2.5C5 2.22386 5.22386 2 5.5 2H10.5C10.7761 2 11 2.22386 11 2.5V4M12.5 4V13.5C12.5 13.7761 12.2761 14 12 14H4C3.72386 14 3.5 13.7761 3.5 13.5V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M6.5 7V11M9.5 7V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),jsx("span",{className:"font-medium",children:"Delete"})]})]})]})})})]})}var To=memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:m,availableUsers:g,allCards:i,enableVirtualization:p,cardHeight:l=120,isCollapsed:b,onToggleCollapse:v,onColumnRename:k,onColumnDelete:C,isDeletable:h=false,className:f})=>{let{setNodeRef:u,isOver:x}=useDroppable({id:e.id,data:{type:"column",column:e}}),c=useRef(null),N=p??nd(t.length),w=useVirtualizer({count:t.length,getScrollElement:()=>c.current,estimateSize:()=>l,enabled:N});if(a)return jsx("div",{ref:u,className:f,children:a(e,t)});let y=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let T=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:T}:T>=80?{state:"warning",percentage:T}:T>=60?{state:"approaching",percentage:T}:{state:"ok",percentage:T}})(),I=y.state==="exceeded",P=()=>"asakaa-column-count";return jsxs("div",{ref:u,className:d("asakaa-column",x&&"ring-2 ring-asakaa-accent-blue",I&&"ring-2 ring-asakaa-accent-red",f),children:[o?o(e,t.length):jsxs("div",{className:"asakaa-column-header group",children:[jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:d(P()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&y.state!=="none"&&jsxs("span",{className:"text-xs font-medium flex items-center",title:`${y.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[y.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"})]}),y.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"})]}),y.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"})}),y.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"})]})]}),(k||C)&&jsx(Ld,{columnTitle:e.title,onRename:T=>k?.(e.id,T),onDelete:C?()=>C(e.id):void 0,isDeletable:h}),v&&jsx("button",{onClick:v,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":b?"Expand column":"Collapse column",children:b?"\u25B6":"\u25BC"})]})]}),!b&&jsx("div",{ref:c,className:"asakaa-column-cards",style:{maxHeight:N?"600px":void 0},children:jsx(SortableContext,{items:t.map(T=>T.id),strategy:verticalListSortingStrategy,children:t.length===0?s?s(e):jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsx("p",{children:"Drop cards here"})}):N?jsx("div",{style:{height:`${w.getTotalSize()}px`,position:"relative"},children:w.getVirtualItems().map(T=>{let W=t[T.index];return W?jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${T.start}px)`},children:jsx(Dr,{card:W,render:r,onClick:n,onUpdate:m,availableUsers:g,allCards:i})},W.id):null})}):t.map(T=>jsx(Dr,{card:T,render:r,onClick:n,onUpdate:m,availableUsers:g,allCards:i},T.id))})})]})});To.displayName="Column";function Hs({title:e,onSave:t,className:a}){let[r,o]=useState(false),[s,n]=useState(e),m=useRef(null);useEffect(()=>{r&&m.current&&(m.current.focus(),m.current.select());},[r]);let g=()=>{let p=s.trim();p&&p!==e?t(p):n(e),o(false);},i=p=>{p.key==="Enter"?g():p.key==="Escape"&&(n(e),o(false));};return r?jsx("input",{ref:m,type:"text",value:s,onChange:p=>n(p.target.value),onBlur:g,onKeyDown:i,className:d("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsx("h2",{className:d("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function lg(e,t){let a=e.slice(0,t),r=a.lastIndexOf("@");if(r===-1)return null;let o=a[r-1];if(r>0&&o&&!/\s/.test(o))return null;let s=a.slice(r+1);return /\s/.test(s)?null:{start:r,end:t,query:s.toLowerCase()}}function Ud(e,t){let a=[],r=/@(\S+)/g,o;for(;(o=r.exec(e))!==null;){let s=o[1]?.toLowerCase()??"";if(!s)continue;let n=t.find(m=>m.name.toLowerCase().replace(/\s+/g,"")===s||m.name.toLowerCase()===s);n&&!a.includes(n.id)&&a.push(n.id);}return a}function dg(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function zd({value:e,onChange:t,onSubmit:a,users:r,placeholder:o,disabled:s=false,isSubmitting:n=false,theme:m="dark",locale:g="es",currentUser:i}){let p=m==="dark",[l,b]=useState(false),[v,k]=useState([]),[C,h]=useState(0),[f,u]=useState(null),x=useRef(null),c=useRef(null),N=useCallback((P,T)=>{let W=lg(P,T);if(u(W),W){let O=r.filter(q=>q.name.toLowerCase().includes(W.query)||q.email&&q.email.toLowerCase().includes(W.query)).slice(0,5);k(O),b(O.length>0),h(0);}else b(false),k([]);},[r]),w=P=>{let T=P.target.value;t(T),N(T,P.target.selectionStart||0);},B=()=>{x.current&&N(e,x.current.selectionStart||0);},y=useCallback(P=>{if(!f||!x.current)return;let T=e.slice(0,f.start),W=e.slice(f.end),O=`@${P.name.replace(/\s+/g,"")} `,q=T+O+W;t(q),b(false),u(null),setTimeout(()=>{if(x.current){let te=f.start+O.length;x.current.selectionStart=te,x.current.selectionEnd=te,x.current.focus();}},0);},[f,e,t]),I=P=>{if(l&&v.length>0)switch(P.key){case "ArrowDown":P.preventDefault(),h(T=>T<v.length-1?T+1:0);break;case "ArrowUp":P.preventDefault(),h(T=>T>0?T-1:v.length-1);break;case "Enter":{P.preventDefault();let T=v[C];T&&y(T);break}case "Tab":{P.preventDefault();let T=v[C];T&&y(T);break}case "Escape":P.preventDefault(),b(false);break}else P.key==="Enter"&&!P.shiftKey&&(P.preventDefault(),a());};return useEffect(()=>{let P=T=>{c.current&&!c.current.contains(T.target)&&x.current&&!x.current.contains(T.target)&&b(false);};return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[]),useEffect(()=>{if(l&&c.current){let P=c.current.children[C];P&&P.scrollIntoView({block:"nearest"});}},[C,l]),jsxs("div",{className:"flex items-start gap-2",children:[i&&jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:i.color||"#8B5CF6"},children:i.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:d("flex-1 relative"),children:[jsxs("div",{className:d("flex items-center gap-2 px-3 py-2 rounded-lg",p?"bg-white/5":"bg-white border border-gray-200"),children:[jsx("input",{ref:x,type:"text",value:e,onChange:w,onSelect:B,onKeyDown:I,placeholder:o||(g==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||n,className:d("flex-1 bg-transparent text-sm outline-none",p?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400",(s||n)&&"opacity-50")}),jsx("button",{onClick:a,disabled:n||!e.trim()||s,className:d("p-1.5 rounded transition-colors",e.trim()&&!s?"bg-blue-500 text-white hover:bg-blue-600":p?"text-[#6B7280]":"text-gray-400",n&&"opacity-50 cursor-not-allowed"),children:n?jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsx(Send,{className:"w-4 h-4"})})]}),jsx(AnimatePresence,{children:l&&v.length>0&&jsx(motion.div,{ref:c,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:d("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",p?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:v.map((P,T)=>jsxs("button",{type:"button",onClick:()=>y(P),className:d("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",T===C?p?"bg-white/10":"bg-gray-100":p?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:P.color||"#8B5CF6"},children:dg(P.name)}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("p",{className:d("text-sm font-medium truncate",p?"text-white":"text-gray-900"),children:P.name}),P.email&&jsx("p",{className:d("text-xs truncate",p?"text-[#6B7280]":"text-gray-500"),children:P.email})]})]},P.id))})})]})]})}function Hd({content:e,theme:t="dark"}){let a=t==="dark",r=[],o=/@(\S+)/g,s=0,n;for(;(n=o.exec(e))!==null;)n.index>s&&r.push({type:"text",value:e.slice(s,n.index)}),r.push({type:"mention",value:n[0]}),s=n.index+n[0].length;return s<e.length&&r.push({type:"text",value:e.slice(s)}),jsx("span",{className:"whitespace-pre-wrap break-words",children:r.map((m,g)=>m.type==="mention"?jsx("span",{className:d("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:m.value},g):jsx("span",{children:m.value},g))})}var Pn=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function br({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[m,g]=useState(false),[i,p]=useState(""),[l,b]=useState(false),[v,k]=useState(Pn[10]||"#3B82F6"),[C,h]=useState({top:0,left:0}),f=useRef(null),u=useRef(null),x=useRef(null),c=useRef(null),N=t.filter(T=>T.name.toLowerCase().includes(i.toLowerCase())),w=t.some(T=>T.name.toLowerCase()===i.toLowerCase());useEffect(()=>{if(m&&u.current){let T=u.current.getBoundingClientRect();h({top:T.bottom+6,left:T.left});}},[m]),useEffect(()=>{let T=W=>{let O=W.target,q=f.current?.contains(O),te=x.current?.contains(O);!q&&!te&&(g(false),p(""),b(false));};if(m)return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[m]),useEffect(()=>{m&&c.current&&c.current.focus();},[m]);let B=T=>{let W=e.some(O=>O.id===T.id);a(W?e.filter(O=>O.id!==T.id):[...e,T]);},y=async()=>{if(!(!r||!i.trim())){b(true);try{let T=await r(i.trim(),v);T&&(a([...e,T]),p(""),k(Pn[Math.floor(Math.random()*Pn.length)]||"#3B82F6"));}finally{b(false);}}},I=(T,W)=>{W.stopPropagation(),a(e.filter(O=>O.id!==T));},P={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxs("div",{ref:f,className:"relative",children:[jsxs("button",{ref:u,type:"button",onClick:()=>!s&&g(!m),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:P,disabled:s,children:[jsx(Tag,{className:"w-3.5 h-3.5"}),e.length>0?jsxs("div",{className:"flex items-center gap-1",children:[e.slice(0,2).map(T=>jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${T.color}20`,color:T.color},children:T.name},T.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:m&&jsxs(motion.div,{ref:x,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:C.top,left:C.left,zIndex:99999,backgroundColor:o.bgPrimary,border:`1px solid ${o.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsx("div",{className:"p-2 border-b",style:{borderColor:o.border},children:jsx("input",{ref:c,type:"text",value:i,onChange:T=>p(T.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:T=>{T.key==="Enter"&&i.trim()&&!w&&r&&y();}})}),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(T=>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:`${T.color}20`,color:T.color},onClick:W=>I(T.id,W),children:[T.name,jsx(X,{className:"w-3 h-3"})]},T.id))})]}),jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:N.length>0?N.map(T=>{let W=e.some(O=>O.id===T.id);return jsxs("button",{type:"button",onClick:()=>B(T),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:W?`${T.color}15`:"transparent",color:o.textPrimary},onMouseEnter:O=>{W||(O.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:O=>{W||(O.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:T.color}}),jsx("span",{className:"flex-1 text-left",children:T.name}),W&&jsx(Check,{className:"w-4 h-4",style:{color:T.color}})]},T.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()&&!w&&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:Pn.map(T=>jsx("button",{type:"button",onClick:()=>k(T),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:T,outline:v===T?`2px solid ${T}`:"none",outlineOffset:"2px"}},T))}),jsxs("button",{type:"button",onClick:y,disabled:l,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:v,color:"#FFFFFF",opacity:l?.7:1},children:[l?jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsx(Plus,{className:"w-4 h-4"}),'Crear "',i.trim(),'"']})]})]})}),document.body)]})}function Gs({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 Gd({tags:e,maxVisible:t=3,size:a="sm"}){if(!e||e.length===0)return null;let r=e.slice(0,t),o=e.length-t;return jsxs("div",{className:"flex flex-wrap gap-1",children:[r.map(s=>jsx(Gs,{tag:s,size:a},s.id)),o>0&&jsxs("span",{className:`inline-flex items-center rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:"rgba(100,100,100,0.2)",color:"#9CA3AF"},children:["+",o]})]})}var hr=[{name:"Azul",value:"#6366F1",light:"#818CF8"},{name:"P\xFArpura",value:"#A855F7",light:"#C084FC"},{name:"Rosa",value:"#EC4899",light:"#F472B6"},{name:"Rojo",value:"#EF4444",light:"#F87171"},{name:"Naranja",value:"#F59E0B",light:"#FBBF24"},{name:"Amarillo",value:"#EAB308",light:"#FACC15"},{name:"Lima",value:"#84CC16",light:"#A3E635"},{name:"Verde",value:"#10B981",light:"#34D399"},{name:"Esmeralda",value:"#059669",light:"#10B981"},{name:"Cyan",value:"#06B6D4",light:"#22D3EE"},{name:"Azul Cielo",value:"#0EA5E9",light:"#38BDF8"},{name:"\xCDndigo",value:"#4F46E5",light:"#6366F1"},{name:"Violeta",value:"#8B5CF6",light:"#A78BFA"},{name:"Fucsia",value:"#D946EF",light:"#E879F9"},{name:"Coral",value:"#F97316",light:"#FB923C"},{name:"Magenta",value:"#E11D48",light:"#FB7185"}];function Yd(e,t=[]){if("title"in e&&!("name"in e)){let a=e,r=(a.assignedUserIds||[]).map(o=>{let s=t.find(n=>n.id===o);return s||null}).filter(o=>o!==null);return {id:a.id,name:a.title,startDate:a.startDate?new Date(a.startDate):void 0,endDate:a.endDate?new Date(a.endDate):void 0,progress:a.progress||0,status:a.columnId,priority:a.priority?.toLowerCase(),assignees:r,dependencies:Array.isArray(a.dependencies)?a.dependencies.map(o=>typeof o=="string"?o:o.taskId):[],tags:a.tags,subtasks:a.subtasks?.map(o=>({id:o.id,name:o.title,progress:o.completed?100:0,startDate:new Date,endDate:new Date})),color:a.color,description:a.description}}return e}function Rg(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 no({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:m=[],availableTags:g=[],onCreateTag:i,attachments:p=[],onUploadAttachments:l,onDeleteAttachment:b,availableTasks:v=[],comments:k=[],onAddComment:C,currentUser:h,mentionableUsers:f=[]}){let u=s==="dark",x={textTertiary:u?"#6B7280":"#9CA3AF",textSecondary:u?"#9CA3AF":"#6B7280",textPrimary:u?"#FFFFFF":"#111827",borderLight:u?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:u?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:u?"#1A1D25":"#FFFFFF",bgSecondary:u?"#0F1117":"#F9FAFB",hoverBg:u?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},c=e&&"title"in e&&!("name"in e),N=e,[w,B]=useState(e?Yd(e,m):null),[y,I]=useState(false),[P,T]=useState(false),[W,O]=useState(false),[q,te]=useState(null),[ne,oe]=useState(new Date),[ce,be]=useState(false),[Le,A]=useState(false),[R,L]=useState(""),[j,X$1]=useState(false),[z,ve]=useState(false),[se,Ie]=useState(false),[qe,Qe]=useState(""),ie=useRef(null),[Xe,lt]=useState(""),kt=useRef(null),[yt,$]=useState(""),[fe,Ae]=useState(false);useEffect(()=>{if(e){let F=Yd(e,m);B(F),Qe(F.description||""),lt(F.name||"");}},[e?.id,m]),useEffect(()=>()=>{ie.current&&clearTimeout(ie.current),kt.current&&clearTimeout(kt.current);},[]);let G=useCallback(F=>{B(F),c&&o&&N?o(Rg(F,N)):r&&r(F);},[c,N,o,r]),ae=useCallback(()=>{I(false),T(false),O(false),te(null),A(false),L(""),X$1(false);},[]),xe=useCallback((F,Te)=>{if(!w)return;let Z={...w,[F]:Te};G(Z);},[w,G]),Oe=useCallback(F=>{Qe(F),ie.current&&clearTimeout(ie.current),ie.current=setTimeout(()=>{if(w){let Te={...w,description:F};G(Te);}},800);},[w,G]),ye=useCallback(F=>{lt(F),kt.current&&clearTimeout(kt.current),kt.current=setTimeout(()=>{if(w&&F.trim()){let Te={...w,name:F.trim()};G(Te);}},800);},[w,G]),it=useCallback(async()=>{if(!(!w||!yt.trim()||!C)){Ae(true);try{let F=Ud(yt,f);await C(w.id,yt.trim(),F.length>0?F:void 0),$("");}finally{Ae(false);}}},[w,yt,C,f]),Ue=useCallback(F=>{let Te=typeof F=="string"?new Date(F):F,ke=new Date().getTime()-Te.getTime(),Ce=Math.floor(ke/6e4),$e=Math.floor(ke/36e5),Be=Math.floor(ke/864e5);return Ce<1?n==="es"?"Ahora":"Just now":Ce<60?n==="es"?`Hace ${Ce} min`:`${Ce}m ago`:$e<24?n==="es"?`Hace ${$e}h`:`${$e}h ago`:Be<7?n==="es"?`Hace ${Be}d`:`${Be}d ago`:Te.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),wt=useCallback(F=>{if(!w)return;let Te=w.progress||0;F==="completed"?Te=100:F==="in-progress"&&Te===0?Te=10:F==="todo"&&(Te=0);let Z={...w,status:F,progress:Te};G(Z),I(false);},[w,G]),ut=useCallback((F,Te)=>{if(!w)return;let Z={...w,startDate:F,endDate:Te};G(Z);},[w,G]),Bt=useCallback(()=>{let F=ne.getFullYear(),Te=ne.getMonth(),Z=new Date(F,Te,1),Ce=new Date(F,Te+1,0).getDate(),$e=Z.getDay(),Be=[],st=new Date(F,Te,0).getDate();for(let Y=$e-1;Y>=0;Y--)Be.push({date:new Date(F,Te-1,st-Y),isCurrentMonth:false});for(let Y=1;Y<=Ce;Y++)Be.push({date:new Date(F,Te,Y),isCurrentMonth:true});let U=42-Be.length;for(let Y=1;Y<=U;Y++)Be.push({date:new Date(F,Te+1,Y),isCurrentMonth:false});return Be},[ne]),jt=useCallback(async F=>{if(F.preventDefault(),F.stopPropagation(),ve(false),!w||!l)return;let Te=Array.from(F.dataTransfer.files);if(Te.length!==0){Ie(true);try{await l(w.id,Te);}finally{Ie(false);}}},[w,l]),Se=useCallback(async F=>{if(!w||!l||!F.target.files)return;let Te=Array.from(F.target.files);if(Te.length!==0){Ie(true);try{await l(w.id,Te);}finally{Ie(false);}F.target.value="";}},[w,l]),Ve=useCallback(F=>{F.preventDefault(),F.stopPropagation(),ve(true);},[]),ua=useCallback(F=>{F.preventDefault(),F.stopPropagation(),ve(false);},[]),Ze=useCallback(F=>F<1024?`${F} B`:F<1024*1024?`${(F/1024).toFixed(1)} KB`:`${(F/(1024*1024)).toFixed(1)} MB`,[]),Ke=useCallback(F=>F.startsWith("image/")?Image:F.includes("pdf")||F.includes("document")?FileText:File,[]);return !t||!w?null:jsx(AnimatePresence,{children:t&&w&&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:d("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",u?"bg-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxs("div",{className:d("px-6 py-3 border-b flex items-center gap-3",u?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Circle,{className:d("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-500")}),jsxs("span",{className:d("text-xs px-2 py-0.5 rounded",u?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsx("span",{className:d("text-xs font-mono",u?"text-[#6B7280]":"text-gray-400"),children:w.id.slice(0,8)}),jsxs("button",{className:d("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",u?"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:d("p-1.5 rounded transition-colors",u?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(Maximize2,{className:"w-4 h-4"})}),jsx("button",{className:d("p-1.5 rounded transition-colors",u?"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:d("p-1.5 rounded transition-colors",u?"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 F=w.progress===100?0:100,Z={...w,progress:F,status:F===100?"completed":"todo"};G(Z);},className:d("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",w.progress===100?"bg-green-500 border-green-500":u?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:w.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("input",{type:"text",value:Xe,onChange:F=>ye(F.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:d("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",w.progress===100?"line-through text-[#6B7280]":u?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400")})]})}),jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CheckCircle2,{className:d("w-4 h-4",u?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:d("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsx("button",{onClick:()=>{ae(),I(!y);},className:d("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",w.progress===100||w.status==="completed"?"bg-green-500/20 text-green-400":w.progress&&w.progress>0||w.status==="in-progress"?"bg-blue-500/20 text-blue-400":u?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:w.progress===100||w.status==="completed"?n==="es"?"COMPLETADO":"DONE":w.progress&&w.progress>0||w.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsx(AnimatePresence,{children:y&&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:d("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",u?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500"}].map(F=>jsxs("button",{onClick:()=>wt(F.id),className:d("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",u?"hover:bg-white/5":"hover:bg-gray-50",w.status===F.id&&(u?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:d("w-2 h-2 rounded-full",F.color)}),jsx("span",{className:u?"text-white":"text-gray-900",children:F.label})]},F.id))})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(User,{className:d("w-4 h-4",u?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:d("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxs("button",{onClick:()=>{ae(),O(!W);},className:d("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",u?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[w.assignees&&w.assignees.length>0?jsxs("div",{className:"flex items-center gap-1",children:[w.assignees.slice(0,3).map((F,Te)=>jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:F.color||"#8B5CF6"},title:F.name,children:F.initials||F.name.slice(0,2).toUpperCase()},Te)),w.assignees.length>3&&jsxs("span",{className:d("text-xs",u?"text-[#6B7280]":"text-gray-400"),children:["+",w.assignees.length-3]})]}):jsx("span",{className:d("text-sm",u?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsx(ChevronDown,{className:d("w-3 h-3",u?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:W&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>O(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:d("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",u?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:m.length>0?m.map(F=>{let Te=w.assignees?.some(Z=>Z.name===F.name);return jsxs("button",{onClick:()=>{let Z=w.assignees||[],ke;Te?ke=Z.filter(Ce=>Ce.name!==F.name):ke=[...Z,F],xe("assignees",ke);},className:d("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",u?"hover:bg-white/5":"hover:bg-gray-50",Te&&(u?"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:F.color||"#8B5CF6"},children:F.initials||F.name.slice(0,2).toUpperCase()}),jsx("span",{className:d("flex-1",u?"text-white":"text-gray-900"),children:F.name}),Te&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},F.name)}):jsx("div",{className:d("px-3 py-4 text-sm text-center",u?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CalendarDays,{className:d("w-4 h-4",u?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:d("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxs("button",{onClick:()=>{te(q?null:"start"),oe(w.startDate||new Date);},className:d("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",u?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[w.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsx("span",{className:d("mx-1",u?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),w.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsx(AnimatePresence,{children:q&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>te(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:d("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",u?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:F=>F.stopPropagation(),children:[jsxs("div",{className:d("w-44 py-2 border-r",u?"border-white/10":"border-gray-200"),children:[(()=>{let F=new Date,Te=new Date(F);Te.setDate(F.getDate()+1);let Z=new Date(F);Z.setDate(F.getDate()+((6-F.getDay()+7)%7||7));let ke=new Date(F);ke.setDate(F.getDate()+((1-F.getDay()+7)%7||7));let Ce=new Date(F);Ce.setDate(F.getDate()+(6-F.getDay()+7)%7+7);let $e=new Date(F);$e.setDate(F.getDate()+14);let Be=new Date(F);return Be.setDate(F.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:F,display:F.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:Te,display:Te.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:Z,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:ke,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:Ce,display:Ce.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:$e,display:$e.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Be,display:Be.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((U,Y)=>jsxs("button",{className:d("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",u?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(q==="start"){let pe=w.endDate&&U.date>w.endDate?U.date:w.endDate;ut(U.date,pe),te("end");}else {let pe=w.startDate&&U.date<w.startDate?U.date:w.startDate;ut(pe,U.date),te(null);}},children:[jsx("span",{children:U.label}),jsx("span",{className:d("text-xs",u?"text-[#6B7280]":"text-gray-400"),children:U.display})]},Y))})(),jsx("div",{className:d("border-t mt-2 pt-2",u?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{ut(void 0,void 0),te(null);},className:d("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",u?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:n==="es"?"Quitar fechas":"Clear dates"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[jsx("div",{className:d("text-xs mb-3 px-2 py-1 rounded",u?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:q==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("span",{className:d("font-medium",u?"text-white":"text-gray-900"),children:ne.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>oe(new Date),className:d("p-1 rounded text-sm transition-colors",u?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>oe(new Date(ne.getFullYear(),ne.getMonth()-1)),className:d("p-1 rounded",u?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),jsx("button",{onClick:()=>oe(new Date(ne.getFullYear(),ne.getMonth()+1)),className:d("p-1 rounded",u?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(F=>jsx("div",{className:d("w-8 h-8 flex items-center justify-center text-xs",u?"text-[#6B7280]":"text-gray-400"),children:F},F))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:Bt().map((F,Te)=>{let Z=F.date.toDateString()===new Date().toDateString(),ke=w.startDate?.toDateString()===F.date.toDateString(),Ce=w.endDate?.toDateString()===F.date.toDateString(),$e=ke||Ce,Be=w.startDate&&w.endDate&&F.date>=w.startDate&&F.date<=w.endDate;return jsx("button",{onClick:()=>{let st=new Date(F.date);if(q==="start"){let U=w.endDate&&st>w.endDate?st:w.endDate;ut(st,U),te("end");}else {let U=w.startDate&&st<w.startDate?st:w.startDate;ut(U,st),te(null);}},className:d("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!F.isCurrentMonth&&(u?"text-[#4B5563]":"text-gray-300"),F.isCurrentMonth&&(u?"text-white":"text-gray-900"),Z&&"ring-2 ring-[#3B82F6]",ke&&"bg-[#3B82F6] text-white",Ce&&!ke&&"bg-[#7C3AED] text-white",Be&&!$e&&(u?"bg-[#7C3AED]/20":"bg-purple-100"),!$e&&(u?"hover:bg-white/10":"hover:bg-gray-100")),children:F.date.getDate()},Te)})})]})]})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Flag,{className:d("w-4 h-4",u?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:d("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsx("button",{onClick:()=>{ae(),T(!P);},className:d("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",w.priority==="high"||w.priority==="urgent"?"bg-red-500/20 text-red-400":w.priority==="medium"?"bg-yellow-500/20 text-yellow-400":w.priority==="low"?"bg-green-500/20 text-green-400":u?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:w.priority?w.priority==="high"||w.priority==="urgent"?n==="es"?"Alta":"High":w.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsx(AnimatePresence,{children:P&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>T(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:d("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",u?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(F=>jsxs("button",{onClick:()=>{xe("priority",F.id),T(false);},className:d("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",u?"hover:bg-white/5":"hover:bg-gray-50",w.priority===F.id&&(u?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:d("w-2 h-2 rounded-full",F.color)}),jsx("span",{className:u?"text-white":"text-gray-900",children:F.label})]},F.id||"none"))})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:d("w-4 h-4",u?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:d("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsx("span",{className:d("text-sm",u?"text-white":"text-gray-900"),children:w.startDate&&w.endDate?`${Math.ceil((w.endDate.getTime()-w.startDate.getTime())/(1e3*60*60*24))} ${n==="es"?"d\xEDas":"days"}`:n==="es"?"Sin definir":"Not set"})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:d("w-4 h-4 rounded-full border-2",u?"border-[#6B7280]":"border-gray-400")}),jsx("span",{className:d("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[ce?jsx("input",{type:"range",min:"0",max:"100",step:"5",value:w.progress||0,onChange:F=>{let Te=parseInt(F.target.value),Z=w.status;Te===100?Z="completed":Te>0?Z="in-progress":Z="todo";let ke={...w,progress:Te,status:Z};G(ke);},onBlur:()=>be(false),className:d("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",u?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsx("button",{onClick:()=>be(true),className:d("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",u?"bg-white/10":"bg-gray-200"),children:jsx("div",{className:d("h-full rounded-full transition-all",w.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${w.progress||0}%`}})}),jsxs("span",{className:d("text-sm font-medium min-w-[40px]",u?"text-white":"text-gray-900"),children:[w.progress||0,"%"]})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Tag,{className:d("w-4 h-4",u?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:d("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsx(br,{selectedTags:w.tags||[],availableTags:g,onChange:F=>{xe("tags",F);},onCreateTag:i,theme:x})]}),jsxs("div",{className:"flex items-start gap-3 relative",children:[jsx(Link2,{className:d("w-4 h-4 mt-1.5",u?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:d("text-sm w-24 mt-1",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxs("div",{className:"flex-1",children:[w.dependencies&&w.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:w.dependencies.map(F=>{let Te=v.find(Z=>Z.id===F);return jsxs("span",{className:d("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",u?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[Te?.name||F.slice(0,8),jsx("button",{onClick:()=>{let Z=(w.dependencies||[]).filter(ke=>ke!==F);xe("dependencies",Z);},className:d("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsx(X,{className:"w-3 h-3"})})]},F)})}),jsxs("button",{onClick:()=>{ae(),A(!Le);},className:d("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",u?"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:d("text-sm",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsx(AnimatePresence,{children:Le&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{A(false),L("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:d("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",u?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsx("div",{className:d("p-2 border-b",u?"border-white/10":"border-gray-200"),children:jsx("input",{type:"text",value:R,onChange:F=>L(F.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:d("w-full px-3 py-2 rounded-md text-sm outline-none",u?"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:v.length>0?v.filter(F=>F.id!==w.id).filter(F=>R===""||F.name.toLowerCase().includes(R.toLowerCase())).map(F=>{let Te=w.dependencies?.includes(F.id);return jsxs("button",{onClick:()=>{let Z=w.dependencies||[],ke;Te?ke=Z.filter(Ce=>Ce!==F.id):ke=[...Z,F.id],xe("dependencies",ke);},className:d("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",u?"hover:bg-white/5":"hover:bg-gray-50",Te&&(u?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:d("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",Te?"bg-blue-500 border-blue-500":u?"border-white/30":"border-gray-300"),children:Te&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:d("block truncate",u?"text-white":"text-gray-900"),children:F.name}),jsx("span",{className:d("text-xs",u?"text-[#6B7280]":"text-gray-400"),children:F.id.slice(0,8)})]})]},F.id)}):jsx("div",{className:d("px-3 py-4 text-sm text-center",u?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Palette,{className:d("w-4 h-4",u?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:d("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxs("button",{onClick:()=>{ae(),X$1(!j);},className:d("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",u?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:w.color||"#6366F1"}}),jsx("span",{className:d("text-sm",u?"text-white":"text-gray-900"),children:hr.find(F=>F.value===w.color)?.name||(n==="es"?"Azul":"Blue")}),jsx(ChevronDown,{className:d("w-3 h-3",u?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:j&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>X$1(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:d("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",u?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-6 gap-1.5",children:hr.map(F=>{let Te=w.color===F.value;return jsx("button",{onClick:()=>{xe("color",F.value),X$1(false);},className:d("w-7 h-7 rounded-full flex items-center justify-center transition-all",Te&&"ring-2 ring-offset-2",u?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:F.value,outlineColor:Te?F.value:void 0},title:F.name,children:Te&&jsx(Check,{className:"w-3.5 h-3.5 text-white"})},F.value)})})})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Diamond,{className:d("w-4 h-4",u?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:d("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Hito":"Milestone"}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",checked:w.isMilestone||false,onChange:F=>xe("isMilestone",F.target.checked),className:d("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",w.isMilestone?"bg-purple-500 border-purple-500":u?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsx("span",{className:d("text-sm",u?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxs("div",{className:d("mt-6 pt-4 border-t",u?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsx(FileText,{className:d("w-4 h-4",u?"text-[#6B7280]":"text-gray-400")}),jsx("h3",{className:d("text-sm font-semibold",u?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsx("textarea",{value:qe,onChange:F=>Oe(F.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:d("w-full min-h-[100px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors",u?"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:d("flex items-center gap-2 text-sm mt-2 transition-colors",u?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsx(Sparkles,{className:"w-4 h-4"}),n==="es"?"Escribe con IA":"Write with AI"]})]}),jsxs("div",{className:d("mt-6 pt-4 border-t",u?"border-white/10":"border-gray-200"),children:[jsx("h3",{className:d("text-sm font-semibold mb-3",u?"text-white":"text-gray-900"),children:n==="es"?"Campos personalizados":"Custom fields"}),jsxs("button",{className:d("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",u?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsx(Plus,{className:"w-4 h-4"}),n==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxs("div",{className:d("mt-6 pt-4 border-t",u?"border-white/10":"border-gray-200"),children:[jsx("h3",{className:d("text-sm font-semibold mb-3",u?"text-white":"text-gray-900"),children:n==="es"?"Subtareas":"Subtasks"}),w.subtasks&&w.subtasks.length>0&&jsx("div",{className:"space-y-2 mb-3",children:w.subtasks.map(F=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:d("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",F.progress===100?"bg-green-500 border-green-500":u?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:F.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("span",{className:d("text-sm",F.progress===100?"line-through text-[#6B7280]":u?"text-white":"text-gray-900"),children:F.name})]},F.id))}),jsxs("button",{className:d("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",u?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsx(Plus,{className:"w-4 h-4"}),n==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxs("div",{className:d("mt-6 pt-4 border-t",u?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("h3",{className:d("text-sm font-semibold",u?"text-white":"text-gray-900"),children:n==="es"?"Listas de control":"Checklists"}),jsx("button",{className:d("p-1 rounded transition-colors",u?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(Plus,{className:"w-4 h-4"})})]}),jsxs("button",{className:d("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",u?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsx(ListChecks,{className:"w-4 h-4"}),n==="es"?"Crear lista de control":"Create checklist"]})]}),jsxs("div",{className:d("mt-6 pt-4 border-t",u?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:d("text-sm font-semibold mb-3",u?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",p.length>0&&jsxs("span",{className:d("ml-2 text-xs font-normal",u?"text-[#6B7280]":"text-gray-400"),children:["(",p.length,")"]})]}),p.length>0&&jsx("div",{className:"space-y-2 mb-4",children:p.map(F=>{let Te=Ke(F.type),Z=F.type.startsWith("image/");return jsxs("div",{className:d("flex items-center gap-3 p-2 rounded-lg group transition-colors",u?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[Z&&F.thumbnailUrl?jsx("img",{src:F.thumbnailUrl,alt:F.name,className:"w-10 h-10 rounded object-cover"}):jsx("div",{className:d("w-10 h-10 rounded flex items-center justify-center",u?"bg-white/10":"bg-gray-200"),children:jsx(Te,{className:d("w-5 h-5",u?"text-[#9CA3AF]":"text-gray-500")})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("a",{href:F.url,target:"_blank",rel:"noopener noreferrer",className:d("text-sm font-medium truncate block hover:underline",u?"text-white":"text-gray-900"),children:F.name}),jsx("p",{className:d("text-xs",u?"text-[#6B7280]":"text-gray-400"),children:Ze(F.size)})]}),b&&jsx("button",{onClick:()=>b(F.id),className:d("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",u?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:n==="es"?"Eliminar":"Delete",children:jsx(Trash2,{className:"w-4 h-4"})})]},F.id)})}),jsxs("div",{onDragOver:Ve,onDragLeave:ua,onDrop:jt,className:d("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",z?u?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":u?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",se&&"pointer-events-none opacity-50"),children:[jsx("input",{type:"file",multiple:true,onChange:Se,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!l||se}),se?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:d("text-sm",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxs(Fragment,{children:[jsx(Upload,{className:d("w-6 h-6 mx-auto mb-2",z?"text-blue-500":u?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:d("text-sm",u?"text-[#9CA3AF]":"text-gray-500"),children:z?n==="es"?"Suelta los archivos aqu\xED":"Drop files here":n==="es"?jsxs(Fragment,{children:["Suelta tus archivos aqu\xED o ",jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxs(Fragment,{children:["Drop your files here or ",jsx("span",{className:"underline",children:"click to upload"})]})}),!l&&jsx("p",{className:d("text-xs mt-1",u?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxs("div",{className:d("w-80 border-l flex flex-col",u?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsx("div",{className:d("px-4 py-3 border-b",u?"border-white/10":"border-gray-200"),children:jsxs("h3",{className:d("text-sm font-semibold",u?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",k.length>0&&jsxs("span",{className:d("ml-2 text-xs font-normal",u?"text-[#6B7280]":"text-gray-400"),children:["(",k.length,")"]})]})}),jsx("div",{className:"flex-1 overflow-y-auto p-4",children:k.length>0?jsx("div",{className:"space-y-4",children:k.map(F=>jsxs("div",{className:"flex gap-3",children:[jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:F.user?.color||"#8B5CF6"},children:F.user?.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsx("span",{className:d("text-sm font-medium",u?"text-white":"text-gray-900"),children:F.user?.name||(n==="es"?"Usuario":"User")}),jsx("span",{className:d("text-xs",u?"text-[#6B7280]":"text-gray-400"),children:Ue(F.createdAt)})]}),jsx("div",{className:d("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:jsx(Hd,{content:F.content,theme:s})})]})]},F.id))}):jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsx(MessageSquare,{className:d("w-10 h-10 mb-3",u?"text-[#3B4252]":"text-gray-300")}),jsx("p",{className:d("text-sm",u?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsx("div",{className:d("p-4 border-t",u?"border-white/10":"border-gray-200"),children:jsx(zd,{value:yt,onChange:$,onSubmit:it,users:f,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!C,isSubmitting:fe,theme:s,locale:n,currentUser:h})})]})]})]})})}function Ys(){let[e,t]=useState(()=>dragStore.getState());useEffect(()=>dragStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{dragStore.setState(r);},[]);return [e,a]}function Ur({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:m,isLoading:g,error:i,children:p,availableTags:l=[],onCreateTag:b,attachmentsByCard:v,onUploadAttachments:k,onDeleteAttachment:C,comments:h,onAddComment:f,currentUser:u,mentionableUsers:x,onTaskOpen:c}){let[N,w]=Ys(),[B,y]=useState(null),I=o?.theme||"dark",P=I==="dark"||I==="neutral",T=P?"dark":"",W=useCallback((j,X)=>{t.onCardUpdate?.(j,X);},[t]),O=useCallback((j,X)=>{t.onColumnUpdate?.(j,{title:X});},[t]),q=useCallback(j=>{t.onColumnDelete?.(j);},[t]),te=["todo","in-progress","completed"],ne=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),oe=useMemo(()=>{let j=new Map;return e.columns.forEach(X=>{let z=X.cardIds.map(ve=>e.cards.find(se=>se.id===ve)).filter(ve=>ve!==void 0).sort((ve,se)=>ve.position-se.position);j.set(X.id,z);}),j},[e.cards,e.columns]),ce=useMemo(()=>e.cards.map(j=>({id:j.id,name:j.title,startDate:j.startDate?new Date(j.startDate):void 0,endDate:j.endDate?new Date(j.endDate):void 0,progress:j.progress||0,status:j.columnId,priority:j.priority?.toLowerCase(),dependencies:Array.isArray(j.dependencies)?j.dependencies.map(X=>typeof X=="string"?X:X.taskId):[]})),[e.cards]),be=useCallback(j=>{let{active:X}=j,z=e.cards.find(ve=>ve.id===X.id);z&&w({isDragging:true,draggedCardId:z.id,sourceColumnId:z.columnId,targetColumnId:z.columnId});},[e.cards,w]),Le=useCallback(j=>{let{active:X,over:z}=j;if(!z||!e.cards.find(Ie=>Ie.id===X.id))return;let se=null;z.data.current?.type==="column"?se=z.id:z.data.current?.type==="card"&&(se=e.cards.find(qe=>qe.id===z.id)?.columnId||null),se&&se!==N.targetColumnId&&w({...N,targetColumnId:se});},[e.cards,N,w]),A=useCallback(async j=>{let{active:X,over:z}=j;if(w({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!z)return;let ve=e.cards.find(Qe=>Qe.id===X.id);if(!ve)return;let se,Ie;if(z.data.current?.type==="column"){se=z.id;let Qe=oe.get(se)||[];Ie=Fs(Qe,0);}else {let Qe=e.cards.find(lt=>lt.id===z.id);if(!Qe)return;se=Qe.columnId;let ie=oe.get(se)||[],Xe=ie.findIndex(lt=>lt.id===z.id);Ie=Fs(ie,Xe);}let qe=e.columns.find(Qe=>Qe.id===se);if(qe&&qe.wipLimit&&qe.wipLimitType==="hard"){let Qe=oe.get(se)||[];if(ve.columnId!==se&&Qe.length>=qe.wipLimit){t.onWipLimitExceeded?.(qe,ve);return}}(ve.columnId!==se||ve.position!==Ie)&&await t.onCardMove?.(ve.id,se,Ie);},[e.cards,e.columns,oe,t,w]),R=useCallback(j=>{y(j),a?.(j),c?.(j.id);},[a,c]),L=useCallback(j=>{t.onCardUpdate?.(j.id,j),y(j);},[t]);return g?jsx("div",{className:d("asakaa-board",T,n),style:m,children:jsx(Yg,{columnCount:3})}):i?jsx("div",{className:d("asakaa-board",T,n),style:m,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(bd,{themeName:I,children:[jsxs(DndContext,{sensors:ne,collisionDetection:closestCorners,onDragStart:be,onDragOver:Le,onDragEnd:A,children:[jsxs("div",{className:d("asakaa-board",T,n),style:m,"data-theme":I,children:[e.columns.sort((j,X)=>j.position-X.position).map(j=>{let X=oe.get(j.id)||[],z=!te.includes(j.id);return jsx(To,{column:j,cards:X,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:R,onCardUpdate:W,onColumnRename:O,onColumnDelete:q,isDeletable:z,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},j.id)}),p]}),jsx(DragOverlay,{children:N.draggedCardId?jsx(Dr,{card:e.cards.find(j=>j.id===N.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),jsx(no,{task:B,isOpen:!!B,onClose:()=>y(null),onCardUpdate:L,theme:P?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:l,onCreateTag:b,attachments:B?v?.get(B.id)||[]:[],onUploadAttachments:k,onDeleteAttachment:C,availableTasks:ce,comments:h,onAddComment:f,currentUser:u,mentionableUsers:x})]})}function Yg({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 Qg={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)"},ef={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)"},tf={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},af={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function rf({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=useState(false),m=useRef(null);useEffect(()=>{let i=p=>{m.current&&!m.current.contains(p.target)&&n(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let g=i=>{t(i),n(false);};return jsxs("div",{ref:m,className:"relative",children:[jsxs(motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:o||r.newTask}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((i,p)=>i.position-p.position).map((i,p)=>jsxs(motion.button,{onClick:()=>g(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:p<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:p*.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 of({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=useState(false),[m,g]=useState(null),i=useRef(null);if(useEffect(()=>{let v=k=>{i.current&&!i.current.contains(k.target)&&n(false);};return s&&document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[s]),!(a||r||o))return null;let l=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(v=>v.handler),b=async(v,k)=>{if(k){g(v);try{await k();}catch(C){console.error(`Export ${v} failed:`,C);}finally{g(null),n(false);}}};return jsxs("div",{ref:i,className:"relative",children:[jsxs(motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:t.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsx("div",{className:"py-1",children:l.map((v,k)=>jsxs(motion.button,{onClick:()=>b(v.id,v.handler),disabled:m!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:k<l.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:k*.03},children:[jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:m===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 nf({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 Xs({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:m,onExportExcel:g,translations:i}){let p=r==="dark"?Qg:ef,l={...o==="es"?tf:af,...i},b=n||m||g;return jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:p.bgGrid,borderColor:p.border},children:jsxs("div",{className:"flex items-center gap-3",children:[b&&jsxs(Fragment,{children:[jsx(of,{theme:p,t:l,onExportCSV:n,onExportJSON:m,onExportExcel:g}),t&&jsx("div",{className:"w-px h-6",style:{backgroundColor:p.borderLight}})]}),t&&(s?jsx(rf,{columns:e,onSelect:t,theme:p,t:l,createTaskLabel:a}):jsx(nf,{onClick:()=>t(),label:a||l.newTask}))]})})}function Zs({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=useState(false),[m,g]=useState(""),i=useCallback(()=>{let b=m.trim();b&&(e(b),g(""),n(false));},[m,e]),p=useCallback(b=>{b.key==="Enter"?(b.preventDefault(),i()):b.key==="Escape"&&(g(""),n(false));},[i]),l=useCallback(()=>{setTimeout(()=>{m.trim()||n(false);},150);},[m]);return s?jsx("div",{className:d("asakaa-add-column asakaa-add-column--editing",t),children:jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsx("input",{type:"text",value:m,onChange:b=>g(b.target.value),onKeyDown:p,onBlur:l,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxs("div",{className:"asakaa-add-column__actions",children:[jsx("button",{onClick:i,disabled:!m.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:()=>{g(""),n(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsx("div",{className:d("asakaa-add-column",t),children:jsxs("button",{onClick:()=>n(true),disabled:o,className:"asakaa-add-column__button",type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),r]})})}function Qs({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:s,disabled:n=false,theme:m="dark",locale:g="es"}){let[i,p]=useState(false),[l,b]=useState(false),[v,k]=useState(""),[C,h]=useState([]),[f,u]=useState(""),[x,c]=useState(""),[N,w]=useState(""),[B,y]=useState(false),[I,P]=useState(false),[T,W]=useState(false),O=useRef(null),q=useRef(null),te={placeholder:o||(g==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:s||(g==="es"?"Agregar Tarea":"Add Task"),save:g==="es"?"Guardar":"Save",addAssignee:g==="es"?"Agregar asignado":"Add assignee",addDates:g==="es"?"Agregar fechas":"Add dates",addPriority:g==="es"?"Agregar prioridad":"Add priority",startDate:g==="es"?"Inicio":"Start",endDate:g==="es"?"Fin":"End",low:g==="es"?"Baja":"Low",medium:g==="es"?"Media":"Medium",high:g==="es"?"Alta":"High",urgent:g==="es"?"Urgente":"Urgent"},ne=useCallback(()=>{k(""),h([]),u(""),c(""),w(""),y(false),P(false),W(false),p(false);},[]);useEffect(()=>{i&&O.current&&O.current.focus();},[i]),useEffect(()=>{if(!i)return;let A=R=>{q.current&&!q.current.contains(R.target)&&(v.trim()||ne());};return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[i,v,ne]);let oe=useCallback(async()=>{let A=v.trim();if(!(!A||l)){b(true);try{await t({name:A,columnId:e,assigneeIds:C.length>0?C:void 0,startDate:f?new Date(f):void 0,endDate:x?new Date(x):void 0,priority:N||void 0}),k(""),h([]),u(""),c(""),w(""),y(!1),P(!1),W(!1),O.current?.focus();}catch(R){console.error("Error creating card:",R);}finally{b(false);}}},[v,e,C,f,x,N,t,l]),ce=useCallback(A=>{A.key==="Enter"&&!A.shiftKey?(A.preventDefault(),oe()):A.key==="Escape"&&ne();},[oe,ne]),be=useCallback(A=>{h(R=>R.includes(A)?R.filter(L=>L!==A):[...R,A]);},[]),Le=m==="dark";return i?jsxs("div",{ref:q,className:d("rounded-lg overflow-hidden shadow-lg",Le?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxs("div",{className:"p-3",children:[jsx("input",{ref:O,type:"text",value:v,onChange:A=>k(A.target.value),onKeyDown:ce,placeholder:te.placeholder,disabled:l,className:d("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",Le?"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:()=>y(!B),className:d("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",B||C.length>0?"bg-emerald-500/20 text-emerald-400":Le?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:te.addAssignee,children:[jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),C.length>0&&jsx("span",{className:"ml-0.5",children:C.length})]}),jsx("button",{onClick:()=>P(!I),className:d("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",I||f||x?"bg-blue-500/20 text-blue-400":Le?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:te.addDates,children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]})}),jsx("button",{onClick:()=>W(!T),className:d("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",T||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":Le?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:te.addPriority,children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"}),jsx("line",{x1:"4",y1:"22",x2:"4",y2:"15"})]})}),jsx("div",{className:"flex-1"}),jsx("button",{onClick:oe,disabled:!v.trim()||l,className:d("px-3 py-1.5 rounded-md text-xs font-medium text-white transition-all","bg-emerald-500 hover:bg-emerald-600","disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-emerald-500"),type:"button",children:l?jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}):te.save})]})]}),B&&a.length>0&&jsx("div",{className:d("px-3 pb-3 pt-0","border-t",Le?"border-[#3a3a4e]":"border-gray-200"),children:jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(A=>jsxs("button",{onClick:()=>be(A.id),className:d("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",C.includes(A.id)?"bg-emerald-500 text-white":Le?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[A.avatar?jsx("img",{src:A.avatar,alt:A.name,className:"w-4 h-4 rounded-full"}):jsx("div",{className:d("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",C.includes(A.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:A.name.charAt(0).toUpperCase()}),jsx("span",{children:A.name.split(" ")[0]})]},A.id))})}),I&&jsx("div",{className:d("px-3 pb-3 pt-0","border-t",Le?"border-[#3a3a4e]":"border-gray-200"),children:jsxs("div",{className:"grid grid-cols-2 gap-2 pt-3",children:[jsxs("div",{children:[jsx("label",{className:d("block text-[10px] uppercase tracking-wide mb-1",Le?"text-gray-500":"text-gray-400"),children:te.startDate}),jsx("input",{type:"date",value:f,onChange:A=>u(A.target.value),className:d("w-full px-2 py-1.5 rounded text-xs border",Le?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxs("div",{children:[jsx("label",{className:d("block text-[10px] uppercase tracking-wide mb-1",Le?"text-gray-500":"text-gray-400"),children:te.endDate}),jsx("input",{type:"date",value:x,onChange:A=>c(A.target.value),className:d("w-full px-2 py-1.5 rounded text-xs border",Le?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),T&&jsx("div",{className:d("px-3 pb-3 pt-0","border-t",Le?"border-[#3a3a4e]":"border-gray-200"),children:jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(A=>jsx("button",{onClick:()=>w(N===A?"":A),className:d("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",N===A?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[A]} text-white`:Le?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:te[A]},A))})})]}):jsxs("button",{onClick:()=>p(true),disabled:n,className:d("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",Le?"hover:bg-[#2a2a3e]":"hover:bg-gray-100",n&&"opacity-50 cursor-not-allowed",r),type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),jsx("span",{className:"text-sm font-medium",children:te.buttonLabel})]})}var Yo=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(Ur,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let o=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,o?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(o=>`"${o}"`).join(",")).join(`
|
|
5
|
-
`)}async exportToPDF(){throw new Error("PDF export not yet implemented in ViewAdapter")}async exportToPNG(){if(!this.container)throw new Error("View not mounted");let r=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((o,s)=>{r.toBlob(n=>{n?o(n):s(new Error("Failed to create PNG blob"));},"image/png");})}};function sc(e={}){return new Yo(e)}var Do=class extends Component{constructor(a){super(a);this.resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(a){return {hasError:true,error:a}}componentDidCatch(a,r){let{onError:o,componentName:s}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${s||"Component"}:`,a),console.error("Error Info:",r)),this.setState({errorInfo:r}),o)try{o(a,r);}catch(n){console.error("Error in error handler:",n);}}render(){let{hasError:a,error:r}=this.state,{children:o,fallback:s,componentName:n}=this.props;return a&&r?s?s(r,this.resetError):jsx("div",{className:"p-6 rounded-lg border",style:{background:"linear-gradient(135deg, #2d1b1b 0%, #1a1a1a 100%)",borderColor:"rgba(239, 68, 68, 0.3)"},children:jsxs("div",{className:"flex items-start gap-3",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"flex-shrink-0",children:[jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#EF4444",strokeWidth:"2"}),jsx("path",{d:"M12 8V12",stroke:"#EF4444",strokeWidth:"2",strokeLinecap:"round"}),jsx("circle",{cx:"12",cy:"16",r:"1",fill:"#EF4444"})]}),jsxs("div",{className:"flex-1",children:[jsx("h3",{className:"text-lg font-semibold text-red-400 mb-1",children:n?`Error in ${n}`:"Something went wrong"}),jsx("p",{className:"text-sm text-white/70 mb-3",children:r.message||"An unexpected error occurred"}),process.env.NODE_ENV==="development"&&jsxs("details",{className:"mb-3",children:[jsx("summary",{className:"text-xs text-white/50 cursor-pointer hover:text-white/70 mb-2",children:"Error Details (Development Only)"}),jsx("pre",{className:"text-xs text-white/60 bg-black/30 p-3 rounded overflow-auto max-h-48",children:r.stack})]}),jsx("button",{onClick:this.resetError,className:"px-4 py-2 rounded-lg text-sm font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#EF4444"},children:"Try Again"})]})]})}):o}};function ei(e,t){let a=r=>jsx(Do,{...t,children:jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function ai({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:m,onOpenAIUsage:g,shortcut:i="k",className:p=""}){let[l,b]=useState(false),[v,k]=useState(""),[C,h]=useState("home"),[f,u]=useState(""),[x,c]=useState("");useEffect(()=>{let y=I=>{(I.metaKey||I.ctrlKey)&&I.key===i&&(I.preventDefault(),b(P=>!P)),I.key==="Escape"&&(b(false),h("home"),k(""));};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[i]),useEffect(()=>{l||(h("home"),k(""),u(""),c(""));},[l]);let N=useCallback(()=>{b(false);},[]),w=useCallback(y=>{let[I,P]=y.split(":");switch(I){case "create-card":h("create-card");break;case "create-card-in":u(P||"");break;case "navigate":P?(a?.(P),N()):h("navigate");break;case "search":r?.(v),N();break;case "priority":h("priority");break;case "set-priority":x&&P&&(o?.(x,P),N());break;case "assign":h("assign");break;case "assign-user":x&&P&&(s?.(x,P),N());break;case "ai":h("ai");break;case "ai-generate-plan":n?.(),N();break;case "ai-predict-risks":m?.(),N();break;case "ai-usage":g?.(),N();break;case "back":h("home");break;}},[v,x,t,a,r,o,s,n,m,g,N]),B=useCallback(()=>{f&&v.trim()&&(t?.(f,v.trim()),N());},[f,v,t,N]);return l?jsx(ft,{children:jsx("div",{className:"command-palette-overlay",onClick:N,children:jsx("div",{className:`command-palette ${p}`,onClick:y=>y.stopPropagation(),children:jsxs(Command,{value:v,onValueChange:k,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:C==="create-card"&&f?"Type card title and press Enter...":C==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:y=>{y.key==="Enter"&&C==="create-card"&&f&&B();}}),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."}),C==="home"&&jsxs(Fragment,{children:[jsxs(Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxs(Command.Item,{value:"create-card",onSelect:w,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:w,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:w,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:w,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(y=>jsxs(Command.Item,{value:`navigate:${y.id}`,onSelect:w,className:"command-palette-item",children:[jsx("div",{className:"command-palette-item-dot",style:{background:y.priority==="URGENT"?"#EF4444":y.priority==="HIGH"?"#F59E0B":y.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsx("span",{children:y.title}),y.labels&&y.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:y.labels.slice(0,2).map(I=>jsx("span",{className:"command-palette-item-label",children:I},I))})]},y.id))})]}),C==="create-card"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:w,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(y=>jsxs(Command.Item,{value:`create-card-in:${y.id}`,onSelect:w,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:y.title}),jsxs("div",{className:"command-palette-item-count",children:[y.cardIds.length," cards"]})]},y.id))})]}),C==="navigate"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:w,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(y=>{let I=e.columns.find(P=>P.id===y.columnId);return jsxs(Command.Item,{value:`navigate:${y.id}`,onSelect:w,className:"command-palette-item",keywords:[y.title,y.description||"",...y.labels||[]],children:[jsx("div",{className:"command-palette-item-dot",style:{background:y.priority==="URGENT"?"#EF4444":y.priority==="HIGH"?"#F59E0B":y.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxs("div",{className:"command-palette-item-content",children:[jsx("div",{children:y.title}),jsx("div",{className:"command-palette-item-meta",children:I?.title})]}),y.labels&&y.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:y.labels.slice(0,2).map(P=>jsx("span",{className:"command-palette-item-label",children:P},P))})]},y.id)})})]}),C==="ai"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:w,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:w,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:w,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:w,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 dc(e,t,a,r,o){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let n=document.createElement("div");n.id="attachment-lightbox-native",n.className="attachment-lightbox",n.style.cssText=`
|
|
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,useLayoutEffect,Component}from'react';import {useDroppable,useSensors,useSensor,PointerSensor,KeyboardSensor,DndContext,closestCorners,DragOverlay}from'@dnd-kit/core';import {useSortable,SortableContext,verticalListSortingStrategy,sortableKeyboardCoordinates}from'@dnd-kit/sortable';import {useVirtualizer}from'@tanstack/react-virtual';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {jsPDF}from'jspdf';import mm 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,CheckSquare,ChevronDown,Calendar,Hash,Type,Tag,BarChart,CalendarCheck,Users,Flag,CircleDot,Moon,Sun,Palette,ZoomOut,ZoomIn,Keyboard,ChevronRight,Image,FileText,File,Sparkles,Maximize2,MoreHorizontal,X,User,Check,CalendarDays,Clock,Diamond,ListChecks,Upload,MessageSquare,Rows3,Filter,FileImage,FileSpreadsheet,FileJson,FolderKanban,Download,ChevronLeft,GripVertical,Send,AlertCircle,Milestone,List,Search,Copy}from'lucide-react';import {Command}from'cmdk';import wf from'react-markdown';import Cf from'remark-gfm';import Tf from'rehype-sanitize';import {ResponsiveContainer,LineChart,CartesianGrid,XAxis,YAxis,Tooltip,Legend,Line,AreaChart,Area,PieChart,Pie,Cell,BarChart as BarChart$1,Bar}from'recharts';var xn=(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 kn=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 [kn.Translate.toString(e),kn.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function l(...e){return twMerge(clsx(e))}function wn(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 Mu(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function Is(e,t){return e.length===0?1e3:t===0?wn(null,e[0].position):t>=e.length?wn(e[e.length-1].position,null):wn(e[t-1].position,e[t].position)}function id(e,t=100){return e>t}var Au=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 Fu(e,t,a,r){let o=t*Math.pow(a,e-1),s=o*.2*Math.random();return Math.min(o+s,r)}async function Cn(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:n=Au,onRetry:c}=t,g,i=0;for(let p=1;p<=a;p++){i=p;try{return {data:await e(),attempts:i,success:!0}}catch(d){if(g=d,p===a||!n(g,p))return {error:g,attempts:i,success:false};let y=Fu(p,r,o,s);if(c)try{c(g,p,y);}catch(k){console.error("Error in retry callback:",k);}await new Promise(k=>setTimeout(k,y));}}return {error:g||new Error("Unknown error"),attempts:i,success:false}}function Lu(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 Iu(e,t={}){return async(...a)=>Cn(()=>e(...a),t)}var Bs=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 ld=(s=>(s[s.DEBUG=0]="DEBUG",s[s.INFO=1]="INFO",s[s.WARN=2]="WARN",s[s.ERROR=3]="ERROR",s[s.NONE=4]="NONE",s))(ld||{}),eo=class eo{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...n}=t,c=`[${a}] [${r}] [${s}]`,g=Object.keys(n).length>0;switch(r){case "DEBUG":console.debug(c,o,g?n:"");break;case "INFO":console.info(c,o,g?n:"");break;case "WARN":console.warn(c,o,g?n:"");break;case "ERROR":console.error(c,o,g?n:""),t.error?.stack&&console.error(t.error.stack);break}};let a=process.env.NODE_ENV==="development";this.options={minLevel:t.minLevel??(a?0:1),enabled:t.enabled??true,onLog:t.onLog??this.defaultLogHandler,enableTiming:t.enableTiming??true,componentName:t.componentName??"ASAKAA",...eo.globalOptions};}static configure(t){eo.globalOptions={...eo.globalOptions,...t};}child(t){return new eo({...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 Tn((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new Tn(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:ld[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};eo.globalOptions={};var Rs=eo,Tn=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}},dd=new Rs;function Ru(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 Ou(e,t){let a=["Card ID","Title","Description","Column","Priority","Labels","Assigned Users","Start Date","End Date","Created At","Updated At"],r=e.cards.map(s=>{let n=e.columns.find(c=>c.id===s.columnId);return [s.id,Os(s.title),Os(s.description||""),Os(n?.title||""),s.priority||"",(s.labels||[]).join(";"),(s.assignedUserIds||[]).join(";"),s.startDate||"",s.endDate||"",s.createdAt||"",s.updatedAt||""]});return [a.join(","),...r.map(s=>s.join(","))].join(`
|
|
2
|
+
`)}async function $u(e,t,a){let r=t;if(!r){let n=document.querySelector(".asakaa-board");n&&(r=n.parentElement||n);}if(r)try{let n=await mm(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),c=n.toDataURL("image/png"),g=297,i=210,p=n.width/n.height,d=g-20,f=d/p;f>i-20&&(f=i-20,d=f*p);let y=new jsPDF({orientation:"landscape",unit:"mm",format:"a4"});y.setFontSize(16),y.setTextColor(255,255,255),y.setFillColor(10,10,10),y.rect(0,0,g,15,"F"),y.text(e.title||"Kanban Board",10,10);let k=(g-d)/2;return y.addImage(c,"PNG",k,20,d,f),y}catch(n){console.error("Error capturing board:",n);}let o=new jsPDF,s=20;return o.setFontSize(20),o.text(e.title||"Kanban Board",20,s),s+=10,o.setFontSize(10),o.setTextColor(128,128,128),o.text(`Exported on ${new Date().toLocaleString()}`,20,s),s+=15,o.setTextColor(0,0,0),e.columns.forEach(n=>{let c=e.cards.filter(g=>g.columnId===n.id);s>250&&(o.addPage(),s=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(n.title,20,s),s+=8,c.length===0?(o.setFontSize(10),o.setFont("helvetica","italic"),o.setTextColor(128,128,128),o.text("No cards in this column",20,s),o.setTextColor(0,0,0),s+=10):c.forEach(g=>{if(s>260&&(o.addPage(),s=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(g.title,25,s),s+=6,g.description){o.setFontSize(9),o.setFont("helvetica","normal");let p=o.splitTextToSize(g.description,160);o.text(p,25,s),s+=p.length*5;}let i=[];if(g.priority&&i.push(`Priority: ${g.priority}`),g.labels&&g.labels.length>0&&i.push(`Labels: ${g.labels.join(", ")}`),g.assignedUserIds&&g.assignedUserIds.length>0&&i.push(`Assigned: ${g.assignedUserIds.length} user(s)`),g.startDate||g.endDate){let p=[];g.startDate&&p.push(`Start: ${g.startDate}`),g.endDate&&p.push(`End: ${g.endDate}`),i.push(p.join(" \u2192 "));}i.length>0&&(o.setFontSize(8),o.setTextColor(100,100,100),o.text(i.join(" \u2022 "),25,s),o.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),o}function Os(e){return e.includes(",")||e.includes('"')||e.includes(`
|
|
3
|
+
`)?`"${e.replace(/"/g,'""')}"`:e}async function md(e,t,a,r){switch(t){case "json":return Ru(e,r);case "csv":return Ou(e);case "pdf":return await $u(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function pd(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let p=`${r}.pdf`;e.save(p);return}if(typeof e!="string")throw new Error("Invalid content type for non-PDF export");let s=`${r}.${{json:"json",csv:"csv",pdf:"pdf"}[t]}`,n={json:"application/json",csv:"text/csv",pdf:"application/pdf"},c=new Blob([e],{type:n[t]}),g=URL.createObjectURL(c),i=document.createElement("a");i.href=g,i.download=s,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(g);}function Uu(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 zu(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=ud(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let c=ud(t[n]||"");if(c.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-c.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${c.length})`);continue}for(;c.length<a.length;)c.push("");let i={};a.forEach((y,k)=>{i[y]=c[k]||"";});let p=i.Column||"Unnamed";o.has(p)||o.set(p,{id:`col-${o.size+1}`,title:p,position:o.size+1,cardIds:[]});let d=o.get(p),f={id:i["Card ID"]||`card-${n}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:d.id,position:d.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};r.push(f),d.cardIds.push(f.id);}catch(c){s.push(`Line ${n+1}: ${c instanceof Error?c.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function ud(e){let t=[],a="",r=false;for(let o=0;o<e.length;o++){let s=e[o],n=e[o+1];s==='"'&&r&&n==='"'?(a+='"',o++):s==='"'?r=!r:s===","&&!r?(t.push(a),a=""):a+=s;}return t.push(a),t}function gd(e,t){switch(t){case "json":return Uu(e);case "csv":return zu(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function fd(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 $s=createContext(null);function bd(){return useContext($s)}var hd=createContext(null);function yd({children:e,themeName:t}){return jsx(hd.Provider,{value:{themeName:t},children:e})}function wo(){return useContext(hd)}function ht({children:e,container:t}){let[a,r]=useState(false),o=bd(),s=wo();if(useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let n=t||(typeof document<"u"?document.body:null);if(!n)return null;if(o){let{theme:c,themeName:g}=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":g,"data-gantt-portal":"true",style:i,children:e}),n)}return s?createPortal(jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),n):createPortal(e,n)}var Cd={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},Yu="#BDC3C7",qu=({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 to({priority:e,onChange:t,className:a}){let[r,o]=useState(false),[s,n]=useState({top:0,left:0}),c=useRef(null),g=useRef(null),i=()=>{if(!g.current)return;let y=g.current.getBoundingClientRect(),k=window.innerHeight,C=window.innerWidth,h=160,b=220,u=4,x=y.right-h;x<10&&(x=y.left),x+h>C-10&&(x=C-h-10);let m=k-y.bottom,N=y.top,w;m>=b+u?w=y.bottom+u:N>=b+u?w=y.top-b-u:w=m>=N?y.bottom+u:Math.max(10,y.top-b-u),n({top:w,left:x}),o(true);};useEffect(()=>{let y=k=>{c.current&&!c.current.contains(k.target)&&!g.current?.contains(k.target)&&o(false);};if(r)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[r]),useEffect(()=>{let y=k=>{k.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[r]);let p=y=>{t(y),o(false);},d=e?Cd[e]:null,f=d?.color||Yu;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:g,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?`${f}10`:"transparent",boxShadow:e?`0 0 0 2px ${f}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:f,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:f,fillOpacity:e?"0.6":"0.4"})})}),r&&jsx(ht,{children:jsxs("div",{ref:c,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxs("div",{className:"py-1",children:[Object.entries(Cd).map(([y,k])=>jsxs("button",{onClick:()=>p(y),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:k.color,background:"transparent"},onMouseEnter:C=>{C.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:C=>{C.currentTarget.style.background="transparent";},children:[jsx(qu,{color:k.color}),jsx("span",{className:"font-semibold text-sm",children:k.label}),e===y&&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"})})]},y)),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:()=>p(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:y=>{y.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:y=>{y.currentTarget.style.background="transparent";},children:[jsx("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 Xu=[{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 Wo({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=useState(false),[n,c]=useState({top:0,left:0}),g=useRef(null),i=useRef(null),f=(wo()?.themeName||"dark")==="dark",y=()=>{if(!i.current)return;let x=i.current.getBoundingClientRect(),m=window.innerHeight,N=window.innerWidth,w=320,B=380,v=4,I=x.left;I+w>N-10&&(I=N-w-10),I<10&&(I=10);let A=m-x.bottom,T=x.top,H;A>=B+v?H=x.bottom+v:T>=B+v?H=x.top-B-v:H=A>=T?x.bottom+v:Math.max(10,x.top-B-v),c({top:H,left:I}),s(true);};useEffect(()=>{let x=m=>{g.current&&!g.current.contains(m.target)&&!i.current?.contains(m.target)&&s(false);};if(o)return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[o]),useEffect(()=>{let x=m=>{m.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[o]);let k=x=>{let m=new Date,N=I=>{let A=I.getFullYear(),T=String(I.getMonth()+1).padStart(2,"0"),H=String(I.getDate()).padStart(2,"0");return `${A}-${T}-${H}`},w=N(m),B=new Date(m);B.setDate(B.getDate()+x);let v=N(B);a(w,v),s(false);},C=()=>{if(!e||!t)return "Set date";let x=B=>{if(B instanceof Date)return B;if(typeof B!="string"||!B.match(/^\d{4}-\d{2}-\d{2}$/))return null;let v=B.split("-").map(Number);if(v.length!==3||v.some(H=>isNaN(H)))return null;let I=v[0],A=v[1],T=v[2];return I===void 0||A===void 0||T===void 0?null:new Date(I,A-1,T)},m=x(e),N=x(t);if(!m||!N||isNaN(m.getTime())||isNaN(N.getTime()))return "Set date";let w=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${w[m.getMonth()]} ${m.getDate()} \u2013 ${w[N.getMonth()]} ${N.getDate()}`},h=e&&t,u=(()=>{if(!t)return false;let x=typeof t=="string"?new Date(t):t,m=new Date;return m.setHours(0,0,0,0),x<m})();return jsxs("div",{className:`relative ${r||""}`,children:[jsxs("button",{ref:i,onClick:()=>o?s(false):y(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${u?"asakaa-date-overdue":"asakaa-date"}`,title:h?`${C()}`:"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:C()})]}),o&&jsx(ht,{children:jsxs("div",{ref:g,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,background:f?"#1A1D25":"#FFFFFF",border:`1px solid ${f?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:f?"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:f?"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:f?"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:Xu.map(x=>jsx("button",{onClick:()=>k(x.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:f?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${f?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:f?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor=f?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",m.currentTarget.style.border=`1px solid ${f?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:m=>{m.currentTarget.style.backgroundColor=f?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",m.currentTarget.style.border=`1px solid ${f?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:x.label},x.label))})]}),jsxs("div",{className:"p-4",children:[jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:f?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Custom Range"}),jsxs("div",{className:"space-y-3",children:[jsx("input",{type:"date",value:e||"",onChange:x=>a(x.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:f?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:f?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:f?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:f?"dark":"light"}}),jsx("input",{type:"date",value:t||"",onChange:x=>a(e,x.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:f?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:f?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:f?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:f?"dark":"light"}})]}),(e||t)&&jsx("button",{onClick:()=>{a(void 0,void 0),s(false);},className:"mt-4 w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all active:scale-95 border",style:{color:"#ef4444",borderColor:"rgba(239, 68, 68, 0.3)",background:"rgba(239, 68, 68, 0.1)"},onMouseEnter:x=>{x.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:x=>{x.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function ro({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=useState(false),[c,g]=useState(""),[i,p]=useState({top:0,left:0}),d=useRef(null),f=useRef(null),y=()=>{if(!f.current)return;let u=f.current.getBoundingClientRect(),x=window.innerHeight,m=window.innerWidth,N=300,w=380,B=4,v=u.right-N;v<10&&(v=u.left),v+N>m-10&&(v=m-N-10);let I=x-u.bottom,A=u.top,T;I>=w+B?T=u.bottom+B:A>=w+B?T=u.top-w-B:T=I>=A?u.bottom+B:Math.max(10,u.top-w-B),p({top:T,left:v}),n(true);};useEffect(()=>{let u=x=>{d.current&&!d.current.contains(x.target)&&!f.current?.contains(x.target)&&(n(false),g(""));};if(s)return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[s]),useEffect(()=>{let u=x=>{x.key==="Escape"&&(n(false),g(""));};if(s)return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[s]);let k=u=>{let x=e.some(m=>m.id===u.id);a(x?e.filter(m=>m.id!==u.id):[...e,u]);},C=t.filter(u=>u.name.toLowerCase().includes(c.toLowerCase())),h=e.slice(0,o),b=e.length-o;return jsxs("div",{className:`relative ${r||""}`,children:[jsx("button",{ref:f,onClick:()=>s?n(false):y(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxs("div",{className:"asakaa-avatar-group",children:[h.map(u=>jsx("div",{className:"asakaa-avatar",title:u.name,children:u.avatar?jsx("img",{src:u.avatar,alt:u.name,className:"asakaa-avatar-img"}):u.initials},u.id)),b>0&&jsxs("div",{className:"asakaa-avatar",children:["+",b]})]}):jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center transition-all",style:{background:"rgba(96, 165, 250, 0.15)",border:"1.5px solid rgba(96, 165, 250, 0.4)",color:"#60a5fa"},children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M8 8a3 3 0 100-6 3 3 0 000 6zM4 14c0-2.21 1.79-4 4-4s4 1.79 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),s&&jsx(ht,{children:jsxs("div",{ref:d,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("input",{type:"text",value:c,onChange:u=>g(u.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:C.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"}):C.map(u=>{let x=e.some(m=>m.id===u.id);return jsxs("button",{onClick:()=>k(u),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:m=>{m.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:m=>{m.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:u.color,color:"#fff"},children:u.avatar?jsx("img",{src:u.avatar,alt:u.name,className:"w-full h-full rounded-full object-cover"}):u.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:u.name}),jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:x?"#3b82f6":"transparent"},children:x?"\u2713":""})]},u.id)})}),e.length>0&&jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsx("button",{onClick:()=>{a([]),n(false);},className:"w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all hover:bg-red-600/30 active:scale-95 border",style:{color:"#f87171",borderColor:"rgba(248, 113, 113, 0.3)",background:"rgba(248, 113, 113, 0.08)"},children:"Clear All"})})]})})]})}function Nn(e,t,a){let r=new Map;e.forEach(g=>{if(g.dependencies&&Array.isArray(g.dependencies)){let i=g.dependencies.map(p=>{if(typeof p=="string")return p;let d=p;return d.taskId||d.targetId||""}).filter(Boolean);r.set(g.id,i);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,c=g=>{if(!s.has(g)){s.add(g),n.add(g);let i=r.get(g)||[];for(let p of i){if(!s.has(p)&&c(p))return true;if(n.has(p))return true}}return n.delete(g),false};return c(a)}function _o({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[c,g]=useState(false),[i,p]=useState(""),[d,f]=useState(t.length>0),[y,k]=useState({top:0,left:0}),[C,h]=useState(null),b=useRef(null),u=useRef(null),x=()=>{if(!u.current)return;let v=u.current.getBoundingClientRect(),I=window.innerHeight,A=window.innerWidth,T=300,H=d?380:120,O=4,j=v.right-T;j<10&&(j=v.left),j+T>A-10&&(j=A-T-10);let ae=I-v.bottom,ne=v.top,re;ae>=H+O?re=v.bottom+O:ne>=H+O?re=v.top-H-O:re=ae>=ne?v.bottom+O:Math.max(10,v.top-H-O),k({top:re,left:j}),g(true);};useEffect(()=>{if(!c||!u.current)return;let v=u.current.getBoundingClientRect(),I=window.innerHeight,A=window.innerWidth,T=300,H=d?380:120,O=4,j=v.right-T;j<10&&(j=v.left),j+T>A-10&&(j=A-T-10);let ae=I-v.bottom,ne=v.top,re;ae>=H+O?re=v.bottom+O:ne>=H+O?re=v.top-H-O:re=ae>=ne?v.bottom+O:Math.max(10,v.top-H-O),k({top:re,left:j});},[d,c]),useEffect(()=>{let v=I=>{b.current&&!b.current.contains(I.target)&&!u.current?.contains(I.target)&&(g(false),p(""));};if(c)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[c]),useEffect(()=>{let v=I=>{I.key==="Escape"&&(g(false),p(""));};if(c)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[c]);let m=v=>{let I=t.includes(v),A=a.find(T=>T.id===v);if(h(null),I){let T=t.filter(H=>H!==v);r(T),T.length===0&&f(false);}else {if(s&&Nn(a,v,e)){let H=`Cannot add "${A?.title||v}" as dependency - would create circular reference`;h(H),n?.(v,A?.title||v),setTimeout(()=>h(null),3e3);return}r([...t,v]),f(true);}},N=()=>{let v=!d;f(v),v||r([]);},w=a.filter(v=>v.id!==e).filter(v=>v.title.toLowerCase().includes(i.toLowerCase())||v.id.toLowerCase().includes(i.toLowerCase())),B=t.length>0?"#3B82F6":"#BDC3C7";return jsxs("div",{className:`relative ${o||""}`,children:[jsxs("button",{ref:u,onClick:()=>c?g(false):x(),className:"flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5",title:t.length>0?`${t.length} dependencies`:"Add dependencies",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M7 9L9 7M11.5 3.5L10 2C8.89543 0.89543 7.10457 0.89543 6 2C4.89543 3.10457 4.89543 4.89543 6 6L7.5 7.5M4.5 12.5L6 14C7.10457 15.1046 8.89543 15.1046 10 14C11.1046 12.8954 11.1046 11.1046 10 10L8.5 8.5",stroke:B,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsx("span",{className:"text-xs font-medium",style:{color:B},children:t.length})]}),c&&jsx(ht,{children:jsxs("div",{ref:b,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${y.top}px`,left:`${y.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:[C&&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:C})]}),jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:N,children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:d?"#3b82f6":"transparent",borderColor:d?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:d&&jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),d&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsx("input",{type:"text",value:i,onChange:v=>p(v.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:w.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"}):w.map(v=>{let I=t.includes(v.id);return jsxs("button",{onClick:()=>m(v.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:A=>{A.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:A=>{A.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:I?"#3b82f6":"transparent",borderColor:I?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:I&&jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxs("div",{className:"flex-1 text-left",children:[jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:v.title}),jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:v.id})]})]},v.id)})})]}),t.length>0&&jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsx("button",{onClick:()=>{r([]),f(false),g(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 Sr=memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:c=[],allCards:g=[]})=>{let{attributes:i,listeners:p,setNodeRef:d,transform:f,transition:y,isDragging:k}=useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),C={transform:kn.Transform.toString(f),transition:y};if(t)return jsx("div",{ref:d,style:C,...i,...p,onClick:()=>a?.(e),children:t(e)});let h=c.filter(m=>e.assignedUserIds?.includes(m.id)),b=e.progress===100,u=(e.attachments||[]).filter(m=>m.type.startsWith("image/")),x={...C,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxs("div",{ref:d,style:x,className:l("asakaa-card",k&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...p,onClick:m=>{m.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:m=>{m.currentTarget.style.display="none";}})}),u.length>0&&!e.coverImage&&jsx("div",{className:"asakaa-card-attachments mb-3",children:u.length===1&&u[0]?jsx("img",{src:u[0].url,alt:u[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:m=>{m.currentTarget.style.display="none";}}):jsx("div",{className:"grid grid-cols-2 gap-1",children:u.slice(0,4).map((m,N)=>jsxs("div",{className:"relative",children:[jsx("img",{src:m.url,alt:m.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:w=>{w.currentTarget.style.display="none";}}),N===3&&u.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:["+",u.length-4]})})]},m.id))})}),jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:b?"line-through":"none",opacity:b?.6:1},children:e.title}),e.description&&jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsx("div",{onClick:m=>m.stopPropagation(),className:"priority-selector",children:jsx(to,{priority:e.priority,onChange:m=>n?.(e.id,{priority:m})})}),jsx("div",{onClick:m=>m.stopPropagation(),className:"date-picker",children:jsx(Wo,{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:(m,N)=>n?.(e.id,{startDate:m,endDate:N})})}),c.length>0&&jsx("div",{onClick:m=>m.stopPropagation(),className:"user-selector",children:jsx(ro,{assignedUsers:h,availableUsers:c,onChange:m=>n?.(e.id,{assignedUserIds:m.map(N=>N.id)})})}),jsx("div",{onClick:m=>m.stopPropagation(),className:"dependencies-selector",children:jsx(_o,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(m=>typeof m=="string"?m:m.taskId):[],availableTasks:g,onChange:m=>n?.(e.id,{dependencies:m})})})]}),e.labels&&e.labels.length>0&&jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(m=>jsx("span",{className:"asakaa-label",children:m},m))}),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)));Sr.displayName="Card";var Dn={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"}},Ld=({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 Id({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=useState(false),[n,c]=useState({top:0,left:0}),g=useRef(null),i=useRef(null),p=[...Object.entries(Dn).map(([h,b])=>({id:h,label:b.label,color:b.color,icon:b.icon})),...r.filter(h=>!Object.keys(Dn).includes(h.id)).map(h=>({id:h.id,label:h.title,color:h.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let h=Dn[e];if(h)return {...h,id:e};let b=r.find(u=>u.id===e);return b?{id:b.id,label:b.title,color:b.color||"#8B5CF6",icon:"circle-dot"}:{...Dn.todo,id:"todo"}},f=()=>{if(!i.current)return;let h=i.current.getBoundingClientRect(),b=window.innerHeight,u=window.innerWidth,x=180,m=280,N=4,w=h.right-x;w<10&&(w=h.left),w+x>u-10&&(w=u-x-10);let B=b-h.bottom,v=h.top,I;B>=m+N?I=h.bottom+N:v>=m+N?I=h.top-m-N:I=B>=v?h.bottom+N:Math.max(10,h.top-m-N),c({top:I,left:w}),s(true);};useEffect(()=>{let h=b=>{g.current&&!g.current.contains(b.target)&&!i.current?.contains(b.target)&&s(false);};if(o)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[o]),useEffect(()=>{let h=b=>{b.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[o]);let y=h=>{t(h),s(false);},k=d(),C=k.color;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:i,onClick:()=>o?s(false):f(),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:`${C}10`,boxShadow:`0 0 0 2px ${C}30 inset`},title:k.label,children:jsx(Ld,{icon:k.icon,color:C})}),o&&jsx(ht,{children:jsxs("div",{ref:g,className:"status-selector-menu",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsx("div",{className:"py-1",children:p.map(h=>jsxs("button",{onClick:()=>y(h.id),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:h.color,background:"transparent"},onMouseEnter:b=>{b.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:b=>{b.currentTarget.style.background="transparent";},children:[jsx(Ld,{icon:h.icon,color:h.color}),jsx("span",{className:"font-semibold",children:h.label}),e===h.id&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},h.id))})]})})]})}function Bd({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[s,n]=useState(false),[c,g]=useState(false),[i,p]=useState(e),[d,f]=useState({top:0,left:0}),y=useRef(null),k=useRef(null),C=useRef(null);useEffect(()=>{if(s&&k.current){let x=k.current.getBoundingClientRect();f({top:x.bottom+window.scrollY+8,left:x.left+window.scrollX});}},[s]),useEffect(()=>{let x=m=>{y.current&&!y.current.contains(m.target)&&!k.current?.contains(m.target)&&(n(false),g(false));};if(s)return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[s]),useEffect(()=>{let x=m=>{m.key==="Escape"&&(n(false),g(false),p(e));};if(s)return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[s,e]),useEffect(()=>{c&&C.current&&(C.current.focus(),C.current.select());},[c]);let h=()=>{g(true),p(e);},b=()=>{let x=i.trim();x&&x!==e&&t(x),g(false),n(false),p(e);},u=x=>{x.key==="Enter"?b():x.key==="Escape"&&(g(false),p(e));};return jsxs("div",{className:`relative ${o||""}`,children:[jsx("button",{ref:k,onClick:()=>n(!s),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:"Column options","aria-label":"Column menu",children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),s&&jsx(ht,{children:jsx("div",{ref:y,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:C,type:"text",value:i,onChange:x=>p(x.target.value),onKeyDown:u,onBlur:b,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:"Column name",maxLength:50})]}):jsxs("div",{className:"py-1",children:[jsxs("button",{onClick:h,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-white/90 hover:bg-white/10 transition-all",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-medium",children:"Rename"})]}),r&&a&&jsxs(Fragment,{children:[jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxs("button",{onClick:()=>{a(),n(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-red-400 hover:bg-red-500/10 transition-all",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M2 4H14M5 4V2.5C5 2.22386 5.22386 2 5.5 2H10.5C10.7761 2 11 2.22386 11 2.5V4M12.5 4V13.5C12.5 13.7761 12.2761 14 12 14H4C3.72386 14 3.5 13.7761 3.5 13.5V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M6.5 7V11M9.5 7V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),jsx("span",{className:"font-medium",children:"Delete"})]})]})]})})})]})}var No=memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:c,availableUsers:g,allCards:i,enableVirtualization:p,cardHeight:d=120,isCollapsed:f,onToggleCollapse:y,onColumnRename:k,onColumnDelete:C,isDeletable:h=false,className:b})=>{let{setNodeRef:u,isOver:x}=useDroppable({id:e.id,data:{type:"column",column:e}}),m=useRef(null),N=p??id(t.length),w=useVirtualizer({count:t.length,getScrollElement:()=>m.current,estimateSize:()=>d,enabled:N});if(a)return jsx("div",{ref:u,className:b,children:a(e,t)});let v=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let T=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:T}:T>=80?{state:"warning",percentage:T}:T>=60?{state:"approaching",percentage:T}:{state:"ok",percentage:T}})(),I=v.state==="exceeded",A=()=>"asakaa-column-count";return jsxs("div",{ref:u,className:l("asakaa-column",x&&"ring-2 ring-asakaa-accent-blue",I&&"ring-2 ring-asakaa-accent-red",b),children:[o?o(e,t.length):jsxs("div",{className:"asakaa-column-header group",children:[jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:l(A()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&v.state!=="none"&&jsxs("span",{className:"text-xs font-medium flex items-center",title:`${v.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[v.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"})]}),v.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"})]}),v.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"})}),v.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"})]})]}),(k||C)&&jsx(Bd,{columnTitle:e.title,onRename:T=>k?.(e.id,T),onDelete:C?()=>C(e.id):void 0,isDeletable:h}),y&&jsx("button",{onClick:y,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":f?"Expand column":"Collapse column",children:f?"\u25B6":"\u25BC"})]})]}),!f&&jsx("div",{ref:m,className:"asakaa-column-cards",style:{maxHeight:N?"600px":void 0},children:jsx(SortableContext,{items:t.map(T=>T.id),strategy:verticalListSortingStrategy,children:t.length===0?s?s(e):jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsx("p",{children:"Drop cards here"})}):N?jsx("div",{style:{height:`${w.getTotalSize()}px`,position:"relative"},children:w.getVirtualItems().map(T=>{let H=t[T.index];return H?jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${T.start}px)`},children:jsx(Sr,{card:H,render:r,onClick:n,onUpdate:c,availableUsers:g,allCards:i})},H.id):null})}):t.map(T=>jsx(Sr,{card:T,render:r,onClick:n,onUpdate:c,availableUsers:g,allCards:i},T.id))})})]})});No.displayName="Column";function Gs({title:e,onSave:t,className:a}){let[r,o]=useState(false),[s,n]=useState(e),c=useRef(null);useEffect(()=>{r&&c.current&&(c.current.focus(),c.current.select());},[r]);let g=()=>{let p=s.trim();p&&p!==e?t(p):n(e),o(false);},i=p=>{p.key==="Enter"?g():p.key==="Escape"&&(n(e),o(false));};return r?jsx("input",{ref:c,type:"text",value:s,onChange:p=>n(p.target.value),onBlur:g,onKeyDown:i,className:l("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsx("h2",{className:l("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function pg(e,t){let a=e.slice(0,t),r=a.lastIndexOf("@");if(r===-1)return null;let o=a[r-1];if(r>0&&o&&!/\s/.test(o))return null;let s=a.slice(r+1);return /\s/.test(s)?null:{start:r,end:t,query:s.toLowerCase()}}function Hd(e,t){let a=[],r=/@(\S+)/g,o;for(;(o=r.exec(e))!==null;){let s=o[1]?.toLowerCase()??"";if(!s)continue;let n=t.find(c=>c.name.toLowerCase().replace(/\s+/g,"")===s||c.name.toLowerCase()===s);n&&!a.includes(n.id)&&a.push(n.id);}return a}function ug(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Wd({value:e,onChange:t,onSubmit:a,users:r,placeholder:o,disabled:s=false,isSubmitting:n=false,theme:c="dark",locale:g="es",currentUser:i}){let p=c==="dark",[d,f]=useState(false),[y,k]=useState([]),[C,h]=useState(0),[b,u]=useState(null),x=useRef(null),m=useRef(null),N=useCallback((A,T)=>{let H=pg(A,T);if(u(H),H){let O=r.filter(j=>j.name.toLowerCase().includes(H.query)||j.email&&j.email.toLowerCase().includes(H.query)).slice(0,5);k(O),f(O.length>0),h(0);}else f(false),k([]);},[r]),w=A=>{let T=A.target.value;t(T),N(T,A.target.selectionStart||0);},B=()=>{x.current&&N(e,x.current.selectionStart||0);},v=useCallback(A=>{if(!b||!x.current)return;let T=e.slice(0,b.start),H=e.slice(b.end),O=`@${A.name.replace(/\s+/g,"")} `,j=T+O+H;t(j),f(false),u(null),setTimeout(()=>{if(x.current){let ae=b.start+O.length;x.current.selectionStart=ae,x.current.selectionEnd=ae,x.current.focus();}},0);},[b,e,t]),I=A=>{if(d&&y.length>0)switch(A.key){case "ArrowDown":A.preventDefault(),h(T=>T<y.length-1?T+1:0);break;case "ArrowUp":A.preventDefault(),h(T=>T>0?T-1:y.length-1);break;case "Enter":{A.preventDefault();let T=y[C];T&&v(T);break}case "Tab":{A.preventDefault();let T=y[C];T&&v(T);break}case "Escape":A.preventDefault(),f(false);break}else A.key==="Enter"&&!A.shiftKey&&(A.preventDefault(),a());};return useEffect(()=>{let A=T=>{m.current&&!m.current.contains(T.target)&&x.current&&!x.current.contains(T.target)&&f(false);};return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[]),useEffect(()=>{if(d&&m.current){let A=m.current.children[C];A&&A.scrollIntoView({block:"nearest"});}},[C,d]),jsxs("div",{className:"flex items-start gap-2",children:[i&&jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:i.color||"#8B5CF6"},children:i.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:l("flex-1 relative"),children:[jsxs("div",{className:l("flex items-center gap-2 px-3 py-2 rounded-lg",p?"bg-white/5":"bg-white border border-gray-200"),children:[jsx("input",{ref:x,type:"text",value:e,onChange:w,onSelect:B,onKeyDown:I,placeholder:o||(g==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||n,className:l("flex-1 bg-transparent text-sm outline-none",p?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400",(s||n)&&"opacity-50")}),jsx("button",{onClick:a,disabled:n||!e.trim()||s,className:l("p-1.5 rounded transition-colors",e.trim()&&!s?"bg-blue-500 text-white hover:bg-blue-600":p?"text-[#6B7280]":"text-gray-400",n&&"opacity-50 cursor-not-allowed"),children:n?jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsx(Send,{className:"w-4 h-4"})})]}),jsx(AnimatePresence,{children:d&&y.length>0&&jsx(motion.div,{ref:m,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:l("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",p?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:y.map((A,T)=>jsxs("button",{type:"button",onClick:()=>v(A),className:l("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",T===C?p?"bg-white/10":"bg-gray-100":p?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:A.color||"#8B5CF6"},children:ug(A.name)}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("p",{className:l("text-sm font-medium truncate",p?"text-white":"text-gray-900"),children:A.name}),A.email&&jsx("p",{className:l("text-xs truncate",p?"text-[#6B7280]":"text-gray-500"),children:A.email})]})]},A.id))})})]})]})}function Gd({content:e,theme:t="dark"}){let a=t==="dark",r=[],o=/@(\S+)/g,s=0,n;for(;(n=o.exec(e))!==null;)n.index>s&&r.push({type:"text",value:e.slice(s,n.index)}),r.push({type:"mention",value:n[0]}),s=n.index+n[0].length;return s<e.length&&r.push({type:"text",value:e.slice(s)}),jsx("span",{className:"whitespace-pre-wrap break-words",children:r.map((c,g)=>c.type==="mention"?jsx("span",{className:l("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:c.value},g):jsx("span",{children:c.value},g))})}var An=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function yr({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[c,g]=useState(false),[i,p]=useState(""),[d,f]=useState(false),[y,k]=useState(An[10]||"#3B82F6"),[C,h]=useState({top:0,left:0}),b=useRef(null),u=useRef(null),x=useRef(null),m=useRef(null),N=t.filter(T=>T.name.toLowerCase().includes(i.toLowerCase())),w=t.some(T=>T.name.toLowerCase()===i.toLowerCase());useEffect(()=>{if(c&&u.current){let T=u.current.getBoundingClientRect();h({top:T.bottom+6,left:T.left});}},[c]),useEffect(()=>{let T=H=>{let O=H.target,j=b.current?.contains(O),ae=x.current?.contains(O);!j&&!ae&&(g(false),p(""),f(false));};if(c)return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[c]),useEffect(()=>{c&&m.current&&m.current.focus();},[c]);let B=T=>{let H=e.some(O=>O.id===T.id);a(H?e.filter(O=>O.id!==T.id):[...e,T]);},v=async()=>{if(!(!r||!i.trim())){f(true);try{let T=await r(i.trim(),y);T&&(a([...e,T]),p(""),k(An[Math.floor(Math.random()*An.length)]||"#3B82F6"));}finally{f(false);}}},I=(T,H)=>{H.stopPropagation(),a(e.filter(O=>O.id!==T));},A={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxs("div",{ref:b,className:"relative",children:[jsxs("button",{ref:u,type:"button",onClick:()=>!s&&g(!c),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:A,disabled:s,children:[jsx(Tag,{className:"w-3.5 h-3.5"}),e.length>0?jsxs("div",{className:"flex items-center gap-1",children:[e.slice(0,2).map(T=>jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${T.color}20`,color:T.color},children:T.name},T.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:x,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:C.top,left:C.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:m,type:"text",value:i,onChange:T=>p(T.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:T=>{T.key==="Enter"&&i.trim()&&!w&&r&&v();}})}),e.length>0&&jsxs("div",{className:"p-2 border-b",style:{borderColor:o.border},children:[jsx("p",{className:"text-xs mb-1.5",style:{color:o.textTertiary},children:"Seleccionadas"}),jsx("div",{className:"flex flex-wrap gap-1",children:e.map(T=>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:`${T.color}20`,color:T.color},onClick:H=>I(T.id,H),children:[T.name,jsx(X,{className:"w-3 h-3"})]},T.id))})]}),jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:N.length>0?N.map(T=>{let H=e.some(O=>O.id===T.id);return jsxs("button",{type:"button",onClick:()=>B(T),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:H?`${T.color}15`:"transparent",color:o.textPrimary},onMouseEnter:O=>{H||(O.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:O=>{H||(O.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:T.color}}),jsx("span",{className:"flex-1 text-left",children:T.name}),H&&jsx(Check,{className:"w-4 h-4",style:{color:T.color}})]},T.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()&&!w&&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(T=>jsx("button",{type:"button",onClick:()=>k(T),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:T,outline:y===T?`2px solid ${T}`:"none",outlineOffset:"2px"}},T))}),jsxs("button",{type:"button",onClick:v,disabled:d,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:y,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 Vs({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 Vd({tags:e,maxVisible:t=3,size:a="sm"}){if(!e||e.length===0)return null;let r=e.slice(0,t),o=e.length-t;return jsxs("div",{className:"flex flex-wrap gap-1",children:[r.map(s=>jsx(Vs,{tag:s,size:a},s.id)),o>0&&jsxs("span",{className:`inline-flex items-center rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:"rgba(100,100,100,0.2)",color:"#9CA3AF"},children:["+",o]})]})}var vr=[{name:"Azul",value:"#6366F1",light:"#818CF8"},{name:"P\xFArpura",value:"#A855F7",light:"#C084FC"},{name:"Rosa",value:"#EC4899",light:"#F472B6"},{name:"Rojo",value:"#EF4444",light:"#F87171"},{name:"Naranja",value:"#F59E0B",light:"#FBBF24"},{name:"Amarillo",value:"#EAB308",light:"#FACC15"},{name:"Lima",value:"#84CC16",light:"#A3E635"},{name:"Verde",value:"#10B981",light:"#34D399"},{name:"Esmeralda",value:"#059669",light:"#10B981"},{name:"Cyan",value:"#06B6D4",light:"#22D3EE"},{name:"Azul Cielo",value:"#0EA5E9",light:"#38BDF8"},{name:"\xCDndigo",value:"#4F46E5",light:"#6366F1"},{name:"Violeta",value:"#8B5CF6",light:"#A78BFA"},{name:"Fucsia",value:"#D946EF",light:"#E879F9"},{name:"Coral",value:"#F97316",light:"#FB923C"},{name:"Magenta",value:"#E11D48",light:"#FB7185"}];function Xd(e,t=[]){if("title"in e&&!("name"in e)){let a=e,r=(a.assignedUserIds||[]).map(o=>{let s=t.find(n=>n.id===o);return s||null}).filter(o=>o!==null);return {id:a.id,name:a.title,startDate:a.startDate?new Date(a.startDate):void 0,endDate:a.endDate?new Date(a.endDate):void 0,progress:a.progress||0,status:a.columnId,priority:a.priority?.toLowerCase(),assignees:r,dependencies:Array.isArray(a.dependencies)?a.dependencies.map(o=>typeof o=="string"?o:o.taskId):[],tags:a.tags,subtasks:a.subtasks?.map(o=>({id:o.id,name:o.title,progress:o.completed?100:0,startDate:new Date,endDate:new Date})),color:a.color,description:a.description}}return e}function zg(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 so({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:c=[],availableTags:g=[],onCreateTag:i,attachments:p=[],onUploadAttachments:d,onDeleteAttachment:f,availableTasks:y=[],comments:k=[],onAddComment:C,currentUser:h,mentionableUsers:b=[]}){let u=s==="dark",x={textTertiary:u?"#6B7280":"#9CA3AF",textSecondary:u?"#9CA3AF":"#6B7280",textPrimary:u?"#FFFFFF":"#111827",borderLight:u?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:u?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:u?"#1A1D25":"#FFFFFF",bgSecondary:u?"#0F1117":"#F9FAFB",hoverBg:u?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},m=e&&"title"in e&&!("name"in e),N=e,[w,B]=useState(e?Xd(e,c):null),[v,I]=useState(false),[A,T]=useState(false),[H,O]=useState(false),[j,ae]=useState(null),[ne,re]=useState(new Date),[ge,fe]=useState(false),[Ie,M]=useState(false),[R,L]=useState(""),[V,q]=useState(false),[z,ye]=useState(false),[se,Be]=useState(false),[Ye,tt]=useState(""),ie=useRef(null),[Je,mt]=useState(""),Ct=useRef(null),[xt,$]=useState(""),[be,Pe]=useState(false);useEffect(()=>{if(e){let F=Xd(e,c);B(F),tt(F.description||""),mt(F.name||"");}},[e?.id,c]),useEffect(()=>()=>{ie.current&&clearTimeout(ie.current),Ct.current&&clearTimeout(Ct.current);},[]);let Me=useCallback(F=>{B(F),m&&o&&N?o(zg(F,N)):r&&r(F);},[m,N,o,r]),je=useCallback(()=>{I(false),T(false),O(false),ae(null),M(false),L(""),q(false);},[]),Ze=useCallback((F,Ce)=>{if(!w)return;let Z={...w,[F]:Ce};Me(Z);},[w,Me]),Pt=useCallback(F=>{tt(F),ie.current&&clearTimeout(ie.current),ie.current=setTimeout(()=>{if(w){let Ce={...w,description:F};Me(Ce);}},800);},[w,Me]),Le=useCallback(F=>{mt(F),Ct.current&&clearTimeout(Ct.current),Ct.current=setTimeout(()=>{if(w&&F.trim()){let Ce={...w,name:F.trim()};Me(Ce);}},800);},[w,Me]),J=useCallback(async()=>{if(!(!w||!xt.trim()||!C)){Pe(true);try{let F=Hd(xt,b);await C(w.id,xt.trim(),F.length>0?F:void 0),$("");}finally{Pe(false);}}},[w,xt,C,b]),ve=useCallback(F=>{let Ce=typeof F=="string"?new Date(F):F,xe=new Date().getTime()-Ce.getTime(),we=Math.floor(xe/6e4),ze=Math.floor(xe/36e5),Re=Math.floor(xe/864e5);return we<1?n==="es"?"Ahora":"Just now":we<60?n==="es"?`Hace ${we} min`:`${we}m ago`:ze<24?n==="es"?`Hace ${ze}h`:`${ze}h ago`:Re<7?n==="es"?`Hace ${Re}d`:`${Re}d ago`:Ce.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),Ue=useCallback(F=>{if(!w)return;let Ce=w.progress||0;F==="completed"?Ce=100:F==="in-progress"&&Ce===0?Ce=10:F==="todo"&&(Ce=0);let Z={...w,status:F,progress:Ce};Me(Z),I(false);},[w,Me]),Fe=useCallback((F,Ce)=>{if(!w)return;let Z={...w,startDate:F,endDate:Ce};Me(Z);},[w,Me]),at=useCallback(()=>{let F=ne.getFullYear(),Ce=ne.getMonth(),Z=new Date(F,Ce,1),we=new Date(F,Ce+1,0).getDate(),ze=Z.getDay(),Re=[],dt=new Date(F,Ce,0).getDate();for(let Y=ze-1;Y>=0;Y--)Re.push({date:new Date(F,Ce-1,dt-Y),isCurrentMonth:false});for(let Y=1;Y<=we;Y++)Re.push({date:new Date(F,Ce,Y),isCurrentMonth:true});let U=42-Re.length;for(let Y=1;Y<=U;Y++)Re.push({date:new Date(F,Ce+1,Y),isCurrentMonth:false});return Re},[ne]),ct=useCallback(async F=>{if(F.preventDefault(),F.stopPropagation(),ye(false),!w||!d)return;let Ce=Array.from(F.dataTransfer.files);if(Ce.length!==0){Be(true);try{await d(w.id,Ce);}finally{Be(false);}}},[w,d]),te=useCallback(async F=>{if(!w||!d||!F.target.files)return;let Ce=Array.from(F.target.files);if(Ce.length!==0){Be(true);try{await d(w.id,Ce);}finally{Be(false);}F.target.value="";}},[w,d]),$e=useCallback(F=>{F.preventDefault(),F.stopPropagation(),ye(true);},[]),Kt=useCallback(F=>{F.preventDefault(),F.stopPropagation(),ye(false);},[]),Qe=useCallback(F=>F<1024?`${F} B`:F<1024*1024?`${(F/1024).toFixed(1)} KB`:`${(F/(1024*1024)).toFixed(1)} MB`,[]),Ke=useCallback(F=>F.startsWith("image/")?Image:F.includes("pdf")||F.includes("document")?FileText:File,[]);return !t||!w?null:jsx(AnimatePresence,{children:t&&w&&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:l("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",u?"bg-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxs("div",{className:l("px-6 py-3 border-b flex items-center gap-3",u?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Circle,{className:l("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-500")}),jsxs("span",{className:l("text-xs px-2 py-0.5 rounded",u?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsx("span",{className:l("text-xs font-mono",u?"text-[#6B7280]":"text-gray-400"),children:w.id.slice(0,8)}),jsxs("button",{className:l("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",u?"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:l("p-1.5 rounded transition-colors",u?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(Maximize2,{className:"w-4 h-4"})}),jsx("button",{className:l("p-1.5 rounded transition-colors",u?"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:l("p-1.5 rounded transition-colors",u?"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 F=w.progress===100?0:100,Z={...w,progress:F,status:F===100?"completed":"todo"};Me(Z);},className:l("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",w.progress===100?"bg-green-500 border-green-500":u?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:w.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("input",{type:"text",value:Je,onChange:F=>Le(F.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:l("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",w.progress===100?"line-through text-[#6B7280]":u?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400")})]})}),jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CheckCircle2,{className:l("w-4 h-4",u?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:l("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsx("button",{onClick:()=>{je(),I(!v);},className:l("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",w.progress===100||w.status==="completed"?"bg-green-500/20 text-green-400":w.progress&&w.progress>0||w.status==="in-progress"?"bg-blue-500/20 text-blue-400":u?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:w.progress===100||w.status==="completed"?n==="es"?"COMPLETADO":"DONE":w.progress&&w.progress>0||w.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsx(AnimatePresence,{children:v&&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:l("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",u?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500"}].map(F=>jsxs("button",{onClick:()=>Ue(F.id),className:l("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",u?"hover:bg-white/5":"hover:bg-gray-50",w.status===F.id&&(u?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:l("w-2 h-2 rounded-full",F.color)}),jsx("span",{className:u?"text-white":"text-gray-900",children:F.label})]},F.id))})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(User,{className:l("w-4 h-4",u?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:l("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxs("button",{onClick:()=>{je(),O(!H);},className:l("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",u?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[w.assignees&&w.assignees.length>0?jsxs("div",{className:"flex items-center gap-1",children:[w.assignees.slice(0,3).map((F,Ce)=>jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:F.color||"#8B5CF6"},title:F.name,children:F.initials||F.name.slice(0,2).toUpperCase()},Ce)),w.assignees.length>3&&jsxs("span",{className:l("text-xs",u?"text-[#6B7280]":"text-gray-400"),children:["+",w.assignees.length-3]})]}):jsx("span",{className:l("text-sm",u?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsx(ChevronDown,{className:l("w-3 h-3",u?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:H&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>O(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:l("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",u?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:c.length>0?c.map(F=>{let Ce=w.assignees?.some(Z=>Z.name===F.name);return jsxs("button",{onClick:()=>{let Z=w.assignees||[],xe;Ce?xe=Z.filter(we=>we.name!==F.name):xe=[...Z,F],Ze("assignees",xe);},className:l("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",u?"hover:bg-white/5":"hover:bg-gray-50",Ce&&(u?"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:F.color||"#8B5CF6"},children:F.initials||F.name.slice(0,2).toUpperCase()}),jsx("span",{className:l("flex-1",u?"text-white":"text-gray-900"),children:F.name}),Ce&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},F.name)}):jsx("div",{className:l("px-3 py-4 text-sm text-center",u?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CalendarDays,{className:l("w-4 h-4",u?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:l("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxs("button",{onClick:()=>{ae(j?null:"start"),re(w.startDate||new Date);},className:l("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",u?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[w.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsx("span",{className:l("mx-1",u?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),w.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsx(AnimatePresence,{children:j&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ae(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:l("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",u?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:F=>F.stopPropagation(),children:[jsxs("div",{className:l("w-44 py-2 border-r",u?"border-white/10":"border-gray-200"),children:[(()=>{let F=new Date,Ce=new Date(F);Ce.setDate(F.getDate()+1);let Z=new Date(F);Z.setDate(F.getDate()+((6-F.getDay()+7)%7||7));let xe=new Date(F);xe.setDate(F.getDate()+((1-F.getDay()+7)%7||7));let we=new Date(F);we.setDate(F.getDate()+(6-F.getDay()+7)%7+7);let ze=new Date(F);ze.setDate(F.getDate()+14);let Re=new Date(F);return Re.setDate(F.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:F,display:F.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:Ce,display:Ce.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:Z,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:xe,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:we,display:we.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:ze,display:ze.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Re,display:Re.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((U,Y)=>jsxs("button",{className:l("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",u?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(j==="start"){let me=w.endDate&&U.date>w.endDate?U.date:w.endDate;Fe(U.date,me),ae("end");}else {let me=w.startDate&&U.date<w.startDate?U.date:w.startDate;Fe(me,U.date),ae(null);}},children:[jsx("span",{children:U.label}),jsx("span",{className:l("text-xs",u?"text-[#6B7280]":"text-gray-400"),children:U.display})]},Y))})(),jsx("div",{className:l("border-t mt-2 pt-2",u?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{Fe(void 0,void 0),ae(null);},className:l("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",u?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:n==="es"?"Quitar fechas":"Clear dates"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[jsx("div",{className:l("text-xs mb-3 px-2 py-1 rounded",u?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:j==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("span",{className:l("font-medium",u?"text-white":"text-gray-900"),children:ne.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>re(new Date),className:l("p-1 rounded text-sm transition-colors",u?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>re(new Date(ne.getFullYear(),ne.getMonth()-1)),className:l("p-1 rounded",u?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),jsx("button",{onClick:()=>re(new Date(ne.getFullYear(),ne.getMonth()+1)),className:l("p-1 rounded",u?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(F=>jsx("div",{className:l("w-8 h-8 flex items-center justify-center text-xs",u?"text-[#6B7280]":"text-gray-400"),children:F},F))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:at().map((F,Ce)=>{let Z=F.date.toDateString()===new Date().toDateString(),xe=w.startDate?.toDateString()===F.date.toDateString(),we=w.endDate?.toDateString()===F.date.toDateString(),ze=xe||we,Re=w.startDate&&w.endDate&&F.date>=w.startDate&&F.date<=w.endDate;return jsx("button",{onClick:()=>{let dt=new Date(F.date);if(j==="start"){let U=w.endDate&&dt>w.endDate?dt:w.endDate;Fe(dt,U),ae("end");}else {let U=w.startDate&&dt<w.startDate?dt:w.startDate;Fe(U,dt),ae(null);}},className:l("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!F.isCurrentMonth&&(u?"text-[#4B5563]":"text-gray-300"),F.isCurrentMonth&&(u?"text-white":"text-gray-900"),Z&&"ring-2 ring-[#3B82F6]",xe&&"bg-[#3B82F6] text-white",we&&!xe&&"bg-[#7C3AED] text-white",Re&&!ze&&(u?"bg-[#7C3AED]/20":"bg-purple-100"),!ze&&(u?"hover:bg-white/10":"hover:bg-gray-100")),children:F.date.getDate()},Ce)})})]})]})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Flag,{className:l("w-4 h-4",u?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:l("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsx("button",{onClick:()=>{je(),T(!A);},className:l("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",w.priority==="high"||w.priority==="urgent"?"bg-red-500/20 text-red-400":w.priority==="medium"?"bg-yellow-500/20 text-yellow-400":w.priority==="low"?"bg-green-500/20 text-green-400":u?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:w.priority?w.priority==="high"||w.priority==="urgent"?n==="es"?"Alta":"High":w.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsx(AnimatePresence,{children:A&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>T(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:l("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",u?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(F=>jsxs("button",{onClick:()=>{Ze("priority",F.id),T(false);},className:l("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",u?"hover:bg-white/5":"hover:bg-gray-50",w.priority===F.id&&(u?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:l("w-2 h-2 rounded-full",F.color)}),jsx("span",{className:u?"text-white":"text-gray-900",children:F.label})]},F.id||"none"))})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:l("w-4 h-4",u?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:l("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsx("span",{className:l("text-sm",u?"text-white":"text-gray-900"),children:w.startDate&&w.endDate?`${Math.ceil((w.endDate.getTime()-w.startDate.getTime())/(1e3*60*60*24))} ${n==="es"?"d\xEDas":"days"}`:n==="es"?"Sin definir":"Not set"})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:l("w-4 h-4 rounded-full border-2",u?"border-[#6B7280]":"border-gray-400")}),jsx("span",{className:l("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[ge?jsx("input",{type:"range",min:"0",max:"100",step:"5",value:w.progress||0,onChange:F=>{let Ce=parseInt(F.target.value),Z=w.status;Ce===100?Z="completed":Ce>0?Z="in-progress":Z="todo";let xe={...w,progress:Ce,status:Z};Me(xe);},onBlur:()=>fe(false),className:l("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",u?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsx("button",{onClick:()=>fe(true),className:l("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",u?"bg-white/10":"bg-gray-200"),children:jsx("div",{className:l("h-full rounded-full transition-all",w.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${w.progress||0}%`}})}),jsxs("span",{className:l("text-sm font-medium min-w-[40px]",u?"text-white":"text-gray-900"),children:[w.progress||0,"%"]})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Tag,{className:l("w-4 h-4",u?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:l("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsx(yr,{selectedTags:w.tags||[],availableTags:g,onChange:F=>{Ze("tags",F);},onCreateTag:i,theme:x})]}),jsxs("div",{className:"flex items-start gap-3 relative",children:[jsx(Link2,{className:l("w-4 h-4 mt-1.5",u?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:l("text-sm w-24 mt-1",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxs("div",{className:"flex-1",children:[w.dependencies&&w.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:w.dependencies.map(F=>{let Ce=y.find(Z=>Z.id===F);return jsxs("span",{className:l("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",u?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[Ce?.name||F.slice(0,8),jsx("button",{onClick:()=>{let Z=(w.dependencies||[]).filter(xe=>xe!==F);Ze("dependencies",Z);},className:l("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsx(X,{className:"w-3 h-3"})})]},F)})}),jsxs("button",{onClick:()=>{je(),M(!Ie);},className:l("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",u?"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:l("text-sm",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsx(AnimatePresence,{children:Ie&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{M(false),L("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:l("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",u?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsx("div",{className:l("p-2 border-b",u?"border-white/10":"border-gray-200"),children:jsx("input",{type:"text",value:R,onChange:F=>L(F.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:l("w-full px-3 py-2 rounded-md text-sm outline-none",u?"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:y.length>0?y.filter(F=>F.id!==w.id).filter(F=>R===""||F.name.toLowerCase().includes(R.toLowerCase())).map(F=>{let Ce=w.dependencies?.includes(F.id);return jsxs("button",{onClick:()=>{let Z=w.dependencies||[],xe;Ce?xe=Z.filter(we=>we!==F.id):xe=[...Z,F.id],Ze("dependencies",xe);},className:l("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",u?"hover:bg-white/5":"hover:bg-gray-50",Ce&&(u?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:l("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",Ce?"bg-blue-500 border-blue-500":u?"border-white/30":"border-gray-300"),children:Ce&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:l("block truncate",u?"text-white":"text-gray-900"),children:F.name}),jsx("span",{className:l("text-xs",u?"text-[#6B7280]":"text-gray-400"),children:F.id.slice(0,8)})]})]},F.id)}):jsx("div",{className:l("px-3 py-4 text-sm text-center",u?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Palette,{className:l("w-4 h-4",u?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:l("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxs("button",{onClick:()=>{je(),q(!V);},className:l("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",u?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:w.color||"#6366F1"}}),jsx("span",{className:l("text-sm",u?"text-white":"text-gray-900"),children:vr.find(F=>F.value===w.color)?.name||(n==="es"?"Azul":"Blue")}),jsx(ChevronDown,{className:l("w-3 h-3",u?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:V&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>q(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:l("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",u?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-6 gap-1.5",children:vr.map(F=>{let Ce=w.color===F.value;return jsx("button",{onClick:()=>{Ze("color",F.value),q(false);},className:l("w-7 h-7 rounded-full flex items-center justify-center transition-all",Ce&&"ring-2 ring-offset-2",u?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:F.value,outlineColor:Ce?F.value:void 0},title:F.name,children:Ce&&jsx(Check,{className:"w-3.5 h-3.5 text-white"})},F.value)})})})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Diamond,{className:l("w-4 h-4",u?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:l("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Hito":"Milestone"}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",checked:w.isMilestone||false,onChange:F=>Ze("isMilestone",F.target.checked),className:l("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",w.isMilestone?"bg-purple-500 border-purple-500":u?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsx("span",{className:l("text-sm",u?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxs("div",{className:l("mt-6 pt-4 border-t",u?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsx(FileText,{className:l("w-4 h-4",u?"text-[#6B7280]":"text-gray-400")}),jsx("h3",{className:l("text-sm font-semibold",u?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsx("textarea",{value:Ye,onChange:F=>Pt(F.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:l("w-full min-h-[100px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors",u?"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:l("flex items-center gap-2 text-sm mt-2 transition-colors",u?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsx(Sparkles,{className:"w-4 h-4"}),n==="es"?"Escribe con IA":"Write with AI"]})]}),jsxs("div",{className:l("mt-6 pt-4 border-t",u?"border-white/10":"border-gray-200"),children:[jsx("h3",{className:l("text-sm font-semibold mb-3",u?"text-white":"text-gray-900"),children:n==="es"?"Campos personalizados":"Custom fields"}),jsxs("button",{className:l("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",u?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsx(Plus,{className:"w-4 h-4"}),n==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxs("div",{className:l("mt-6 pt-4 border-t",u?"border-white/10":"border-gray-200"),children:[jsx("h3",{className:l("text-sm font-semibold mb-3",u?"text-white":"text-gray-900"),children:n==="es"?"Subtareas":"Subtasks"}),w.subtasks&&w.subtasks.length>0&&jsx("div",{className:"space-y-2 mb-3",children:w.subtasks.map(F=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:l("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",F.progress===100?"bg-green-500 border-green-500":u?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:F.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("span",{className:l("text-sm",F.progress===100?"line-through text-[#6B7280]":u?"text-white":"text-gray-900"),children:F.name})]},F.id))}),jsxs("button",{className:l("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",u?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsx(Plus,{className:"w-4 h-4"}),n==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxs("div",{className:l("mt-6 pt-4 border-t",u?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("h3",{className:l("text-sm font-semibold",u?"text-white":"text-gray-900"),children:n==="es"?"Listas de control":"Checklists"}),jsx("button",{className:l("p-1 rounded transition-colors",u?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(Plus,{className:"w-4 h-4"})})]}),jsxs("button",{className:l("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",u?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsx(ListChecks,{className:"w-4 h-4"}),n==="es"?"Crear lista de control":"Create checklist"]})]}),jsxs("div",{className:l("mt-6 pt-4 border-t",u?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:l("text-sm font-semibold mb-3",u?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",p.length>0&&jsxs("span",{className:l("ml-2 text-xs font-normal",u?"text-[#6B7280]":"text-gray-400"),children:["(",p.length,")"]})]}),p.length>0&&jsx("div",{className:"space-y-2 mb-4",children:p.map(F=>{let Ce=Ke(F.type),Z=F.type.startsWith("image/");return jsxs("div",{className:l("flex items-center gap-3 p-2 rounded-lg group transition-colors",u?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[Z&&F.thumbnailUrl?jsx("img",{src:F.thumbnailUrl,alt:F.name,className:"w-10 h-10 rounded object-cover"}):jsx("div",{className:l("w-10 h-10 rounded flex items-center justify-center",u?"bg-white/10":"bg-gray-200"),children:jsx(Ce,{className:l("w-5 h-5",u?"text-[#9CA3AF]":"text-gray-500")})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("a",{href:F.url,target:"_blank",rel:"noopener noreferrer",className:l("text-sm font-medium truncate block hover:underline",u?"text-white":"text-gray-900"),children:F.name}),jsx("p",{className:l("text-xs",u?"text-[#6B7280]":"text-gray-400"),children:Qe(F.size)})]}),f&&jsx("button",{onClick:()=>f(F.id),className:l("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",u?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:n==="es"?"Eliminar":"Delete",children:jsx(Trash2,{className:"w-4 h-4"})})]},F.id)})}),jsxs("div",{onDragOver:$e,onDragLeave:Kt,onDrop:ct,className:l("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",z?u?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":u?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",se&&"pointer-events-none opacity-50"),children:[jsx("input",{type:"file",multiple:true,onChange:te,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!d||se}),se?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:l("text-sm",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxs(Fragment,{children:[jsx(Upload,{className:l("w-6 h-6 mx-auto mb-2",z?"text-blue-500":u?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:l("text-sm",u?"text-[#9CA3AF]":"text-gray-500"),children:z?n==="es"?"Suelta los archivos aqu\xED":"Drop files here":n==="es"?jsxs(Fragment,{children:["Suelta tus archivos aqu\xED o ",jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxs(Fragment,{children:["Drop your files here or ",jsx("span",{className:"underline",children:"click to upload"})]})}),!d&&jsx("p",{className:l("text-xs mt-1",u?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxs("div",{className:l("w-80 border-l flex flex-col",u?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsx("div",{className:l("px-4 py-3 border-b",u?"border-white/10":"border-gray-200"),children:jsxs("h3",{className:l("text-sm font-semibold",u?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",k.length>0&&jsxs("span",{className:l("ml-2 text-xs font-normal",u?"text-[#6B7280]":"text-gray-400"),children:["(",k.length,")"]})]})}),jsx("div",{className:"flex-1 overflow-y-auto p-4",children:k.length>0?jsx("div",{className:"space-y-4",children:k.map(F=>jsxs("div",{className:"flex gap-3",children:[jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:F.user?.color||"#8B5CF6"},children:F.user?.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsx("span",{className:l("text-sm font-medium",u?"text-white":"text-gray-900"),children:F.user?.name||(n==="es"?"Usuario":"User")}),jsx("span",{className:l("text-xs",u?"text-[#6B7280]":"text-gray-400"),children:ve(F.createdAt)})]}),jsx("div",{className:l("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:jsx(Gd,{content:F.content,theme:s})})]})]},F.id))}):jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsx(MessageSquare,{className:l("w-10 h-10 mb-3",u?"text-[#3B4252]":"text-gray-300")}),jsx("p",{className:l("text-sm",u?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsx("div",{className:l("p-4 border-t",u?"border-white/10":"border-gray-200"),children:jsx(Wd,{value:xt,onChange:$,onSubmit:J,users:b,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!C,isSubmitting:be,theme:s,locale:n,currentUser:h})})]})]})]})})}function Xs(){let[e,t]=useState(()=>dragStore.getState());useEffect(()=>dragStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{dragStore.setState(r);},[]);return [e,a]}function zr({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:c,isLoading:g,error:i,children:p,availableTags:d=[],onCreateTag:f,attachmentsByCard:y,onUploadAttachments:k,onDeleteAttachment:C,comments:h,onAddComment:b,currentUser:u,mentionableUsers:x,onTaskOpen:m}){let[N,w]=Xs(),[B,v]=useState(null),I=o?.theme||"dark",A=I==="dark"||I==="neutral",T=A?"dark":"",H=useCallback((V,q)=>{t.onCardUpdate?.(V,q);},[t]),O=useCallback((V,q)=>{t.onColumnUpdate?.(V,{title:q});},[t]),j=useCallback(V=>{t.onColumnDelete?.(V);},[t]),ae=["todo","in-progress","completed"],ne=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),re=useMemo(()=>{let V=new Map;return e.columns.forEach(q=>{let z=q.cardIds.map(ye=>e.cards.find(se=>se.id===ye)).filter(ye=>ye!==void 0).sort((ye,se)=>ye.position-se.position);V.set(q.id,z);}),V},[e.cards,e.columns]),ge=useMemo(()=>e.cards.map(V=>({id:V.id,name:V.title,startDate:V.startDate?new Date(V.startDate):void 0,endDate:V.endDate?new Date(V.endDate):void 0,progress:V.progress||0,status:V.columnId,priority:V.priority?.toLowerCase(),dependencies:Array.isArray(V.dependencies)?V.dependencies.map(q=>typeof q=="string"?q:q.taskId):[]})),[e.cards]),fe=useCallback(V=>{let{active:q}=V,z=e.cards.find(ye=>ye.id===q.id);z&&w({isDragging:true,draggedCardId:z.id,sourceColumnId:z.columnId,targetColumnId:z.columnId});},[e.cards,w]),Ie=useCallback(V=>{let{active:q,over:z}=V;if(!z||!e.cards.find(Be=>Be.id===q.id))return;let se=null;z.data.current?.type==="column"?se=z.id:z.data.current?.type==="card"&&(se=e.cards.find(Ye=>Ye.id===z.id)?.columnId||null),se&&se!==N.targetColumnId&&w({...N,targetColumnId:se});},[e.cards,N,w]),M=useCallback(async V=>{let{active:q,over:z}=V;if(w({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!z)return;let ye=e.cards.find(tt=>tt.id===q.id);if(!ye)return;let se,Be;if(z.data.current?.type==="column"){se=z.id;let tt=re.get(se)||[];Be=Is(tt,0);}else {let tt=e.cards.find(mt=>mt.id===z.id);if(!tt)return;se=tt.columnId;let ie=re.get(se)||[],Je=ie.findIndex(mt=>mt.id===z.id);Be=Is(ie,Je);}let Ye=e.columns.find(tt=>tt.id===se);if(Ye&&Ye.wipLimit&&Ye.wipLimitType==="hard"){let tt=re.get(se)||[];if(ye.columnId!==se&&tt.length>=Ye.wipLimit){t.onWipLimitExceeded?.(Ye,ye);return}}(ye.columnId!==se||ye.position!==Be)&&await t.onCardMove?.(ye.id,se,Be);},[e.cards,e.columns,re,t,w]),R=useCallback(V=>{v(V),a?.(V),m?.(V.id);},[a,m]),L=useCallback(V=>{t.onCardUpdate?.(V.id,V),v(V);},[t]);return g?jsx("div",{className:l("asakaa-board",T,n),style:c,children:jsx(Zg,{columnCount:3})}):i?jsx("div",{className:l("asakaa-board",T,n),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(yd,{themeName:I,children:[jsxs(DndContext,{sensors:ne,collisionDetection:closestCorners,onDragStart:fe,onDragOver:Ie,onDragEnd:M,children:[jsxs("div",{className:l("asakaa-board",T,n),style:c,"data-theme":I,children:[e.columns.sort((V,q)=>V.position-q.position).map(V=>{let q=re.get(V.id)||[],z=!ae.includes(V.id);return jsx(No,{column:V,cards:q,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:R,onCardUpdate:H,onColumnRename:O,onColumnDelete:j,isDeletable:z,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},V.id)}),p]}),jsx(DragOverlay,{children:N.draggedCardId?jsx(Sr,{card:e.cards.find(V=>V.id===N.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),jsx(so,{task:B,isOpen:!!B,onClose:()=>v(null),onCardUpdate:L,theme:A?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:d,onCreateTag:f,attachments:B?y?.get(B.id)||[]:[],onUploadAttachments:k,onDeleteAttachment:C,availableTasks:ge,comments:h,onAddComment:b,currentUser:u,mentionableUsers:x})]})}function Zg({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 rf={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)"},of={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)"},nf={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},sf={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function lf({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=useState(false),c=useRef(null);useEffect(()=>{let i=p=>{c.current&&!c.current.contains(p.target)&&n(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let g=i=>{t(i),n(false);};return jsxs("div",{ref:c,className:"relative",children:[jsxs(motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:o||r.newTask}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((i,p)=>i.position-p.position).map((i,p)=>jsxs(motion.button,{onClick:()=>g(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:p<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:p*.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 df({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=useState(false),[c,g]=useState(null),i=useRef(null);if(useEffect(()=>{let y=k=>{i.current&&!i.current.contains(k.target)&&n(false);};return s&&document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[s]),!(a||r||o))return null;let d=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(y=>y.handler),f=async(y,k)=>{if(k){g(y);try{await k();}catch(C){console.error(`Export ${y} failed:`,C);}finally{g(null),n(false);}}};return jsxs("div",{ref:i,className:"relative",children:[jsxs(motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:t.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsx("div",{className:"py-1",children:d.map((y,k)=>jsxs(motion.button,{onClick:()=>f(y.id,y.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:k<d.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:k*.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===y.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-4 h-4"})}):y.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:y.label}),jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:y.description})]})]},y.id))})})})]})}function cf({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 Zs({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:c,onExportExcel:g,translations:i}){let p=r==="dark"?rf:of,d={...o==="es"?nf:sf,...i},f=n||c||g;return jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:p.bgGrid,borderColor:p.border},children:jsxs("div",{className:"flex items-center gap-3",children:[f&&jsxs(Fragment,{children:[jsx(df,{theme:p,t:d,onExportCSV:n,onExportJSON:c,onExportExcel:g}),t&&jsx("div",{className:"w-px h-6",style:{backgroundColor:p.borderLight}})]}),t&&(s?jsx(lf,{columns:e,onSelect:t,theme:p,t:d,createTaskLabel:a}):jsx(cf,{onClick:()=>t(),label:a||d.newTask}))]})})}function ei({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=useState(false),[c,g]=useState(""),i=useCallback(()=>{let f=c.trim();f&&(e(f),g(""),n(false));},[c,e]),p=useCallback(f=>{f.key==="Enter"?(f.preventDefault(),i()):f.key==="Escape"&&(g(""),n(false));},[i]),d=useCallback(()=>{setTimeout(()=>{c.trim()||n(false);},150);},[c]);return s?jsx("div",{className:l("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:f=>g(f.target.value),onKeyDown:p,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:()=>{g(""),n(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsx("div",{className:l("asakaa-add-column",t),children:jsxs("button",{onClick:()=>n(true),disabled:o,className:"asakaa-add-column__button",type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),r]})})}function ti({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:s,disabled:n=false,theme:c="dark",locale:g="es"}){let[i,p]=useState(false),[d,f]=useState(false),[y,k]=useState(""),[C,h]=useState([]),[b,u]=useState(""),[x,m]=useState(""),[N,w]=useState(""),[B,v]=useState(false),[I,A]=useState(false),[T,H]=useState(false),O=useRef(null),j=useRef(null),ae={placeholder:o||(g==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:s||(g==="es"?"Agregar Tarea":"Add Task"),save:g==="es"?"Guardar":"Save",addAssignee:g==="es"?"Agregar asignado":"Add assignee",addDates:g==="es"?"Agregar fechas":"Add dates",addPriority:g==="es"?"Agregar prioridad":"Add priority",startDate:g==="es"?"Inicio":"Start",endDate:g==="es"?"Fin":"End",low:g==="es"?"Baja":"Low",medium:g==="es"?"Media":"Medium",high:g==="es"?"Alta":"High",urgent:g==="es"?"Urgente":"Urgent"},ne=useCallback(()=>{k(""),h([]),u(""),m(""),w(""),v(false),A(false),H(false),p(false);},[]);useEffect(()=>{i&&O.current&&O.current.focus();},[i]),useEffect(()=>{if(!i)return;let M=R=>{j.current&&!j.current.contains(R.target)&&(y.trim()||ne());};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[i,y,ne]);let re=useCallback(async()=>{let M=y.trim();if(!(!M||d)){f(true);try{await t({name:M,columnId:e,assigneeIds:C.length>0?C:void 0,startDate:b?new Date(b):void 0,endDate:x?new Date(x):void 0,priority:N||void 0}),k(""),h([]),u(""),m(""),w(""),v(!1),A(!1),H(!1),O.current?.focus();}catch(R){console.error("Error creating card:",R);}finally{f(false);}}},[y,e,C,b,x,N,t,d]),ge=useCallback(M=>{M.key==="Enter"&&!M.shiftKey?(M.preventDefault(),re()):M.key==="Escape"&&ne();},[re,ne]),fe=useCallback(M=>{h(R=>R.includes(M)?R.filter(L=>L!==M):[...R,M]);},[]),Ie=c==="dark";return i?jsxs("div",{ref:j,className:l("rounded-lg overflow-hidden shadow-lg",Ie?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxs("div",{className:"p-3",children:[jsx("input",{ref:O,type:"text",value:y,onChange:M=>k(M.target.value),onKeyDown:ge,placeholder:ae.placeholder,disabled:d,className:l("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",Ie?"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:()=>v(!B),className:l("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",B||C.length>0?"bg-emerald-500/20 text-emerald-400":Ie?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:ae.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"})]}),C.length>0&&jsx("span",{className:"ml-0.5",children:C.length})]}),jsx("button",{onClick:()=>A(!I),className:l("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",I||b||x?"bg-blue-500/20 text-blue-400":Ie?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:ae.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(!T),className:l("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",T||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":Ie?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:ae.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:re,disabled:!y.trim()||d,className:l("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"}):ae.save})]})]}),B&&a.length>0&&jsx("div",{className:l("px-3 pb-3 pt-0","border-t",Ie?"border-[#3a3a4e]":"border-gray-200"),children:jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(M=>jsxs("button",{onClick:()=>fe(M.id),className:l("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",C.includes(M.id)?"bg-emerald-500 text-white":Ie?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[M.avatar?jsx("img",{src:M.avatar,alt:M.name,className:"w-4 h-4 rounded-full"}):jsx("div",{className:l("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",C.includes(M.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:M.name.charAt(0).toUpperCase()}),jsx("span",{children:M.name.split(" ")[0]})]},M.id))})}),I&&jsx("div",{className:l("px-3 pb-3 pt-0","border-t",Ie?"border-[#3a3a4e]":"border-gray-200"),children:jsxs("div",{className:"grid grid-cols-2 gap-2 pt-3",children:[jsxs("div",{children:[jsx("label",{className:l("block text-[10px] uppercase tracking-wide mb-1",Ie?"text-gray-500":"text-gray-400"),children:ae.startDate}),jsx("input",{type:"date",value:b,onChange:M=>u(M.target.value),className:l("w-full px-2 py-1.5 rounded text-xs border",Ie?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxs("div",{children:[jsx("label",{className:l("block text-[10px] uppercase tracking-wide mb-1",Ie?"text-gray-500":"text-gray-400"),children:ae.endDate}),jsx("input",{type:"date",value:x,onChange:M=>m(M.target.value),className:l("w-full px-2 py-1.5 rounded text-xs border",Ie?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),T&&jsx("div",{className:l("px-3 pb-3 pt-0","border-t",Ie?"border-[#3a3a4e]":"border-gray-200"),children:jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(M=>jsx("button",{onClick:()=>w(N===M?"":M),className:l("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",N===M?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[M]} text-white`:Ie?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:ae[M]},M))})})]}):jsxs("button",{onClick:()=>p(true),disabled:n,className:l("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",Ie?"hover:bg-[#2a2a3e]":"hover:bg-gray-100",n&&"opacity-50 cursor-not-allowed",r),type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),jsx("span",{className:"text-sm font-medium",children:ae.buttonLabel})]})}var qo=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(zr,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let o=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,o?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(o=>`"${o}"`).join(",")).join(`
|
|
5
|
+
`)}async exportToPDF(){throw new Error("PDF export not yet implemented in ViewAdapter")}async exportToPNG(){if(!this.container)throw new Error("View not mounted");let r=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((o,s)=>{r.toBlob(n=>{n?o(n):s(new Error("Failed to create PNG blob"));},"image/png");})}};function lc(e={}){return new qo(e)}var So=class extends Component{constructor(a){super(a);this.resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(a){return {hasError:true,error:a}}componentDidCatch(a,r){let{onError:o,componentName:s}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${s||"Component"}:`,a),console.error("Error Info:",r)),this.setState({errorInfo:r}),o)try{o(a,r);}catch(n){console.error("Error in error handler:",n);}}render(){let{hasError:a,error:r}=this.state,{children:o,fallback:s,componentName:n}=this.props;return a&&r?s?s(r,this.resetError):jsx("div",{className:"p-6 rounded-lg border",style:{background:"linear-gradient(135deg, #2d1b1b 0%, #1a1a1a 100%)",borderColor:"rgba(239, 68, 68, 0.3)"},children:jsxs("div",{className:"flex items-start gap-3",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"flex-shrink-0",children:[jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#EF4444",strokeWidth:"2"}),jsx("path",{d:"M12 8V12",stroke:"#EF4444",strokeWidth:"2",strokeLinecap:"round"}),jsx("circle",{cx:"12",cy:"16",r:"1",fill:"#EF4444"})]}),jsxs("div",{className:"flex-1",children:[jsx("h3",{className:"text-lg font-semibold text-red-400 mb-1",children:n?`Error in ${n}`:"Something went wrong"}),jsx("p",{className:"text-sm text-white/70 mb-3",children:r.message||"An unexpected error occurred"}),process.env.NODE_ENV==="development"&&jsxs("details",{className:"mb-3",children:[jsx("summary",{className:"text-xs text-white/50 cursor-pointer hover:text-white/70 mb-2",children:"Error Details (Development Only)"}),jsx("pre",{className:"text-xs text-white/60 bg-black/30 p-3 rounded overflow-auto max-h-48",children:r.stack})]}),jsx("button",{onClick:this.resetError,className:"px-4 py-2 rounded-lg text-sm font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#EF4444"},children:"Try Again"})]})]})}):o}};function ai(e,t){let a=r=>jsx(So,{...t,children:jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function oi({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:c,onOpenAIUsage:g,shortcut:i="k",className:p=""}){let[d,f]=useState(false),[y,k]=useState(""),[C,h]=useState("home"),[b,u]=useState(""),[x,m]=useState("");useEffect(()=>{let v=I=>{(I.metaKey||I.ctrlKey)&&I.key===i&&(I.preventDefault(),f(A=>!A)),I.key==="Escape"&&(f(false),h("home"),k(""));};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[i]),useEffect(()=>{d||(h("home"),k(""),u(""),m(""));},[d]);let N=useCallback(()=>{f(false);},[]),w=useCallback(v=>{let[I,A]=v.split(":");switch(I){case "create-card":h("create-card");break;case "create-card-in":u(A||"");break;case "navigate":A?(a?.(A),N()):h("navigate");break;case "search":r?.(y),N();break;case "priority":h("priority");break;case "set-priority":x&&A&&(o?.(x,A),N());break;case "assign":h("assign");break;case "assign-user":x&&A&&(s?.(x,A),N());break;case "ai":h("ai");break;case "ai-generate-plan":n?.(),N();break;case "ai-predict-risks":c?.(),N();break;case "ai-usage":g?.(),N();break;case "back":h("home");break;}},[y,x,t,a,r,o,s,n,c,g,N]),B=useCallback(()=>{b&&y.trim()&&(t?.(b,y.trim()),N());},[b,y,t,N]);return d?jsx(ht,{children:jsx("div",{className:"command-palette-overlay",onClick:N,children:jsx("div",{className:`command-palette ${p}`,onClick:v=>v.stopPropagation(),children:jsxs(Command,{value:y,onValueChange:k,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:C==="create-card"&&b?"Type card title and press Enter...":C==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:v=>{v.key==="Enter"&&C==="create-card"&&b&&B();}}),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."}),C==="home"&&jsxs(Fragment,{children:[jsxs(Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxs(Command.Item,{value:"create-card",onSelect:w,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:w,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:w,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:w,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),jsx("span",{children:"AI Commands"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsx(Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(v=>jsxs(Command.Item,{value:`navigate:${v.id}`,onSelect:w,className:"command-palette-item",children:[jsx("div",{className:"command-palette-item-dot",style:{background:v.priority==="URGENT"?"#EF4444":v.priority==="HIGH"?"#F59E0B":v.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsx("span",{children:v.title}),v.labels&&v.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:v.labels.slice(0,2).map(I=>jsx("span",{className:"command-palette-item-label",children:I},I))})]},v.id))})]}),C==="create-card"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:w,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsx(Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(v=>jsxs(Command.Item,{value:`create-card-in:${v.id}`,onSelect:w,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"})}),jsx("span",{children:v.title}),jsxs("div",{className:"command-palette-item-count",children:[v.cardIds.length," cards"]})]},v.id))})]}),C==="navigate"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:w,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsx(Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(v=>{let I=e.columns.find(A=>A.id===v.columnId);return jsxs(Command.Item,{value:`navigate:${v.id}`,onSelect:w,className:"command-palette-item",keywords:[v.title,v.description||"",...v.labels||[]],children:[jsx("div",{className:"command-palette-item-dot",style:{background:v.priority==="URGENT"?"#EF4444":v.priority==="HIGH"?"#F59E0B":v.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxs("div",{className:"command-palette-item-content",children:[jsx("div",{children:v.title}),jsx("div",{className:"command-palette-item-meta",children:I?.title})]}),v.labels&&v.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:v.labels.slice(0,2).map(A=>jsx("span",{className:"command-palette-item-label",children:A},A))})]},v.id)})})]}),C==="ai"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:w,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:w,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:w,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:w,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 mc(e,t,a,r,o){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let n=document.createElement("div");n.id="attachment-lightbox-native",n.className="attachment-lightbox",n.style.cssText=`
|
|
6
6
|
position: fixed !important;
|
|
7
7
|
inset: 0 !important;
|
|
8
8
|
z-index: 2147483647 !important;
|
|
@@ -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 g=document.createElement("div");g.className="attachment-lightbox-hint",g.textContent="Click anywhere or press ESC to close",g.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 i=()=>{n.remove(),document.removeEventListener("keydown",p);},p=
|
|
27
|
+
`;let i=()=>{n.remove(),document.removeEventListener("keydown",p);},p=d=>{if(d.key==="Escape")i();else if(d.key==="ArrowLeft"&&a.length>1){let f=r>0?r-1:a.length-1;i(),o(f);}else if(d.key==="ArrowRight"&&a.length>1){let f=r<a.length-1?r+1:0;i(),o(f);}};if(n.onclick=i,document.addEventListener("keydown",p),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,7 +34,7 @@ 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=k=>k.stopPropagation(),a.forEach((k,C)=>{let h=document.createElement("button");h.className=`attachment-lightbox-dot ${C===r?"active":""}`,h.style.cssText=`
|
|
38
38
|
width: 8px !important;
|
|
39
39
|
height: 8px !important;
|
|
40
40
|
border-radius: 50% !important;
|
|
@@ -42,7 +42,7 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
42
42
|
border: none !important;
|
|
43
43
|
padding: 0 !important;
|
|
44
44
|
cursor: pointer !important;
|
|
45
|
-
`,h.onclick=
|
|
45
|
+
`,h.onclick=b=>{b.stopPropagation(),i(),o(C);},d.appendChild(h);});let f=document.createElement("button");f.className="attachment-lightbox-nav-area attachment-lightbox-nav-prev",f.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>',f.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
|
+
`,f.onmouseenter=()=>{f.style.opacity="1";},f.onmouseleave=()=>{f.style.opacity="0.5";},f.onclick=k=>{k.stopPropagation();let C=r>0?r-1:a.length-1;i(),o(C);};let y=document.createElement("button");y.className="attachment-lightbox-nav-area attachment-lightbox-nav-next",y.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>',y.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
|
-
`,v.onmouseenter=()=>{v.style.opacity="1";},v.onmouseleave=()=>{v.style.opacity="0.5";},v.onclick=k=>{k.stopPropagation();let C=r<a.length-1?r+1:0;i(),o(C);},n.appendChild(l),n.appendChild(b),n.appendChild(v);}n.appendChild(m),n.appendChild(g),document.body.appendChild(n),setTimeout(()=>{g.style.transition="opacity 0.5s ease",g.style.opacity="0";},2e3);}function pf(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 uf(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 oi(e){return e.startsWith("image/")}function xr({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,m]=useState(false),[g,i]=useState(false),[p,l]=useState(null),b=useRef(null),v=useRef(e);v.current=e;let k=useCallback((y,I)=>{I.preventDefault(),I.stopPropagation();let P=v.current.filter(O=>oi(O.type)),T=P.findIndex(O=>O.id===y.id),W=O=>{let q=v.current.filter(ne=>oi(ne.type)),te=q[O];te&&dc(te.url,te.name,q,O,W);};dc(y.url,y.name,P,T,W);},[]),C=useCallback(y=>{let I=[],P=[];return e.length+y.length>s?(P.push(`Maximum ${s} files allowed`),{valid:I,errors:P}):(y.forEach(T=>{if(T.size/1048576>r){P.push(`${T.name} is too large (max ${r}MB)`);return}if(o&&!o.some(O=>T.type.match(O))){P.push(`${T.name} has invalid file type`);return}I.push(T);}),{valid:I,errors:P})},[e.length,s,r,o]),h=useCallback(async y=>{let{valid:I,errors:P}=C(y);if(P.length>0){l(P.join(", ")),setTimeout(()=>l(null),5e3);return}if(I.length!==0){i(true),l(null);try{await t?.(I);}catch(T){l(T instanceof Error?T.message:"Upload failed"),setTimeout(()=>l(null),5e3);}finally{i(false);}}},[C,t]),f=useCallback(y=>{y.preventDefault(),y.stopPropagation(),m(true);},[]),u=useCallback(y=>{y.preventDefault(),y.stopPropagation(),m(false);},[]),x=useCallback(y=>{y.preventDefault(),y.stopPropagation();},[]),c=useCallback(y=>{y.preventDefault(),y.stopPropagation(),m(false);let I=Array.from(y.dataTransfer.files);h(I);},[h]),N=useCallback(y=>{let I=y.target.files?Array.from(y.target.files):[];h(I),b.current&&(b.current.value="");},[h]),w=useCallback(()=>{b.current?.click();},[]),B=useCallback(y=>{confirm("Are you sure you want to delete this attachment?")&&a?.(y);},[a]);return jsxs("div",{className:"attachment-uploader",children:[jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${g?"uploading":""}`,onDragEnter:f,onDragLeave:u,onDragOver:x,onDrop:c,onClick:w,children:[jsx("input",{ref:b,type:"file",multiple:true,onChange:N,style:{display:"none"},accept:o?.join(",")}),jsx("div",{className:"attachment-dropzone-content",children:g?jsxs(Fragment,{children:[jsx("div",{className:"attachment-spinner"}),jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxs(Fragment,{children:[jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsx("p",{className:"attachment-dropzone-text",children:n?"Drop files here":"Drag & drop files here"}),jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),p&&jsxs("div",{className:"attachment-error",children:[jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsx("span",{className:"attachment-error-text",children:p})]}),e.length>0&&jsx("div",{className:"attachment-list",children:e.map(y=>jsxs("div",{className:"attachment-item",children:[jsx("div",{className:"attachment-preview",children:oi(y.type)&&y.url?jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:I=>k(y,I),title:"Click to view full size",children:[jsx("img",{src:y.thumbnailUrl||y.url,alt:y.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:uf(y.type)})}),jsxs("div",{className:"attachment-info",children:[jsx("a",{href:y.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:y.name,children:y.name}),jsxs("div",{className:"attachment-meta",children:[jsx("span",{className:"attachment-size",children:pf(y.size)}),jsx("span",{className:"attachment-separator",children:"\u2022"}),jsx("span",{className:"attachment-date",children:new Date(y.uploadedAt).toLocaleDateString()})]})]}),jsx("button",{onClick:()=>B(y.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"})})})]},y.id))})]})}function ni({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:m=[],aiInsights:g=[],attachments:i=[],onAddComment:p,onDeleteComment:l,onUploadAttachments:b,onDeleteAttachment:v,onSuggestAssignee:k,onGenerateSubtasks:C,onEstimateEffort:h,currentUserId:f="user-1"}){let[u,x]=useState("details"),[c,N]=useState(false),[w,B]=useState({}),[y,I]=useState(""),[P,T]=useState(false),[W,O]=useState({});if(!t||!e)return null;let q=useCallback(()=>{N(false),B({}),x("details"),I(""),O({}),a();},[a]),te=useCallback(()=>{r&&Object.keys(w).length>0&&(r(e.id,w),B({}),N(false));},[e.id,w,r]),ne=useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),q());},[e.id,o,q]),oe=useCallback(()=>{p&&y.trim()&&(p(e.id,y.trim()),I(""));},[e.id,y,p]),ce=useCallback(async()=>{if(k){T(true);try{let L=await k(e);O(j=>({...j,assignees:L}));}catch(L){console.error("Failed to suggest assignee:",L);}finally{T(false);}}},[e,k]),be=useCallback(async()=>{if(C){T(true);try{let L=await C(e);O(j=>({...j,subtasks:L}));}catch(L){console.error("Failed to generate subtasks:",L);}finally{T(false);}}},[e,C]),Le=useCallback(async()=>{if(h){T(true);try{let L=await h(e);O(j=>({...j,effort:L}));}catch(L){console.error("Failed to estimate effort:",L);}finally{T(false);}}},[e,h]),A={...e,...w},R=s.filter(L=>A.assignedUserIds?.includes(L.id));return jsx(ft,{children:jsx("div",{className:"card-detail-overlay",onClick:q,children:jsxs("div",{className:"card-detail-modal",onClick:L=>L.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:A.priority==="URGENT"?"#EF4444":A.priority==="HIGH"?"#F59E0B":A.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),c?jsx("input",{type:"text",value:w.title??A.title,onChange:L=>B({...w,title:L.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsx("h2",{className:"card-detail-title",children:A.title})]}),jsxs("div",{className:"card-detail-header-actions",children:[c?jsxs(Fragment,{children:[jsx("button",{onClick:te,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsx("button",{onClick:()=>{N(false),B({});},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:ne,className:"card-detail-btn card-detail-btn-danger",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]}),"Delete"]}),jsx("button",{onClick:q,className:"card-detail-btn-close",children:jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),jsxs("div",{className:"card-detail-tabs",children:[jsxs("button",{onClick:()=>x("details"),className:`card-detail-tab ${u==="details"?"active":""}`,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Details"]}),jsxs("button",{onClick:()=>x("comments"),className:`card-detail-tab ${u==="comments"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",n.length>0&&jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxs("button",{onClick:()=>x("activity"),className:`card-detail-tab ${u==="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",m.length>0&&jsx("span",{className:"card-detail-tab-badge",children:m.length})]}),jsxs("button",{onClick:()=>x("attachments"),className:`card-detail-tab ${u==="attachments"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",i.length>0&&jsx("span",{className:"card-detail-tab-badge",children:i.length})]}),jsxs("button",{onClick:()=>x("ai"),className:`card-detail-tab ${u==="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:[u==="details"&&jsxs("div",{className:"card-detail-details",children:[jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Description"}),c?jsx("textarea",{value:w.description??A.description??"",onChange:L=>B({...w,description:L.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsx("p",{className:"card-detail-text",children:A.description||"No description"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Assigned To"}),c?jsx("select",{multiple:true,value:w.assignedUserIds??A.assignedUserIds??[],onChange:L=>{let j=Array.from(L.target.selectedOptions,X=>X.value);B({...w,assignedUserIds:j});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(L=>jsx("option",{value:L.id,children:L.name},L.id))}):jsx("div",{className:"card-detail-users",children:R.length>0?R.map(L=>jsxs("div",{className:"card-detail-user",children:[jsx("div",{className:"card-detail-user-avatar",style:{background:L.color},children:L.initials}),jsx("span",{children:L.name})]},L.id)):jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Priority"}),c?jsxs("select",{value:w.priority??A.priority??"",onChange:L=>B({...w,priority:L.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:A.priority==="URGENT"?"#EF4444":A.priority==="HIGH"?"#F59E0B":A.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsx("span",{children:A.priority||"None"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Labels"}),jsx("div",{className:"card-detail-labels",children:A.labels&&A.labels.length>0?A.labels.map(L=>jsx("span",{className:"card-detail-label-tag",children:L},L)):jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxs("div",{className:"card-detail-section-row",children:[jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Start Date"}),c?jsx("input",{type:"date",value:w.startDate?new Date(w.startDate).toISOString().split("T")[0]:A.startDate?new Date(A.startDate).toISOString().split("T")[0]:"",onChange:L=>B({...w,startDate:L.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:A.startDate?new Date(A.startDate).toLocaleDateString():"Not set"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"End Date"}),c?jsx("input",{type:"date",value:w.endDate?new Date(w.endDate).toISOString().split("T")[0]:A.endDate?new Date(A.endDate).toISOString().split("T")[0]:"",onChange:L=>B({...w,endDate:L.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:A.endDate?new Date(A.endDate).toLocaleDateString():"Not set"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),c?jsx("input",{type:"number",min:"0",step:"0.5",value:w.estimatedTime??A.estimatedTime??"",onChange:L=>B({...w,estimatedTime:L.target.value?parseFloat(L.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsx("span",{className:"card-detail-text",children:A.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:A.dependencies&&A.dependencies.length>0?A.dependencies.map(L=>{let j=typeof L=="string"?L:L.taskId;return jsxs("span",{className:"card-detail-dependency",children:["Card #",j.slice(-4)]},j)}):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:A.createdAt?new Date(A.createdAt).toLocaleString():"Unknown"})]})]}),u==="comments"&&jsxs("div",{className:"card-detail-comments",children:[jsxs("div",{className:"card-detail-comment-form",children:[jsx("textarea",{value:y,onChange:L=>I(L.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsx("button",{onClick:oe,disabled:!y.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsx("div",{className:"card-detail-comments-list",children:n.length>0?n.map(L=>{let j=s.find(X=>X.id===L.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:[j&&jsx("div",{className:"card-detail-user-avatar",style:{background:j.color},children:j.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-comment-author-name",children:j?.name||"Unknown"}),jsx("div",{className:"card-detail-comment-time",children:new Date(L.createdAt).toLocaleString()})]})]}),l&&jsx("button",{onClick:()=>l(L.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:L.content})]},L.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"})]})})]}),u==="activity"&&jsx("div",{className:"card-detail-activity",children:m.length>0?jsx("div",{className:"card-detail-activity-list",children:m.map(L=>{let j=s.find(X=>X.id===L.userId);return jsxs("div",{className:"card-detail-activity-item",children:[jsxs("div",{className:"card-detail-activity-icon",children:[L.type.includes("CREATED")&&"\u2795",L.type.includes("UPDATED")&&"\u270F\uFE0F",L.type.includes("MOVED")&&"\u27A1\uFE0F",L.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",L.type.includes("COMMENT")&&"\u{1F4AC}",L.type.includes("ASSIGNED")&&"\u{1F464}",L.type.includes("PRIORITY")&&"\u{1F3AF}",L.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",L.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxs("div",{className:"card-detail-activity-content",children:[jsxs("div",{className:"card-detail-activity-text",children:[jsx("strong",{children:j?.name||"Unknown"})," ",L.type.replace(/_/g," ").toLowerCase(),L.newValue&&jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsx("strong",{children:L.newValue})]})]}),jsx("div",{className:"card-detail-activity-time",children:new Date(L.timestamp).toLocaleString()})]})]},L.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"})]})}),u==="attachments"&&jsx("div",{className:"card-detail-attachments",children:jsx(xr,{cardId:e.id,attachments:i,onUpload:b?L=>b(e.id,L):void 0,onDelete:v,currentUserId:f,maxSizeMB:10,maxFiles:20})}),u==="ai"&&jsxs("div",{className:"card-detail-ai",children:[jsxs("div",{className:"card-detail-ai-actions",children:[jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxs("button",{onClick:ce,disabled:P||!k,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:be,disabled:P||!C,className:"card-detail-ai-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("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:Le,disabled:P||!h,className:"card-detail-ai-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),W.assignees&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Assignee Suggestions"}),W.assignees.map((L,j)=>{let X=s.find(z=>z.id===L.userId);return jsxs("div",{className:"card-detail-ai-suggestion",children:[X&&jsx("div",{className:"card-detail-user-avatar",style:{background:X.color},children:X.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-ai-suggestion-name",children:X?.name}),jsx("div",{className:"card-detail-ai-suggestion-reason",children:L.reasoning}),jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(L.confidence*100).toFixed(0),"%"]})]})]},j)})]}),W.subtasks&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Suggested Subtasks"}),W.subtasks.map((L,j)=>jsxs("div",{className:"card-detail-ai-subtask",children:[jsx("div",{className:"card-detail-ai-subtask-title",children:L.title}),L.description&&jsx("div",{className:"card-detail-ai-subtask-desc",children:L.description}),L.estimatedTime&&jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",L.estimatedTime,"h"]})]},j))]}),W.effort&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Effort Estimate"}),jsxs("div",{className:"card-detail-ai-effort",children:[jsxs("div",{className:"card-detail-ai-effort-hours",children:[W.effort.hours," hours"]}),jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(W.effort.confidence*100).toFixed(0),"%"]})]})]}),g.length>0&&jsxs("div",{className:"card-detail-ai-insights",children:[jsx("h4",{children:"AI Insights"}),g.map(L=>jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${L.severity.toLowerCase()}`,children:[jsxs("div",{className:"card-detail-ai-insight-header",children:[jsx("span",{className:"card-detail-ai-insight-title",children:L.title}),jsx("span",{className:"card-detail-ai-insight-severity",children:L.severity})]}),jsx("p",{className:"card-detail-ai-insight-desc",children:L.description}),L.suggestedAction&&jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",L.suggestedAction]})]},L.id))]}),!W.assignees&&!W.subtasks&&!W.effort&&g.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 Xo({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[m,g]=useState({top:0,left:0}),i=useRef(null),p=useCallback(()=>{if(!e.current)return {top:0,left:0};let l=e.current.getBoundingClientRect(),b=window.innerHeight,v=window.innerWidth,k=4,C=l.left;C+o>v-10&&(C=v-o-10),C<10&&(C=10);let h=b-l.bottom,f=l.top,u;return h>=s+k?u=l.bottom+k:f>=s+k?u=l.top-s-k:h>=f?u=l.bottom+k:u=Math.max(10,l.top-s-k),{top:u,left:C}},[e,o,s]);return useEffect(()=>{t&&g(p());},[t,p]),useEffect(()=>{if(!t)return;let l=v=>{let k=v.target;i.current&&!i.current.contains(k)&&e.current&&!e.current.contains(k)&&a();},b=setTimeout(()=>{document.addEventListener("mousedown",l);},0);return ()=>{clearTimeout(b),document.removeEventListener("mousedown",l);}},[t,a,e]),useEffect(()=>{if(!t)return;let l=b=>{b.key==="Escape"&&(b.preventDefault(),b.stopPropagation(),a());};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,a]),t?jsx(ft,{children:jsx("div",{ref:i,className:`smart-popover ${n}`,style:{position:"fixed",top:`${m.top}px`,left:`${m.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 et={dark:{bgPrimary:"#1A1D21",bgSecondary:"#22262D",bgGrid:"#1E2126",bgWeekend:"rgba(59, 130, 246, 0.03)",border:"#334155",borderLight:"#2D3139",textPrimary:"#FFFFFF",textSecondary:"#CBD5E1",textTertiary:"#64748B",accent:"#3B82F6",accentHover:"#60A5FA",accentLight:"rgba(59, 130, 246, 0.12)",taskBarPrimary:"#3B82F6",taskBarProgress:"#2563EB",taskBarHandle:"#FFFFFF",dependency:"#9CA3AF",dependencyHover:"#6B7280",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.12)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.12)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.1)",statusTodo:"#64748B",statusInProgress:"#3B82F6",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.06)",focusRing:"#3B82F6"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(37, 99, 235, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#2563EB",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2563EB",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"#6B7280",dependencyHover:"#4B5563",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.1)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#64748B",statusInProgress:"#2563EB",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2563EB"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"#78716C",dependencyHover:"#57534E",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.06)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.08)",statusTodo:"#78716C",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.035)",focusRing:"#292524"}};var kf=["LOW","MEDIUM","HIGH","URGENT"],wf=["todo","in-progress","review","done"];function li({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:m=[],onAddComment:g,onDeleteComment:i,currentUser:p,onAIGenerateDescription:l,onAICreateSubtasks:b,onAIFindSimilar:v,availableColumns:k=[],availableLabels:C=[],availableTags:h=[],onCreateTag:f,onUploadCoverImage:u,unsplashAccessKey:x,theme:c,onSubtasksChange:N,attachments:w=[],onUploadAttachments:B,onDeleteAttachment:y}){let I=ko(),P=c||I?.themeName||"dark",[T,W]=useState(e),[O,q]=useState(false),[te,ne]=useState(e?.subtasks||[]),[oe,ce]=useState(false),[be,Le]=useState(""),[A,R]=useState(""),[L,j]=useState("all"),[X,z]=useState(false),[ve,se]=useState(false),[Ie,qe]=useState(false),[Qe,ie]=useState(false),[Xe,lt]=useState(false),[kt,yt]=useState(false),$=useRef(null),fe=useRef(null),Ae=useRef(null),G=useRef(null),ae=useRef(null),xe=useRef(null),Oe=useRef(null),ye=useRef(null),it=useRef(null),Ue=useRef(null),wt=useRef(null),ut=useRef(null);useEffect(()=>{e&&!T?(W({...e}),ne(e.subtasks||[])):e&&T&&e.id!==T.id&&(W({...e}),ne(e.subtasks||[]));},[e,T]),useEffect(()=>{let H=le=>{let He=le.target;G.current&&!G.current.contains(He)&&z(false),ae.current&&!ae.current.contains(He)&&se(false),xe.current&&!xe.current.contains(He)&&qe(false),Oe.current&&!Oe.current.contains(He)&&ie(false);};if(X||ve||Ie||Qe)return document.addEventListener("mousedown",H),()=>document.removeEventListener("mousedown",H)},[X,ve,Ie,Qe]),useEffect(()=>{if(!t)return;let H=le=>{let He=le.target,Ft=He.tagName==="INPUT"||He.tagName==="TEXTAREA"||He.isContentEditable;if(le.key==="Escape"){le.preventDefault(),X||ve||Ie||Qe||Xe||kt?(z(false),se(false),qe(false),ie(false),lt(false),yt(false)):Ft||a();return}if(Ft&&le.key!=="Escape")return;let rt=le.metaKey||le.ctrlKey;switch(le.key.toLowerCase()){case "s":le.preventDefault(),z(true);break;case "a":le.preventDefault(),qe(true);break;case "p":le.preventDefault(),se(true);break;case "l":le.preventDefault(),ie(true);break;case "d":rt||(le.preventDefault(),lt(true),setTimeout(()=>ye.current?.focus(),0));break;case "e":rt||(le.preventDefault(),yt(true));break;case "i":le.preventDefault(),q(true),setTimeout(()=>fe.current?.focus(),0);break;case "t":le.preventDefault(),ce(true);break;case "c":le.preventDefault(),Ae.current?.focus();break}};return window.addEventListener("keydown",H),()=>window.removeEventListener("keydown",H)},[t,a,X,ve,Ie,Qe,Xe,kt]);let Bt=useCallback(H=>{let le=H.currentTarget.textContent?.trim()||"";if(T&&le!==T.title){let He={...T,title:le};W(He),r?.(T.id,{title:le});}},[T,r]),jt=useCallback(H=>{H.key==="Enter"&&(H.preventDefault(),H.currentTarget.blur()),H.key==="Escape"&&(H.preventDefault(),H.currentTarget.textContent=T?.title||"",H.currentTarget.blur());},[T]),Se=useCallback(()=>{T&&e&&T.description!==e.description&&r?.(T.id,{description:T.description}),q(false);},[T,e,r]),Ve=useCallback(H=>{if(T){let le={...T,columnId:H};W(le),r?.(T.id,{columnId:H}),z(false);}},[T,r]),ua=useCallback(H=>{if(T){let le={...T,priority:H};W(le),r?.(T.id,{priority:H}),se(false);}},[T,r]),Ze=useCallback(H=>{if(T){let le=T.assignedUserIds||[],He=le.includes(H)?le.filter(rt=>rt!==H):[...le,H],Ft={...T,assignedUserIds:He};W(Ft),r?.(T.id,{assignedUserIds:He});}},[T,r]),Ke=useCallback(H=>{if(T){let le=T.labels||[],He=le.includes(H)?le.filter(rt=>rt!==H):[...le,H],Ft={...T,labels:He};W(Ft),r?.(T.id,{labels:He});}},[T,r]),F=useCallback(H=>{if(T){let le={...T,tags:H};W(le),r?.(T.id,{tags:H});}},[T,r]),Te=useCallback(H=>{if(T){let le=H.target.value,He={...T,endDate:le};W(He),r?.(T.id,{endDate:le}),lt(false);}},[T,r]),Z=useCallback(H=>{if(T){let le={...T,estimatedTime:parseFloat(H)||0};W(le),r?.(T.id,{estimatedTime:parseFloat(H)||0});}},[T,r]),ke=useCallback(()=>{if(be.trim()&&T){let H={id:`subtask-${Date.now()}`,title:be.trim(),completed:false,createdAt:new Date},le=[...te,H];ne(le),Le(""),ce(false),N?.(T.id,le);}},[be,te,T,N]),Ce=useCallback(H=>{let le=te.map(He=>He.id===H?{...He,completed:!He.completed,updatedAt:new Date}:He);ne(le),T&&N?.(T.id,le);},[te,T,N]),$e=useCallback(H=>{let le=te.filter(He=>He.id!==H);ne(le),T&&N?.(T.id,le);},[te,T,N]),Be=useCallback(()=>{A.trim()&&T&&g&&(g(T.id,A.trim()),R(""));},[A,T,g]),st=useCallback(H=>{(H.metaKey||H.ctrlKey)&&H.key==="Enter"&&(H.preventDefault(),Be());},[Be]),U=H=>jsx(yf,{remarkPlugins:[vf],rehypePlugins:[xf],components:{a:({node:le,...He})=>jsx("a",{...He,target:"_blank",rel:"noopener noreferrer"})},children:H}),Y=m.filter(H=>L==="comments"?H.type.includes("COMMENT"):L==="history"?!H.type.includes("COMMENT"):true);if(!t||!e)return null;let pe=T||e,_e=s.filter(H=>pe.assignedUserIds?.includes(H.id)),ze=te.filter(H=>H.completed).length;return jsx(ft,{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:H=>H.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":P,children:[jsxs("header",{className:"modal-v2-header",children:[jsx("h1",{id:"modal-title",ref:$,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:Bt,onKeyDown:jt,children:pe.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:G,children:[jsxs("button",{ref:it,className:"modal-v2-field",onClick:()=>z(!X),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M12 6v6l4 2"})]}),jsx("span",{children:"Status"}),jsx("kbd",{className:"modal-v2-shortcut",children:"S"})]}),jsx("div",{className:"modal-v2-field-value",children:pe.columnId||"No status"})]}),jsx(Xo,{triggerRef:it,isOpen:X,onClose:()=>z(false),width:250,estimatedHeight:200,children:(k.length>0?k:wf.map(H=>({id:H,title:H}))).map(H=>jsx("button",{className:`modal-v2-popover-item ${pe.columnId===H.id?"active":""}`,onClick:()=>Ve(H.id),children:H.title},H.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:xe,children:[jsxs("button",{ref:Ue,className:"modal-v2-field",onClick:()=>qe(!Ie),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsx("span",{children:"Assignees"}),jsx("kbd",{className:"modal-v2-shortcut",children:"A"})]}),jsx("div",{className:"modal-v2-field-value",children:_e.length>0?jsx("div",{className:"modal-v2-avatars",children:_e.map(H=>jsx("div",{className:"modal-v2-avatar",style:{background:H.color},title:H.name,children:H.initials},H.id))}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(Xo,{triggerRef:Ue,isOpen:Ie,onClose:()=>qe(false),width:280,estimatedHeight:300,children:s.map(H=>jsxs("button",{className:`modal-v2-popover-item ${pe.assignedUserIds?.includes(H.id)?"active":""}`,onClick:()=>Ze(H.id),children:[jsx("div",{className:"modal-v2-avatar-small",style:{background:H.color},children:H.initials}),H.name,pe.assignedUserIds?.includes(H.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"})})]},H.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:ae,children:[jsxs("button",{ref:wt,className:"modal-v2-field",onClick:()=>se(!ve),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsx("span",{children:"Priority"}),jsx("kbd",{className:"modal-v2-shortcut",children:"P"})]}),jsx("div",{className:"modal-v2-field-value",children:pe.priority||"None"})]}),jsxs(Xo,{triggerRef:wt,isOpen:ve,onClose:()=>se(false),width:180,estimatedHeight:220,children:[kf.map(H=>jsx("button",{className:`modal-v2-popover-item priority-${H.toLowerCase()} ${pe.priority===H?"active":""}`,onClick:()=>ua(H),children:H},H)),jsx("button",{className:"modal-v2-popover-item",onClick:()=>ua(""),children:"None"})]})]}),h.length>0||f?jsx("div",{className:"modal-v2-field-wrapper",children:jsxs("div",{className:"modal-v2-field",style:{cursor:"default"},children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsx("span",{children:"Etiquetas"})]}),jsx("div",{className:"modal-v2-field-value",children:jsx(br,{selectedTags:pe.tags||[],availableTags:h,onChange:F,onCreateTag:f,theme:et[P]||et.dark})})]})}):jsxs("div",{className:"modal-v2-field-wrapper",ref:Oe,children:[jsxs("button",{ref:ut,className:"modal-v2-field",onClick:()=>ie(!Qe),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsx("span",{children:"Labels"}),jsx("kbd",{className:"modal-v2-shortcut",children:"L"})]}),jsx("div",{className:"modal-v2-field-value",children:pe.labels&&pe.labels.length>0?jsx("span",{children:pe.labels.join(", ")}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(Xo,{triggerRef:ut,isOpen:Qe,onClose:()=>ie(false),width:220,estimatedHeight:200,children:(C.length>0?C:["Bug","Feature","Enhancement","Documentation"]).map(H=>jsxs("button",{className:`modal-v2-popover-item ${pe.labels?.includes(H)?"active":""}`,onClick:()=>Ke(H),children:[H,pe.labels?.includes(H)&&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"})})]},H))})]}),jsxs("button",{className:"modal-v2-field",onClick:()=>{lt(!Xe),setTimeout(()=>ye.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:pe.endDate?new Date(pe.endDate).toLocaleDateString():"Not set"}),jsx("input",{ref:ye,type:"date",value:typeof pe.endDate=="string"?pe.endDate.split("T")[0]:pe.endDate?(()=>{let H=new Date(pe.endDate),le=H.getUTCFullYear(),He=String(H.getUTCMonth()+1).padStart(2,"0"),Ft=String(H.getUTCDate()).padStart(2,"0");return `${le}-${He}-${Ft}`})():"",onChange:Te,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxs("button",{className:"modal-v2-field",onClick:()=>yt(!kt),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("polyline",{points:"12 6 12 12 16 14"})]}),jsx("span",{children:"Estimated Time"}),jsx("kbd",{className:"modal-v2-shortcut",children:"E"})]}),jsx("div",{className:"modal-v2-field-value",children:pe.estimatedTime?`${pe.estimatedTime}h`:"Not set"})]}),kt&&jsx("div",{className:"modal-v2-popover",children:jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:pe.estimatedTime||"",onChange:H=>Z(H.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>yt(false)})})]})]}),jsxs("section",{className:"modal-v2-section",children:[jsxs("div",{className:"modal-v2-section-header",children:[jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsx("polyline",{points:"10 9 9 9 8 9"})]}),jsx("h2",{children:"Description"})]}),O?jsx("textarea",{className:"modal-v2-textarea",value:pe.description||"",onChange:H=>{if(T){let le={...T,description:H.target.value};W(le);}},onBlur:Se,placeholder:"Add a detailed description...",autoFocus:true}):jsx("div",{className:"modal-v2-content",onClick:()=>q(true),children:pe.description?jsx("div",{className:"modal-v2-markdown",children:U(pe.description)}):jsxs("p",{className:"modal-v2-placeholder",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Add description..."]})})]}),jsxs("section",{className:"modal-v2-section",children:[jsxs("div",{className:"modal-v2-section-header",children:[jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M9 11l3 3L22 4"}),jsx("path",{d:"M21 12v7a2 2 0 01-2 2H5a2 2 0 01-2-2V5a2 2 0 012-2h11"})]}),jsx("h2",{children:"Subtasks"}),te.length>0&&jsxs("span",{className:"modal-v2-count",children:[ze,"/",te.length]}),jsxs("button",{className:"modal-v2-add-button",onClick:()=>ce(true),children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add"]})]}),jsxs("div",{className:"modal-v2-subtasks",children:[te.map(H=>jsxs("div",{className:`modal-v2-subtask ${H.completed?"completed":""}`,children:[jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>Ce(H.id),children:H.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:H.title}),jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>$e(H.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"})]})})]},H.id)),oe&&jsx("div",{className:"modal-v2-subtask-input-row",children:jsx("input",{type:"text",placeholder:"Subtask title...",value:be,onChange:H=>Le(H.target.value),onKeyDown:H=>{H.key==="Enter"&&ke(),H.key==="Escape"&&(ce(false),Le(""));},onBlur:ke,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(B||w.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"}),w.length>0&&jsx("span",{className:"modal-v2-count",children:w.length})]}),jsx(xr,{cardId:pe.id,attachments:w,onUpload:B?H=>B(pe.id,H):void 0,onDelete:y,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 ${L==="all"?"active":""}`,onClick:()=>j("all"),children:"All"}),jsx("button",{className:`modal-v2-filter ${L==="comments"?"active":""}`,onClick:()=>j("comments"),children:"Comments"}),jsx("button",{className:`modal-v2-filter ${L==="history"?"active":""}`,onClick:()=>j("history"),children:"History"})]})]}),jsxs("div",{className:"modal-v2-comment-input",children:[p&&jsx("div",{className:"modal-v2-avatar",style:{background:p.color},children:p.initials}),jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsx("textarea",{ref:Ae,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:A,onChange:H=>R(H.target.value),onKeyDown:st,rows:1}),jsxs("div",{className:"modal-v2-comment-toolbar",children:[jsxs("div",{className:"modal-v2-toolbar-left",children:[jsx("button",{className:"modal-v2-toolbar-button",title:"Attach file",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})})}),jsx("button",{className:"modal-v2-toolbar-button",title:"Mention user",children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"4"}),jsx("path",{d:"M16 8v5a3 3 0 006 0v-1a10 10 0 10-3.92 7.94"})]})}),jsx("button",{className:"modal-v2-toolbar-button",title:"Add emoji",children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M8 14s1.5 2 4 2 4-2 4-2"}),jsx("line",{x1:"9",y1:"9",x2:"9.01",y2:"9"}),jsx("line",{x1:"15",y1:"9",x2:"15.01",y2:"9"})]})})]}),jsx("button",{className:"modal-v2-send-button",onClick:Be,disabled:!A.trim(),children:"Send"})]})]})]}),jsxs("div",{className:"modal-v2-timeline",children:[Y.map(H=>{let le=s.find(Ft=>Ft.id===H.userId);if(H.type.includes("COMMENT")){let Ft=n.find(rt=>rt.id===H.metadata?.commentId);return Ft?jsxs("div",{className:"modal-v2-activity-item comment-item",children:[le&&jsx("div",{className:"modal-v2-avatar",style:{background:le.color},children:le.initials}),jsxs("div",{className:"modal-v2-activity-content",children:[jsxs("div",{className:"modal-v2-activity-header",children:[jsx("span",{className:"modal-v2-activity-user",children:le?.name||"Unknown"}),jsx("span",{className:"modal-v2-activity-time",children:new Date(H.timestamp).toLocaleString()})]}),jsx("div",{className:"modal-v2-comment-body",children:Ft.content})]})]},H.id):null}return jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxs("div",{className:"modal-v2-history-icon",children:[H.type.includes("CREATED")&&"\u2795",H.type.includes("UPDATED")&&"\u270F\uFE0F",H.type.includes("MOVED")&&"\u27A1\uFE0F",H.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",H.type.includes("ASSIGNED")&&"\u{1F464}",H.type.includes("PRIORITY")&&"\u{1F3AF}",H.type.includes("LABEL")&&"\u{1F3F7}\uFE0F"]}),jsxs("div",{className:"modal-v2-activity-content",children:[jsxs("div",{className:"modal-v2-history-text",children:[jsx("span",{className:"modal-v2-activity-user",children:le?.name||"Unknown"})," ",H.type.replace(/_/g," ").toLowerCase(),H.newValue&&jsxs(Fragment,{children:[" to ",jsx("strong",{children:H.newValue})]})]}),jsx("span",{className:"modal-v2-activity-time",children:new Date(H.timestamp).toLocaleString()})]})]},H.id)}),Y.length===0&&jsxs("div",{className:"modal-v2-empty",children:[jsx("p",{children:"No activity yet"}),jsx("span",{children:"Activity will appear here"})]})]})]})]})})})}function Af({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 ci({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(n=>({...n,average:n.average??e.reduce((m,g)=>m+g.completed,0)/e.length}));return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:a,children:jsxs(LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(Af,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),o&&jsx(Line,{type:"monotone",dataKey:"planned",stroke:"#3B82F6",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#3B82F6",r:4}}),r&&jsx(Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((n,m)=>n+m.completed,0)})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((n,m)=>n+m.completed,0)/e.length).toFixed(1)})]}),o&&e.some(n=>n.planned)&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:e.reduce((n,m)=>n+(m.planned||0),0)})]})]})]})}function zf({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 mi({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),n=e[e.length-1]?.remaining||0,m=e[e.length-1]?.ideal||0,g=s>0?(s-n)/s*100:0,i=n<=m;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(zf,{})}),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:g>=50?"#10B981":"#F59E0B"},children:[g.toFixed(0),"%"]})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsx("span",{className:"chart-stat-value",style:{color:i?"#10B981":"#EF4444"},children:n})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Status"}),jsx("span",{className:"chart-stat-badge",style:{background:i?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:i?"#10B981":"#EF4444"},children:i?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var qf={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},yc=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Xf({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,m=e+n*Math.cos(-a*(Math.PI/180)),g=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsx("text",{x:m,y:g,fill:"white",textAnchor:m>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function vc({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 pi({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((g,i)=>g+i.value,0),n=e.map(g=>({...g,totalValue:s,color:g.color||qf[g.name]||yc[e.indexOf(g)%yc.length]})),m=n.map(g=>g.color);return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxs(PieChart,{children:[jsx(Pie,{data:n,cx:"50%",cy:"50%",labelLine:false,label:o?Xf:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((g,i)=>jsx(Cell,{fill:m[i]},`cell-${i}`))}),jsx(Tooltip,{content:jsx(vc,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(g,i)=>{let p=i.payload,l=s>0?(p.value/s*100).toFixed(0):"0";return `${g} (${p.value} - ${l}%)`}})]}):jsxs(BarChart$1,{data:n,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(vc,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:n.map((g,i)=>jsx(Cell,{fill:m[i]},`cell-${i}`))})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:s})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Categories"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((g,i)=>i.value>g.value?i:g).name})]})]})]})}var Bn=memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,m]=useState(false),[g,i]=useState(false),[p,l]=useState(false),[b,v]=useState(false);if(e.length===0)return null;let k=e.map(c=>c.id),C=c=>{r.onBulkUpdate?.(k,{priority:c}),m(false);},h=c=>{r.onBulkMove?.(k,c),i(false),a();},f=c=>{r.onBulkUpdate?.(k,{assignedUserIds:c}),l(false);},u=c=>{let N=new Set;e.forEach(B=>{B.labels?.forEach(y=>N.add(y));});let w=Array.from(new Set([...N,...c]));r.onBulkUpdate?.(k,{labels:w}),v(false);},x=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(k),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:()=>m(!n),title:"Update priority",children:jsx("span",{className:"text-sm",children:"Priority"})}),n&&jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(c=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>C(c),children:[jsx("span",{className:d("asakaa-priority-dot",c==="LOW"&&"bg-asakaa-priority-low",c==="MEDIUM"&&"bg-asakaa-priority-medium",c==="HIGH"&&"bg-asakaa-priority-high",c==="URGENT"&&"bg-asakaa-priority-urgent")}),c]},c))})]}),o.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!g),title:"Move to column",children:jsx("span",{className:"text-sm",children:"Move"})}),g&&jsx("div",{className:"asakaa-bulk-menu",children:o.map(c=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h(c.id),children:c.title},c.id))})]}),t.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!p),title:"Assign users",children:jsx("span",{className:"text-sm",children:"Assign"})}),p&&jsx("div",{className:"asakaa-bulk-menu",children:t.map(c=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>f([c.id]),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:c.color},children:c.initials}),c.name]},c.id))})]}),s.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>v(!b),title:"Add labels",children:jsx("span",{className:"text-sm",children:"Labels"})}),b&&jsx("div",{className:"asakaa-bulk-menu",children:s.map(c=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>u([c]),children:c},c))})]}),jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:x,title:"Delete selected cards",children:jsx("span",{className:"text-sm",children:"Delete"})}),jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:a,title:"Clear selection",children:jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});Bn.displayName="BulkOperationsToolbar";function t0(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,m,g,i;switch(t){case "assignee":let p=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);p.length>0?p.forEach(v=>{let k=a?.find(C=>C.id===v);n=`assignee-${v}`,m=k?.name||`User ${v}`,g=k?.color,i=k?.avatar,r.has(n)||r.set(n,{id:n,title:m,groupValue:v,cardIds:[],color:g,icon:i}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",m="Unassigned",g="#6b7280",i="\u{1F464}",r.has(n)||r.set(n,{id:n,title:m,groupValue:null,cardIds:[],color:g,icon:i}),r.get(n).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",n=`priority-${s}`;let b={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];m=b.title,g=b.color,r.has(n)||r.set(n,{id:n,title:m,groupValue:s,cardIds:[],color:g}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(v=>{n=`label-${v}`,m=v,g="#6b7280",r.has(n)||r.set(n,{id:n,title:m,groupValue:v,cardIds:[],color:g}),r.get(n).cardIds.push(o.id);}):(n="label-none",m="No Labels",g="#6b7280",r.has(n)||r.set(n,{id:n,title:m,groupValue:null,cardIds:[],color:g}),r.get(n).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function ui({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=useState(new Set),m=useMemo(()=>t0(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),g=useCallback(i=>{n(p=>{let l=new Set(p);return l.has(i)?l.delete(i):l.add(i),l});},[]);return t.groupBy==="none"||m.length===0?jsx(Ur,{board:e,callbacks:r,availableUsers:a,className:o}):jsxs("div",{className:d("asakaa-swimlane-view",o),children:[m.map(i=>{let p=s.has(i.id),l=e.cards.filter(v=>i.cardIds.includes(v.id)),b={...e,cards:l};return jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&g(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":p?"Expand lane":"Collapse lane",children:p?"\u25B6":"\u25BC"})]}),!p&&jsx("div",{className:"asakaa-swimlane-content p-4",children:jsx(Ur,{board:b,callbacks:r,availableUsers:a})})]},i.id)}),m.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 gi=[{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 fi({value:e,onChange:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null),m=gi.find(i=>i.value===e)||gi[0];useEffect(()=>{function i(p){s.current&&!s.current.contains(p.target)&&n.current&&!n.current.contains(p.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let g=i=>{t(i),o(false);};return jsxs("div",{className:d("relative inline-block",a),children:[jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsx("span",{className:"text-base leading-none",children:m.icon}),jsx("span",{children:m.label}),jsx("svg",{className:d("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[280px] rounded-lg bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl border border-white/20 shadow-2xl z-50 overflow-hidden",children:[jsx("div",{className:"px-3 py-2 border-b border-white/10",children:jsx("span",{className:"text-[10px] font-bold text-white/70 uppercase tracking-wider",children:"Group By"})}),jsx("div",{className:"py-1",children:gi.map(i=>jsxs("button",{onClick:()=>g(i.value),className:d("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 Jo=[{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 o0(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(i=>e.key===i||e.code===i))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,n=o.shift?e.shiftKey:!e.shiftKey,m=o.alt?e.altKey:!e.altKey,g=o.meta?e.metaKey:true;return s&&n&&m&&g}function Tc(e={}){let{shortcuts:t=Jo,enabled:a=true,preventDefault:r=true}=e,o=useRef(t),s=useRef(a);useEffect(()=>{o.current=t,s.current=a;},[t,a]);let n=useCallback(g=>{o.current=[...o.current,g];},[]),m=useCallback(g=>{o.current=o.current.filter(i=>i.action!==g);},[]);return useEffect(()=>{function g(i){if(!s.current)return;let p=i.target;if(!((p.tagName==="INPUT"||p.tagName==="TEXTAREA"||p.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let l of o.current)if(o0(i,l)){r&&i.preventDefault();let b=new CustomEvent("keyboard-action",{detail:l.action,bubbles:true,cancelable:true});window.dispatchEvent(b);break}}}return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[r]),{registerShortcut:n,unregisterShortcut:m,isEnabled:a}}function s0(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function i0(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 l0(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=i0(e),r=t?s0(t):"";return a?`${a} + ${r}`:r}function d0(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 bi({shortcuts:e=Jo,isOpen:t,onClose:a,className:r}){let[o,s]=useState(false);if(useEffect(()=>{s(true);},[]),useEffect(()=>{function m(g){g.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[t,a]),!o||!t)return null;let n=d0(e);return jsxs("div",{className:d("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsx("div",{className:"absolute inset-0 backdrop-blur-sm bg-black/40 dark:bg-black/60",onClick:a}),jsxs("div",{className:"relative backdrop-blur-xl rounded-2xl border shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden bg-white dark:bg-gradient-to-br dark:from-gray-900/95 dark:to-gray-800/95 border-gray-200 dark:border-white/20",children:[jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between border-gray-200 dark:border-white/10",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold flex items-center gap-3 text-gray-900 dark:text-white",children:[jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsx("p",{className:"text-sm mt-1 text-gray-500 dark:text-white/60",children:"Speed up your workflow with these shortcuts"})]}),jsx("button",{onClick:a,className:"transition-colors text-2xl leading-none p-2 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:text-white/50 dark:hover:text-white dark:hover:bg-white/10","aria-label":"Close",children:"\xD7"})]}),jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(n).map(([m,g])=>g.length===0?null:jsxs("div",{children:[jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white/90",children:[jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),m]}),jsx("div",{className:"space-y-3",children:g.map(i=>jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg transition-colors bg-gray-50 hover:bg-gray-100 dark:bg-white/5 dark:hover:bg-white/10",children:[jsx("span",{className:"text-sm text-gray-700 dark:text-white/80",children:i.description}),jsx("kbd",{className:"px-3 py-1.5 border rounded-md text-xs font-mono shadow-sm whitespace-nowrap bg-white border-gray-300 text-gray-800 dark:bg-gradient-to-br dark:from-gray-700 dark:to-gray-800 dark:border-white/20 dark:text-white/90",children:l0(i)})]},i.action))})]},m))})}),jsx("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/5",children:jsxs("p",{className:"text-xs text-center text-gray-500 dark:text-white/50",children:["Press ",jsx("kbd",{className:"px-2 py-0.5 rounded bg-gray-200 text-gray-600 dark:bg-white/10 dark:text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var hi=[{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
|
+
`,y.onmouseenter=()=>{y.style.opacity="1";},y.onmouseleave=()=>{y.style.opacity="0.5";},y.onclick=k=>{k.stopPropagation();let C=r<a.length-1?r+1:0;i(),o(C);},n.appendChild(d),n.appendChild(f),n.appendChild(y);}n.appendChild(c),n.appendChild(g),document.body.appendChild(n),setTimeout(()=>{g.style.transition="opacity 0.5s ease",g.style.opacity="0";},2e3);}function bf(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 hf(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 si(e){return e.startsWith("image/")}function wr({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,c]=useState(false),[g,i]=useState(false),[p,d]=useState(null),f=useRef(null),y=useRef(e);y.current=e;let k=useCallback((v,I)=>{I.preventDefault(),I.stopPropagation();let A=y.current.filter(O=>si(O.type)),T=A.findIndex(O=>O.id===v.id),H=O=>{let j=y.current.filter(ne=>si(ne.type)),ae=j[O];ae&&mc(ae.url,ae.name,j,O,H);};mc(v.url,v.name,A,T,H);},[]),C=useCallback(v=>{let I=[],A=[];return e.length+v.length>s?(A.push(`Maximum ${s} files allowed`),{valid:I,errors:A}):(v.forEach(T=>{if(T.size/1048576>r){A.push(`${T.name} is too large (max ${r}MB)`);return}if(o&&!o.some(O=>T.type.match(O))){A.push(`${T.name} has invalid file type`);return}I.push(T);}),{valid:I,errors:A})},[e.length,s,r,o]),h=useCallback(async v=>{let{valid:I,errors:A}=C(v);if(A.length>0){d(A.join(", ")),setTimeout(()=>d(null),5e3);return}if(I.length!==0){i(true),d(null);try{await t?.(I);}catch(T){d(T instanceof Error?T.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{i(false);}}},[C,t]),b=useCallback(v=>{v.preventDefault(),v.stopPropagation(),c(true);},[]),u=useCallback(v=>{v.preventDefault(),v.stopPropagation(),c(false);},[]),x=useCallback(v=>{v.preventDefault(),v.stopPropagation();},[]),m=useCallback(v=>{v.preventDefault(),v.stopPropagation(),c(false);let I=Array.from(v.dataTransfer.files);h(I);},[h]),N=useCallback(v=>{let I=v.target.files?Array.from(v.target.files):[];h(I),f.current&&(f.current.value="");},[h]),w=useCallback(()=>{f.current?.click();},[]),B=useCallback(v=>{confirm("Are you sure you want to delete this attachment?")&&a?.(v);},[a]);return jsxs("div",{className:"attachment-uploader",children:[jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${g?"uploading":""}`,onDragEnter:b,onDragLeave:u,onDragOver:x,onDrop:m,onClick:w,children:[jsx("input",{ref:f,type:"file",multiple:true,onChange:N,style:{display:"none"},accept:o?.join(",")}),jsx("div",{className:"attachment-dropzone-content",children:g?jsxs(Fragment,{children:[jsx("div",{className:"attachment-spinner"}),jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxs(Fragment,{children:[jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsx("p",{className:"attachment-dropzone-text",children:n?"Drop files here":"Drag & drop files here"}),jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),p&&jsxs("div",{className:"attachment-error",children:[jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsx("span",{className:"attachment-error-text",children:p})]}),e.length>0&&jsx("div",{className:"attachment-list",children:e.map(v=>jsxs("div",{className:"attachment-item",children:[jsx("div",{className:"attachment-preview",children:si(v.type)&&v.url?jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:I=>k(v,I),title:"Click to view full size",children:[jsx("img",{src:v.thumbnailUrl||v.url,alt:v.name,className:"attachment-thumbnail"}),jsx("div",{className:"attachment-thumbnail-overlay",children:jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M9 21H3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M21 3L14 10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M3 21L10 14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})]}):jsx("div",{className:"attachment-icon",children:hf(v.type)})}),jsxs("div",{className:"attachment-info",children:[jsx("a",{href:v.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:v.name,children:v.name}),jsxs("div",{className:"attachment-meta",children:[jsx("span",{className:"attachment-size",children:bf(v.size)}),jsx("span",{className:"attachment-separator",children:"\u2022"}),jsx("span",{className:"attachment-date",children:new Date(v.uploadedAt).toLocaleDateString()})]})]}),jsx("button",{onClick:()=>B(v.id),className:"attachment-delete",title:"Delete attachment",type:"button",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},v.id))})]})}function ii({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:c=[],aiInsights:g=[],attachments:i=[],onAddComment:p,onDeleteComment:d,onUploadAttachments:f,onDeleteAttachment:y,onSuggestAssignee:k,onGenerateSubtasks:C,onEstimateEffort:h,currentUserId:b="user-1"}){let[u,x]=useState("details"),[m,N]=useState(false),[w,B]=useState({}),[v,I]=useState(""),[A,T]=useState(false),[H,O]=useState({});if(!t||!e)return null;let j=useCallback(()=>{N(false),B({}),x("details"),I(""),O({}),a();},[a]),ae=useCallback(()=>{r&&Object.keys(w).length>0&&(r(e.id,w),B({}),N(false));},[e.id,w,r]),ne=useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),j());},[e.id,o,j]),re=useCallback(()=>{p&&v.trim()&&(p(e.id,v.trim()),I(""));},[e.id,v,p]),ge=useCallback(async()=>{if(k){T(true);try{let L=await k(e);O(V=>({...V,assignees:L}));}catch(L){console.error("Failed to suggest assignee:",L);}finally{T(false);}}},[e,k]),fe=useCallback(async()=>{if(C){T(true);try{let L=await C(e);O(V=>({...V,subtasks:L}));}catch(L){console.error("Failed to generate subtasks:",L);}finally{T(false);}}},[e,C]),Ie=useCallback(async()=>{if(h){T(true);try{let L=await h(e);O(V=>({...V,effort:L}));}catch(L){console.error("Failed to estimate effort:",L);}finally{T(false);}}},[e,h]),M={...e,...w},R=s.filter(L=>M.assignedUserIds?.includes(L.id));return jsx(ht,{children:jsx("div",{className:"card-detail-overlay",onClick:j,children:jsxs("div",{className:"card-detail-modal",onClick:L=>L.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:M.priority==="URGENT"?"#EF4444":M.priority==="HIGH"?"#F59E0B":M.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),m?jsx("input",{type:"text",value:w.title??M.title,onChange:L=>B({...w,title:L.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsx("h2",{className:"card-detail-title",children:M.title})]}),jsxs("div",{className:"card-detail-header-actions",children:[m?jsxs(Fragment,{children:[jsx("button",{onClick:ae,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsx("button",{onClick:()=>{N(false),B({});},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:ne,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:()=>x("details"),className:`card-detail-tab ${u==="details"?"active":""}`,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Details"]}),jsxs("button",{onClick:()=>x("comments"),className:`card-detail-tab ${u==="comments"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",n.length>0&&jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxs("button",{onClick:()=>x("activity"),className:`card-detail-tab ${u==="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:()=>x("attachments"),className:`card-detail-tab ${u==="attachments"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",i.length>0&&jsx("span",{className:"card-detail-tab-badge",children:i.length})]}),jsxs("button",{onClick:()=>x("ai"),className:`card-detail-tab ${u==="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:[u==="details"&&jsxs("div",{className:"card-detail-details",children:[jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Description"}),m?jsx("textarea",{value:w.description??M.description??"",onChange:L=>B({...w,description:L.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsx("p",{className:"card-detail-text",children:M.description||"No description"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Assigned To"}),m?jsx("select",{multiple:true,value:w.assignedUserIds??M.assignedUserIds??[],onChange:L=>{let V=Array.from(L.target.selectedOptions,q=>q.value);B({...w,assignedUserIds:V});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(L=>jsx("option",{value:L.id,children:L.name},L.id))}):jsx("div",{className:"card-detail-users",children:R.length>0?R.map(L=>jsxs("div",{className:"card-detail-user",children:[jsx("div",{className:"card-detail-user-avatar",style:{background:L.color},children:L.initials}),jsx("span",{children:L.name})]},L.id)):jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Priority"}),m?jsxs("select",{value:w.priority??M.priority??"",onChange:L=>B({...w,priority:L.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:M.priority==="URGENT"?"#EF4444":M.priority==="HIGH"?"#F59E0B":M.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsx("span",{children:M.priority||"None"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Labels"}),jsx("div",{className:"card-detail-labels",children:M.labels&&M.labels.length>0?M.labels.map(L=>jsx("span",{className:"card-detail-label-tag",children:L},L)):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"}),m?jsx("input",{type:"date",value:w.startDate?new Date(w.startDate).toISOString().split("T")[0]:M.startDate?new Date(M.startDate).toISOString().split("T")[0]:"",onChange:L=>B({...w,startDate:L.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:M.startDate?new Date(M.startDate).toLocaleDateString():"Not set"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"End Date"}),m?jsx("input",{type:"date",value:w.endDate?new Date(w.endDate).toISOString().split("T")[0]:M.endDate?new Date(M.endDate).toISOString().split("T")[0]:"",onChange:L=>B({...w,endDate:L.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:M.endDate?new Date(M.endDate).toLocaleDateString():"Not set"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),m?jsx("input",{type:"number",min:"0",step:"0.5",value:w.estimatedTime??M.estimatedTime??"",onChange:L=>B({...w,estimatedTime:L.target.value?parseFloat(L.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsx("span",{className:"card-detail-text",children:M.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:M.dependencies&&M.dependencies.length>0?M.dependencies.map(L=>{let V=typeof L=="string"?L:L.taskId;return jsxs("span",{className:"card-detail-dependency",children:["Card #",V.slice(-4)]},V)}):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:M.createdAt?new Date(M.createdAt).toLocaleString():"Unknown"})]})]}),u==="comments"&&jsxs("div",{className:"card-detail-comments",children:[jsxs("div",{className:"card-detail-comment-form",children:[jsx("textarea",{value:v,onChange:L=>I(L.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsx("button",{onClick:re,disabled:!v.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsx("div",{className:"card-detail-comments-list",children:n.length>0?n.map(L=>{let V=s.find(q=>q.id===L.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:[V&&jsx("div",{className:"card-detail-user-avatar",style:{background:V.color},children:V.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-comment-author-name",children:V?.name||"Unknown"}),jsx("div",{className:"card-detail-comment-time",children:new Date(L.createdAt).toLocaleString()})]})]}),d&&jsx("button",{onClick:()=>d(L.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:L.content})]},L.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"})]})})]}),u==="activity"&&jsx("div",{className:"card-detail-activity",children:c.length>0?jsx("div",{className:"card-detail-activity-list",children:c.map(L=>{let V=s.find(q=>q.id===L.userId);return jsxs("div",{className:"card-detail-activity-item",children:[jsxs("div",{className:"card-detail-activity-icon",children:[L.type.includes("CREATED")&&"\u2795",L.type.includes("UPDATED")&&"\u270F\uFE0F",L.type.includes("MOVED")&&"\u27A1\uFE0F",L.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",L.type.includes("COMMENT")&&"\u{1F4AC}",L.type.includes("ASSIGNED")&&"\u{1F464}",L.type.includes("PRIORITY")&&"\u{1F3AF}",L.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",L.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxs("div",{className:"card-detail-activity-content",children:[jsxs("div",{className:"card-detail-activity-text",children:[jsx("strong",{children:V?.name||"Unknown"})," ",L.type.replace(/_/g," ").toLowerCase(),L.newValue&&jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsx("strong",{children:L.newValue})]})]}),jsx("div",{className:"card-detail-activity-time",children:new Date(L.timestamp).toLocaleString()})]})]},L.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"})]})}),u==="attachments"&&jsx("div",{className:"card-detail-attachments",children:jsx(wr,{cardId:e.id,attachments:i,onUpload:f?L=>f(e.id,L):void 0,onDelete:y,currentUserId:b,maxSizeMB:10,maxFiles:20})}),u==="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:ge,disabled:A||!k,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:fe,disabled:A||!C,className:"card-detail-ai-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("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:Ie,disabled:A||!h,className:"card-detail-ai-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),H.assignees&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Assignee Suggestions"}),H.assignees.map((L,V)=>{let q=s.find(z=>z.id===L.userId);return jsxs("div",{className:"card-detail-ai-suggestion",children:[q&&jsx("div",{className:"card-detail-user-avatar",style:{background:q.color},children:q.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-ai-suggestion-name",children:q?.name}),jsx("div",{className:"card-detail-ai-suggestion-reason",children:L.reasoning}),jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(L.confidence*100).toFixed(0),"%"]})]})]},V)})]}),H.subtasks&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Suggested Subtasks"}),H.subtasks.map((L,V)=>jsxs("div",{className:"card-detail-ai-subtask",children:[jsx("div",{className:"card-detail-ai-subtask-title",children:L.title}),L.description&&jsx("div",{className:"card-detail-ai-subtask-desc",children:L.description}),L.estimatedTime&&jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",L.estimatedTime,"h"]})]},V))]}),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),"%"]})]})]}),g.length>0&&jsxs("div",{className:"card-detail-ai-insights",children:[jsx("h4",{children:"AI Insights"}),g.map(L=>jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${L.severity.toLowerCase()}`,children:[jsxs("div",{className:"card-detail-ai-insight-header",children:[jsx("span",{className:"card-detail-ai-insight-title",children:L.title}),jsx("span",{className:"card-detail-ai-insight-severity",children:L.severity})]}),jsx("p",{className:"card-detail-ai-insight-desc",children:L.description}),L.suggestedAction&&jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",L.suggestedAction]})]},L.id))]}),!H.assignees&&!H.subtasks&&!H.effort&&g.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 Jo({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[c,g]=useState({top:0,left:0}),i=useRef(null),p=useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),f=window.innerHeight,y=window.innerWidth,k=4,C=d.left;C+o>y-10&&(C=y-o-10),C<10&&(C=10);let h=f-d.bottom,b=d.top,u;return h>=s+k?u=d.bottom+k:b>=s+k?u=d.top-s-k:h>=b?u=d.bottom+k:u=Math.max(10,d.top-s-k),{top:u,left:C}},[e,o,s]);return useEffect(()=>{t&&g(p());},[t,p]),useEffect(()=>{if(!t)return;let d=y=>{let k=y.target;i.current&&!i.current.contains(k)&&e.current&&!e.current.contains(k)&&a();},f=setTimeout(()=>{document.addEventListener("mousedown",d);},0);return ()=>{clearTimeout(f),document.removeEventListener("mousedown",d);}},[t,a,e]),useEffect(()=>{if(!t)return;let d=f=>{f.key==="Escape"&&(f.preventDefault(),f.stopPropagation(),a());};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),t?jsx(ht,{children:jsx("div",{ref:i,className:`smart-popover ${n}`,style:{position:"fixed",top:`${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 rt={dark:{bgPrimary:"#1A1D21",bgSecondary:"#22262D",bgGrid:"#1E2126",bgWeekend:"rgba(59, 130, 246, 0.03)",border:"#334155",borderLight:"#2D3139",textPrimary:"#FFFFFF",textSecondary:"#CBD5E1",textTertiary:"#64748B",accent:"#3B82F6",accentHover:"#60A5FA",accentLight:"rgba(59, 130, 246, 0.12)",taskBarPrimary:"#3B82F6",taskBarProgress:"#2563EB",taskBarHandle:"#FFFFFF",dependency:"#9CA3AF",dependencyHover:"#6B7280",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.12)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.12)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.1)",statusTodo:"#64748B",statusInProgress:"#3B82F6",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.06)",focusRing:"#3B82F6"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(37, 99, 235, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#2563EB",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2563EB",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"#6B7280",dependencyHover:"#4B5563",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.1)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#64748B",statusInProgress:"#2563EB",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2563EB"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"#78716C",dependencyHover:"#57534E",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.06)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.08)",statusTodo:"#78716C",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.035)",focusRing:"#292524"}};var Nf=["LOW","MEDIUM","HIGH","URGENT"],Df=["todo","in-progress","review","done"];function ci({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:c=[],onAddComment:g,onDeleteComment:i,currentUser:p,onAIGenerateDescription:d,onAICreateSubtasks:f,onAIFindSimilar:y,availableColumns:k=[],availableLabels:C=[],availableTags:h=[],onCreateTag:b,onUploadCoverImage:u,unsplashAccessKey:x,theme:m,onSubtasksChange:N,attachments:w=[],onUploadAttachments:B,onDeleteAttachment:v}){let I=wo(),A=m||I?.themeName||"dark",[T,H]=useState(e),[O,j]=useState(false),[ae,ne]=useState(e?.subtasks||[]),[re,ge]=useState(false),[fe,Ie]=useState(""),[M,R]=useState(""),[L,V]=useState("all"),[q,z]=useState(false),[ye,se]=useState(false),[Be,Ye]=useState(false),[tt,ie]=useState(false),[Je,mt]=useState(false),[Ct,xt]=useState(false),$=useRef(null),be=useRef(null),Pe=useRef(null),Me=useRef(null),je=useRef(null),Ze=useRef(null),Pt=useRef(null),Le=useRef(null),J=useRef(null),ve=useRef(null),Ue=useRef(null),Fe=useRef(null);useEffect(()=>{e&&!T?(H({...e}),ne(e.subtasks||[])):e&&T&&e.id!==T.id&&(H({...e}),ne(e.subtasks||[]));},[e,T]),useEffect(()=>{let W=le=>{let We=le.target;Me.current&&!Me.current.contains(We)&&z(false),je.current&&!je.current.contains(We)&&se(false),Ze.current&&!Ze.current.contains(We)&&Ye(false),Pt.current&&!Pt.current.contains(We)&&ie(false);};if(q||ye||Be||tt)return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[q,ye,Be,tt]),useEffect(()=>{if(!t)return;let W=le=>{let We=le.target,It=We.tagName==="INPUT"||We.tagName==="TEXTAREA"||We.isContentEditable;if(le.key==="Escape"){le.preventDefault(),q||ye||Be||tt||Je||Ct?(z(false),se(false),Ye(false),ie(false),mt(false),xt(false)):It||a();return}if(It&&le.key!=="Escape")return;let st=le.metaKey||le.ctrlKey;switch(le.key.toLowerCase()){case "s":le.preventDefault(),z(true);break;case "a":le.preventDefault(),Ye(true);break;case "p":le.preventDefault(),se(true);break;case "l":le.preventDefault(),ie(true);break;case "d":st||(le.preventDefault(),mt(true),setTimeout(()=>Le.current?.focus(),0));break;case "e":st||(le.preventDefault(),xt(true));break;case "i":le.preventDefault(),j(true),setTimeout(()=>be.current?.focus(),0);break;case "t":le.preventDefault(),ge(true);break;case "c":le.preventDefault(),Pe.current?.focus();break}};return window.addEventListener("keydown",W),()=>window.removeEventListener("keydown",W)},[t,a,q,ye,Be,tt,Je,Ct]);let at=useCallback(W=>{let le=W.currentTarget.textContent?.trim()||"";if(T&&le!==T.title){let We={...T,title:le};H(We),r?.(T.id,{title:le});}},[T,r]),ct=useCallback(W=>{W.key==="Enter"&&(W.preventDefault(),W.currentTarget.blur()),W.key==="Escape"&&(W.preventDefault(),W.currentTarget.textContent=T?.title||"",W.currentTarget.blur());},[T]),te=useCallback(()=>{T&&e&&T.description!==e.description&&r?.(T.id,{description:T.description}),j(false);},[T,e,r]),$e=useCallback(W=>{if(T){let le={...T,columnId:W};H(le),r?.(T.id,{columnId:W}),z(false);}},[T,r]),Kt=useCallback(W=>{if(T){let le={...T,priority:W};H(le),r?.(T.id,{priority:W}),se(false);}},[T,r]),Qe=useCallback(W=>{if(T){let le=T.assignedUserIds||[],We=le.includes(W)?le.filter(st=>st!==W):[...le,W],It={...T,assignedUserIds:We};H(It),r?.(T.id,{assignedUserIds:We});}},[T,r]),Ke=useCallback(W=>{if(T){let le=T.labels||[],We=le.includes(W)?le.filter(st=>st!==W):[...le,W],It={...T,labels:We};H(It),r?.(T.id,{labels:We});}},[T,r]),F=useCallback(W=>{if(T){let le={...T,tags:W};H(le),r?.(T.id,{tags:W});}},[T,r]),Ce=useCallback(W=>{if(T){let le=W.target.value,We={...T,endDate:le};H(We),r?.(T.id,{endDate:le}),mt(false);}},[T,r]),Z=useCallback(W=>{if(T){let le={...T,estimatedTime:parseFloat(W)||0};H(le),r?.(T.id,{estimatedTime:parseFloat(W)||0});}},[T,r]),xe=useCallback(()=>{if(fe.trim()&&T){let W={id:`subtask-${Date.now()}`,title:fe.trim(),completed:false,createdAt:new Date},le=[...ae,W];ne(le),Ie(""),ge(false),N?.(T.id,le);}},[fe,ae,T,N]),we=useCallback(W=>{let le=ae.map(We=>We.id===W?{...We,completed:!We.completed,updatedAt:new Date}:We);ne(le),T&&N?.(T.id,le);},[ae,T,N]),ze=useCallback(W=>{let le=ae.filter(We=>We.id!==W);ne(le),T&&N?.(T.id,le);},[ae,T,N]),Re=useCallback(()=>{M.trim()&&T&&g&&(g(T.id,M.trim()),R(""));},[M,T,g]),dt=useCallback(W=>{(W.metaKey||W.ctrlKey)&&W.key==="Enter"&&(W.preventDefault(),Re());},[Re]),U=W=>jsx(wf,{remarkPlugins:[Cf],rehypePlugins:[Tf],components:{a:({node:le,...We})=>jsx("a",{...We,target:"_blank",rel:"noopener noreferrer"})},children:W}),Y=c.filter(W=>L==="comments"?W.type.includes("COMMENT"):L==="history"?!W.type.includes("COMMENT"):true);if(!t||!e)return null;let me=T||e,Ve=s.filter(W=>me.assignedUserIds?.includes(W.id)),He=ae.filter(W=>W.completed).length;return jsx(ht,{children:jsx("div",{className:"modal-v2-backdrop",onClick:a,style:{position:"fixed",inset:"0",zIndex:9999,background:"rgba(0, 0, 0, 0.7)",display:"flex",alignItems:"center",justifyContent:"center"},children:jsxs("div",{className:"modal-v2-container",onClick:W=>W.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":A,children:[jsxs("header",{className:"modal-v2-header",children:[jsx("h1",{id:"modal-title",ref:$,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:at,onKeyDown:ct,children:me.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:Me,children:[jsxs("button",{ref:J,className:"modal-v2-field",onClick:()=>z(!q),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M12 6v6l4 2"})]}),jsx("span",{children:"Status"}),jsx("kbd",{className:"modal-v2-shortcut",children:"S"})]}),jsx("div",{className:"modal-v2-field-value",children:me.columnId||"No status"})]}),jsx(Jo,{triggerRef:J,isOpen:q,onClose:()=>z(false),width:250,estimatedHeight:200,children:(k.length>0?k:Df.map(W=>({id:W,title:W}))).map(W=>jsx("button",{className:`modal-v2-popover-item ${me.columnId===W.id?"active":""}`,onClick:()=>$e(W.id),children:W.title},W.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:Ze,children:[jsxs("button",{ref:ve,className:"modal-v2-field",onClick:()=>Ye(!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:Ve.length>0?jsx("div",{className:"modal-v2-avatars",children:Ve.map(W=>jsx("div",{className:"modal-v2-avatar",style:{background:W.color},title:W.name,children:W.initials},W.id))}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(Jo,{triggerRef:ve,isOpen:Be,onClose:()=>Ye(false),width:280,estimatedHeight:300,children:s.map(W=>jsxs("button",{className:`modal-v2-popover-item ${me.assignedUserIds?.includes(W.id)?"active":""}`,onClick:()=>Qe(W.id),children:[jsx("div",{className:"modal-v2-avatar-small",style:{background:W.color},children:W.initials}),W.name,me.assignedUserIds?.includes(W.id)&&jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsx("polyline",{points:"20 6 9 17 4 12"})})]},W.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:je,children:[jsxs("button",{ref:Ue,className:"modal-v2-field",onClick:()=>se(!ye),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"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:me.priority||"None"})]}),jsxs(Jo,{triggerRef:Ue,isOpen:ye,onClose:()=>se(false),width:180,estimatedHeight:220,children:[Nf.map(W=>jsx("button",{className:`modal-v2-popover-item priority-${W.toLowerCase()} ${me.priority===W?"active":""}`,onClick:()=>Kt(W),children:W},W)),jsx("button",{className:"modal-v2-popover-item",onClick:()=>Kt(""),children:"None"})]})]}),h.length>0||b?jsx("div",{className:"modal-v2-field-wrapper",children:jsxs("div",{className:"modal-v2-field",style:{cursor:"default"},children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsx("span",{children:"Etiquetas"})]}),jsx("div",{className:"modal-v2-field-value",children:jsx(yr,{selectedTags:me.tags||[],availableTags:h,onChange:F,onCreateTag:b,theme:rt[A]||rt.dark})})]})}):jsxs("div",{className:"modal-v2-field-wrapper",ref:Pt,children:[jsxs("button",{ref:Fe,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:me.labels&&me.labels.length>0?jsx("span",{children:me.labels.join(", ")}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(Jo,{triggerRef:Fe,isOpen:tt,onClose:()=>ie(false),width:220,estimatedHeight:200,children:(C.length>0?C:["Bug","Feature","Enhancement","Documentation"]).map(W=>jsxs("button",{className:`modal-v2-popover-item ${me.labels?.includes(W)?"active":""}`,onClick:()=>Ke(W),children:[W,me.labels?.includes(W)&&jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsx("polyline",{points:"20 6 9 17 4 12"})})]},W))})]}),jsxs("button",{className:"modal-v2-field",onClick:()=>{mt(!Je),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:me.endDate?new Date(me.endDate).toLocaleDateString():"Not set"}),jsx("input",{ref:Le,type:"date",value:typeof me.endDate=="string"?me.endDate.split("T")[0]:me.endDate?(()=>{let W=new Date(me.endDate),le=W.getUTCFullYear(),We=String(W.getUTCMonth()+1).padStart(2,"0"),It=String(W.getUTCDate()).padStart(2,"0");return `${le}-${We}-${It}`})():"",onChange:Ce,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxs("button",{className:"modal-v2-field",onClick:()=>xt(!Ct),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:me.estimatedTime?`${me.estimatedTime}h`:"Not set"})]}),Ct&&jsx("div",{className:"modal-v2-popover",children:jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:me.estimatedTime||"",onChange:W=>Z(W.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>xt(false)})})]})]}),jsxs("section",{className:"modal-v2-section",children:[jsxs("div",{className:"modal-v2-section-header",children:[jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsx("polyline",{points:"10 9 9 9 8 9"})]}),jsx("h2",{children:"Description"})]}),O?jsx("textarea",{className:"modal-v2-textarea",value:me.description||"",onChange:W=>{if(T){let le={...T,description:W.target.value};H(le);}},onBlur:te,placeholder:"Add a detailed description...",autoFocus:true}):jsx("div",{className:"modal-v2-content",onClick:()=>j(true),children:me.description?jsx("div",{className:"modal-v2-markdown",children:U(me.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"}),ae.length>0&&jsxs("span",{className:"modal-v2-count",children:[He,"/",ae.length]}),jsxs("button",{className:"modal-v2-add-button",onClick:()=>ge(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:[ae.map(W=>jsxs("div",{className:`modal-v2-subtask ${W.completed?"completed":""}`,children:[jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>we(W.id),children:W.completed?jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M9 12l2 2 4-4",stroke:"white",strokeWidth:"2",fill:"none"})]}):jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("circle",{cx:"12",cy:"12",r:"10"})})}),jsx("span",{className:"modal-v2-subtask-title",children:W.title}),jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>ze(W.id),children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]},W.id)),re&&jsx("div",{className:"modal-v2-subtask-input-row",children:jsx("input",{type:"text",placeholder:"Subtask title...",value:fe,onChange:W=>Ie(W.target.value),onKeyDown:W=>{W.key==="Enter"&&xe(),W.key==="Escape"&&(ge(false),Ie(""));},onBlur:xe,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(B||w.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"}),w.length>0&&jsx("span",{className:"modal-v2-count",children:w.length})]}),jsx(wr,{cardId:me.id,attachments:w,onUpload:B?W=>B(me.id,W):void 0,onDelete:v,maxSizeMB:10,maxFiles:20})]}),jsxs("section",{className:"modal-v2-section",children:[jsxs("div",{className:"modal-v2-section-header",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsx("h2",{children:"Activity"}),jsxs("div",{className:"modal-v2-filters",children:[jsx("button",{className:`modal-v2-filter ${L==="all"?"active":""}`,onClick:()=>V("all"),children:"All"}),jsx("button",{className:`modal-v2-filter ${L==="comments"?"active":""}`,onClick:()=>V("comments"),children:"Comments"}),jsx("button",{className:`modal-v2-filter ${L==="history"?"active":""}`,onClick:()=>V("history"),children:"History"})]})]}),jsxs("div",{className:"modal-v2-comment-input",children:[p&&jsx("div",{className:"modal-v2-avatar",style:{background:p.color},children:p.initials}),jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsx("textarea",{ref:Pe,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:M,onChange:W=>R(W.target.value),onKeyDown:dt,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:Re,disabled:!M.trim(),children:"Send"})]})]})]}),jsxs("div",{className:"modal-v2-timeline",children:[Y.map(W=>{let le=s.find(It=>It.id===W.userId);if(W.type.includes("COMMENT")){let It=n.find(st=>st.id===W.metadata?.commentId);return It?jsxs("div",{className:"modal-v2-activity-item comment-item",children:[le&&jsx("div",{className:"modal-v2-avatar",style:{background:le.color},children:le.initials}),jsxs("div",{className:"modal-v2-activity-content",children:[jsxs("div",{className:"modal-v2-activity-header",children:[jsx("span",{className:"modal-v2-activity-user",children:le?.name||"Unknown"}),jsx("span",{className:"modal-v2-activity-time",children:new Date(W.timestamp).toLocaleString()})]}),jsx("div",{className:"modal-v2-comment-body",children:It.content})]})]},W.id):null}return jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxs("div",{className:"modal-v2-history-icon",children:[W.type.includes("CREATED")&&"\u2795",W.type.includes("UPDATED")&&"\u270F\uFE0F",W.type.includes("MOVED")&&"\u27A1\uFE0F",W.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",W.type.includes("ASSIGNED")&&"\u{1F464}",W.type.includes("PRIORITY")&&"\u{1F3AF}",W.type.includes("LABEL")&&"\u{1F3F7}\uFE0F"]}),jsxs("div",{className:"modal-v2-activity-content",children:[jsxs("div",{className:"modal-v2-history-text",children:[jsx("span",{className:"modal-v2-activity-user",children:le?.name||"Unknown"})," ",W.type.replace(/_/g," ").toLowerCase(),W.newValue&&jsxs(Fragment,{children:[" to ",jsx("strong",{children:W.newValue})]})]}),jsx("span",{className:"modal-v2-activity-time",children:new Date(W.timestamp).toLocaleString()})]})]},W.id)}),Y.length===0&&jsxs("div",{className:"modal-v2-empty",children:[jsx("p",{children:"No activity yet"}),jsx("span",{children:"Activity will appear here"})]})]})]})]})})})}function Bf({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 pi({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(n=>({...n,average:n.average??e.reduce((c,g)=>c+g.completed,0)/e.length}));return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:a,children:jsxs(LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(Bf,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),o&&jsx(Line,{type:"monotone",dataKey:"planned",stroke:"#3B82F6",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#3B82F6",r:4}}),r&&jsx(Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((n,c)=>n+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((n,c)=>n+c.completed,0)/e.length).toFixed(1)})]}),o&&e.some(n=>n.planned)&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:e.reduce((n,c)=>n+(c.planned||0),0)})]})]})]})}function _f({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 ui({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),n=e[e.length-1]?.remaining||0,c=e[e.length-1]?.ideal||0,g=s>0?(s-n)/s*100:0,i=n<=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(_f,{})}),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:g>=50?"#10B981":"#F59E0B"},children:[g.toFixed(0),"%"]})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsx("span",{className:"chart-stat-value",style:{color:i?"#10B981":"#EF4444"},children:n})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Status"}),jsx("span",{className:"chart-stat-badge",style:{background:i?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:i?"#10B981":"#EF4444"},children:i?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var Qf={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},xc=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function e0({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,c=e+n*Math.cos(-a*(Math.PI/180)),g=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsx("text",{x:c,y:g,fill:"white",textAnchor:c>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function kc({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 gi({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((g,i)=>g+i.value,0),n=e.map(g=>({...g,totalValue:s,color:g.color||Qf[g.name]||xc[e.indexOf(g)%xc.length]})),c=n.map(g=>g.color);return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxs(PieChart,{children:[jsx(Pie,{data:n,cx:"50%",cy:"50%",labelLine:false,label:o?e0:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((g,i)=>jsx(Cell,{fill:c[i]},`cell-${i}`))}),jsx(Tooltip,{content:jsx(kc,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(g,i)=>{let p=i.payload,d=s>0?(p.value/s*100).toFixed(0):"0";return `${g} (${p.value} - ${d}%)`}})]}):jsxs(BarChart$1,{data:n,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(kc,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:n.map((g,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:s})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Categories"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((g,i)=>i.value>g.value?i:g).name})]})]})]})}var On=memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,c]=useState(false),[g,i]=useState(false),[p,d]=useState(false),[f,y]=useState(false);if(e.length===0)return null;let k=e.map(m=>m.id),C=m=>{r.onBulkUpdate?.(k,{priority:m}),c(false);},h=m=>{r.onBulkMove?.(k,m),i(false),a();},b=m=>{r.onBulkUpdate?.(k,{assignedUserIds:m}),d(false);},u=m=>{let N=new Set;e.forEach(B=>{B.labels?.forEach(v=>N.add(v));});let w=Array.from(new Set([...N,...m]));r.onBulkUpdate?.(k,{labels:w}),y(false);},x=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(k),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(!n),title:"Update priority",children:jsx("span",{className:"text-sm",children:"Priority"})}),n&&jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(m=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>C(m),children:[jsx("span",{className:l("asakaa-priority-dot",m==="LOW"&&"bg-asakaa-priority-low",m==="MEDIUM"&&"bg-asakaa-priority-medium",m==="HIGH"&&"bg-asakaa-priority-high",m==="URGENT"&&"bg-asakaa-priority-urgent")}),m]},m))})]}),o.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!g),title:"Move to column",children:jsx("span",{className:"text-sm",children:"Move"})}),g&&jsx("div",{className:"asakaa-bulk-menu",children:o.map(m=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h(m.id),children:m.title},m.id))})]}),t.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!p),title:"Assign users",children:jsx("span",{className:"text-sm",children:"Assign"})}),p&&jsx("div",{className:"asakaa-bulk-menu",children:t.map(m=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([m.id]),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:m.color},children:m.initials}),m.name]},m.id))})]}),s.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>y(!f),title:"Add labels",children:jsx("span",{className:"text-sm",children:"Labels"})}),f&&jsx("div",{className:"asakaa-bulk-menu",children:s.map(m=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>u([m]),children:m},m))})]}),jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:x,title:"Delete selected cards",children:jsx("span",{className:"text-sm",children:"Delete"})}),jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:a,title:"Clear selection",children:jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});On.displayName="BulkOperationsToolbar";function n0(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,c,g,i;switch(t){case "assignee":let p=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);p.length>0?p.forEach(y=>{let k=a?.find(C=>C.id===y);n=`assignee-${y}`,c=k?.name||`User ${y}`,g=k?.color,i=k?.avatar,r.has(n)||r.set(n,{id:n,title:c,groupValue:y,cardIds:[],color:g,icon:i}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",c="Unassigned",g="#6b7280",i="\u{1F464}",r.has(n)||r.set(n,{id:n,title:c,groupValue:null,cardIds:[],color:g,icon:i}),r.get(n).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",n=`priority-${s}`;let f={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];c=f.title,g=f.color,r.has(n)||r.set(n,{id:n,title:c,groupValue:s,cardIds:[],color:g}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(y=>{n=`label-${y}`,c=y,g="#6b7280",r.has(n)||r.set(n,{id:n,title:c,groupValue:y,cardIds:[],color:g}),r.get(n).cardIds.push(o.id);}):(n="label-none",c="No Labels",g="#6b7280",r.has(n)||r.set(n,{id:n,title:c,groupValue:null,cardIds:[],color:g}),r.get(n).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function fi({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=useState(new Set),c=useMemo(()=>n0(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),g=useCallback(i=>{n(p=>{let d=new Set(p);return d.has(i)?d.delete(i):d.add(i),d});},[]);return t.groupBy==="none"||c.length===0?jsx(zr,{board:e,callbacks:r,availableUsers:a,className:o}):jsxs("div",{className:l("asakaa-swimlane-view",o),children:[c.map(i=>{let p=s.has(i.id),d=e.cards.filter(y=>i.cardIds.includes(y.id)),f={...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&&g(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":p?"Expand lane":"Collapse lane",children:p?"\u25B6":"\u25BC"})]}),!p&&jsx("div",{className:"asakaa-swimlane-content p-4",children:jsx(zr,{board:f,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 bi=[{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 hi({value:e,onChange:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null),c=bi.find(i=>i.value===e)||bi[0];useEffect(()=>{function i(p){s.current&&!s.current.contains(p.target)&&n.current&&!n.current.contains(p.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let g=i=>{t(i),o(false);};return jsxs("div",{className:l("relative inline-block",a),children:[jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsx("span",{className:"text-base leading-none",children:c.icon}),jsx("span",{children:c.label}),jsx("svg",{className:l("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[280px] rounded-lg bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl border border-white/20 shadow-2xl z-50 overflow-hidden",children:[jsx("div",{className:"px-3 py-2 border-b border-white/10",children:jsx("span",{className:"text-[10px] font-bold text-white/70 uppercase tracking-wider",children:"Group By"})}),jsx("div",{className:"py-1",children:bi.map(i=>jsxs("button",{onClick:()=>g(i.value),className:l("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 Zo=[{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 l0(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(i=>e.key===i||e.code===i))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,n=o.shift?e.shiftKey:!e.shiftKey,c=o.alt?e.altKey:!e.altKey,g=o.meta?e.metaKey:true;return s&&n&&c&&g}function Dc(e={}){let{shortcuts:t=Zo,enabled:a=true,preventDefault:r=true}=e,o=useRef(t),s=useRef(a);useEffect(()=>{o.current=t,s.current=a;},[t,a]);let n=useCallback(g=>{o.current=[...o.current,g];},[]),c=useCallback(g=>{o.current=o.current.filter(i=>i.action!==g);},[]);return useEffect(()=>{function g(i){if(!s.current)return;let p=i.target;if(!((p.tagName==="INPUT"||p.tagName==="TEXTAREA"||p.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let d of o.current)if(l0(i,d)){r&&i.preventDefault();let f=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(f);break}}}return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[r]),{registerShortcut:n,unregisterShortcut:c,isEnabled:a}}function c0(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function m0(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 p0(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=m0(e),r=t?c0(t):"";return a?`${a} + ${r}`:r}function u0(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 yi({shortcuts:e=Zo,isOpen:t,onClose:a,className:r}){let[o,s]=useState(false);if(useEffect(()=>{s(true);},[]),useEffect(()=>{function c(g){g.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[t,a]),!o||!t)return null;let n=u0(e);return jsxs("div",{className:l("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsx("div",{className:"absolute inset-0 backdrop-blur-sm bg-black/40 dark:bg-black/60",onClick:a}),jsxs("div",{className:"relative backdrop-blur-xl rounded-2xl border shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden bg-white dark:bg-gradient-to-br dark:from-gray-900/95 dark:to-gray-800/95 border-gray-200 dark:border-white/20",children:[jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between border-gray-200 dark:border-white/10",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold flex items-center gap-3 text-gray-900 dark:text-white",children:[jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsx("p",{className:"text-sm mt-1 text-gray-500 dark:text-white/60",children:"Speed up your workflow with these shortcuts"})]}),jsx("button",{onClick:a,className:"transition-colors text-2xl leading-none p-2 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:text-white/50 dark:hover:text-white dark:hover:bg-white/10","aria-label":"Close",children:"\xD7"})]}),jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(n).map(([c,g])=>g.length===0?null:jsxs("div",{children:[jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white/90",children:[jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),c]}),jsx("div",{className:"space-y-3",children:g.map(i=>jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg transition-colors bg-gray-50 hover:bg-gray-100 dark:bg-white/5 dark:hover:bg-white/10",children:[jsx("span",{className:"text-sm text-gray-700 dark:text-white/80",children:i.description}),jsx("kbd",{className:"px-3 py-1.5 border rounded-md text-xs font-mono shadow-sm whitespace-nowrap bg-white border-gray-300 text-gray-800 dark:bg-gradient-to-br dark:from-gray-700 dark:to-gray-800 dark:border-white/20 dark:text-white/90",children:p0(i)})]},i.action))})]},c))})}),jsx("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/5",children:jsxs("p",{className:"text-xs text-center text-gray-500 dark:text-white/50",children:["Press ",jsx("kbd",{className:"px-2 py-0.5 rounded bg-gray-200 text-gray-600 dark:bg-white/10 dark:text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var vi=[{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,10 +108,10 @@ 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 yi({templates:e,onSelectTemplate:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null);useEffect(()=>{function i(p){s.current&&!s.current.contains(p.target)&&n.current&&!n.current.contains(p.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let m=i=>{t(i),o(false);},g=e.reduce((i,p)=>{let l=p.category||"Other";return i[l]||(i[l]=[]),i[l].push(p),i},{});return jsxs("div",{className:d("relative inline-block",a),children:[jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsx("span",{children:"Templates"}),jsx("svg",{className:d("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(g).map(([i,p])=>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:p.map(l=>jsxs("button",{onClick:()=>m(l),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{className:"text-2xl leading-none mt-0.5",children:l.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:l.name}),l.description&&jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:l.description})]})]},l.id))})]},i)),e.length===0&&jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function xi({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,m]=useState("export"),[g,i]=useState("json"),[p,l]=useState(null),b=useRef(null);if(!t)return null;let v=async()=>{let C=o?.current||void 0,h=await dd(e,g,C);cd(h,g);},k=async C=>{let h=C.target.files?.[0];if(h){try{let f=await ud(h),u=h.name.endsWith(".json")?"json":"csv",x=pd(f,u);l(x),x.success&&r&&r(x,f);}catch(f){l({success:false,errors:[`Failed to read file: ${f instanceof Error?f.message:"Unknown error"}`]});}b.current&&(b.current.value="");}};return jsxs("div",{className:d("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxs("div",{className:"flex border-b border-white/10",children:[jsx("button",{onClick:()=>m("export"),className:d("flex-1 px-6 py-4 font-semibold transition-colors",n==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsx("button",{onClick:()=>m("import"),className:d("flex-1 px-6 py-4 font-semibold transition-colors",n==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxs("div",{className:"p-6",children:[n==="export"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(C=>jsxs("button",{onClick:()=>i(C),className:d("p-4 rounded-lg border-2 transition-all text-center",g===C?"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:[C==="json"&&"\u{1F4C4}",C==="csv"&&"\u{1F4CA}",C==="pdf"&&"\u{1F4DD}"]}),jsx("div",{className:"font-semibold uppercase text-xs",children:C})]},C))})]}),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:v,className:"w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600 text-white font-semibold rounded-lg transition-all shadow-lg shadow-blue-500/20",children:"Export Board"})]}),n==="import"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsx("input",{ref:b,type:"file",accept:".json,.csv",onChange:k,className:"hidden"}),jsxs("button",{onClick:()=>b.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"})]})]}),p&&jsxs("div",{className:d("p-4 rounded-lg",p.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsx("h3",{className:d("font-semibold mb-2",p.success?"text-green-400":"text-red-400"),children:p.success?"\u2713 Import Successful":"\u2717 Import Failed"}),p.success&&jsxs("div",{className:"text-sm text-white/80",children:[jsxs("div",{children:["Cards imported: ",p.cardsImported]}),jsxs("div",{children:["Columns imported: ",p.columnsImported]})]}),p.errors&&p.errors.length>0&&jsx("div",{className:"mt-2 text-sm",children:p.errors.map((C,h)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",C]},h))})]})]})]})]})]})}var g0=["URGENT","HIGH","MEDIUM","LOW"],f0=[{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"}],b0=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function ki({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:m,availableUsers:g=[],availableLabels:i=[],availableColumns:p=[],showQuickFilters:l=true,compact:b=false,groupBy:v="none",onGroupByChange:k}){let[C,h]=useState(true),f=useCallback(w=>{a({search:w.target.value});},[a]),u=useCallback(w=>{a({dateFilter:w.target.value});},[a]),x=useCallback(w=>{r({by:w.target.value});},[r]),c=useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),N=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxs("div",{className:`filter-bar ${b?"filter-bar--compact":""} ${C?"filter-bar--collapsed":""}`,children:[jsxs("div",{className:"filter-bar__header",onClick:()=>h(!C),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:C?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:w=>{w.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:w=>{w.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:C?"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)"]})]}),!C&&jsxs("div",{className:"filter-bar__content",children:[l&&jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),n&&jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),m&&jsx("button",{onClick:m,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxs("div",{className:"filter-bar__main",children:[jsx("div",{className:"filter-bar__field",children:jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:f,className:"filter-bar__search"})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.dateFilter,onChange:u,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:w=>{let B=w.target.value;a({priorities:B==="all"?[]:[B]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Priorities"}),g0.map(w=>jsx("option",{value:w,children:w},w))]})}),g.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.assignees[0]||"all",onChange:w=>{let B=w.target.value;a({assignees:B==="all"?[]:[B]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Assignees"}),g.map(w=>jsx("option",{value:w.id,children:w.name},w.id))]})}),i.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.labels[0]||"all",onChange:w=>{let B=w.target.value;a({labels:B==="all"?[]:[B]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Labels"}),i.map(w=>jsx("option",{value:w,children:w},w))]})}),jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsx("select",{value:t.by,onChange:x,className:"filter-bar__select filter-bar__select--sm",children:f0.map(w=>jsx("option",{value:w.value,children:w.label},w.value))}),t.by!=="none"&&jsx("button",{onClick:c,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),k&&jsx("div",{className:"filter-bar__field",children:jsx("select",{value:v,onChange:w=>k(w.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:b0.map(w=>jsx("option",{value:w.value,children:w.label},w.value))})}),N&&jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function wi({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:m,onExportGanttCSV:g}){let[i,p]=useState(false),l=useRef(null);useEffect(()=>{let v=k=>{l.current&&!l.current.contains(k.target)&&p(false);};return i&&document.addEventListener("mousedown",v),()=>{document.removeEventListener("mousedown",v);}},[i]);let b=v=>{v(),p(false);};return jsxs("div",{className:d("relative",r),ref:l,children:[jsxs("button",{onClick:()=>p(!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:v=>{v.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",v.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:v=>{v.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",v.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:()=>b(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:v=>{v.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:v=>{v.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:()=>b(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:v=>{v.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:v=>{v.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:()=>b(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:v=>{v.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:v=>{v.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:()=>b(async()=>await 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:v=>{v.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:v=>{v.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:()=>b(()=>g?.()),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:v=>{v.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:v=>{v.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:()=>b(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:v=>{v.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:v=>{v.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:()=>b(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:v=>{v.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:v=>{v.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 Ci={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"}},Ti={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"}},Ni={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"}},lo={dark:Ci,light:Ti,neutral:Ni},On="dark";var $n=createContext(void 0),D0="asakaa-theme";function Sc({children:e,defaultTheme:t=On,storageKey:a=D0}){let[r,o]=useState(()=>{if(typeof window<"u"){let m=localStorage.getItem(a);if(m&&(m==="dark"||m==="light"||m==="neutral"))return m}return t}),s=useCallback(m=>{o(m),typeof window<"u"&&localStorage.setItem(a,m);},[a]);useEffect(()=>{if(typeof window>"u")return;let m=document.documentElement,g=lo[r];Object.entries(g.colors).forEach(([p,l])=>{l&&m.style.setProperty(`--theme-${S0(p)}`,l);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([p,l])=>{let b=g.colors[p];b&&m.style.setProperty(l,b);}),m.setAttribute("data-theme",r),m.classList.remove("theme-dark","theme-light","theme-neutral"),m.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:lo};return jsx($n.Provider,{value:n,children:e})}function Mo(){let e=useContext($n);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function S0(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Di({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=Mo();return e?jsxs("div",{className:d("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(lo).map(([s,n])=>jsxs("button",{onClick:()=>{o(s),t();},className:d("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsx("div",{className:"text-3xl",children:n.emoji}),jsxs("div",{className:"text-left flex-1",children:[jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:n.displayName}),jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),r===s&&jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}function Ec(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return et[e]||et.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",et[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",et[e].bgSecondary),bgGrid:r("--theme-bg-card",et[e].bgGrid),bgWeekend:r("--theme-bg-hover",et[e].bgWeekend),border:r("--theme-border-primary",et[e].border),borderLight:r("--theme-border-subtle",et[e].borderLight),textPrimary:r("--theme-text-primary",et[e].textPrimary),textSecondary:r("--theme-text-secondary",et[e].textSecondary),textTertiary:r("--theme-text-tertiary",et[e].textTertiary),accent:r("--theme-accent-primary",et[e].accent),accentHover:r("--theme-accent-hover",et[e].accentHover),accentLight:r("--theme-accent-primary",et[e].accentLight),taskBarPrimary:r("--theme-accent-primary",et[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",et[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",et[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",et[e].dependency),dependencyHover:r("--theme-border-secondary",et[e].dependencyHover),criticalPath:r("--theme-error",et[e].criticalPath),criticalPathLight:r("--theme-error",et[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",et[e].today):e==="neutral"?r("--theme-text-primary",et[e].today):r("--theme-error",et[e].today),todayLight:e==="light"?r("--theme-accent-primary",et[e].todayLight):e==="neutral"?r("--theme-text-primary",et[e].todayLight):r("--theme-error",et[e].todayLight),milestone:r("--theme-warning",et[e].milestone),milestoneLight:r("--theme-warning",et[e].milestoneLight),statusTodo:r("--theme-text-tertiary",et[e].statusTodo),statusInProgress:r("--theme-accent-primary",et[e].statusInProgress),statusCompleted:r("--theme-success",et[e].statusCompleted),hoverBg:r("--theme-bg-hover",et[e].hoverBg),focusRing:r("--theme-accent-primary",et[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",filterAll:"All",filterIncomplete:"Incomplete",filterInProgress:"In Progress",filterCompleted:"Completed",filter:"Filter",filterBy:"Filter by status",filterAllDesc:"Show all tasks",filterIncompleteDesc:"Hide completed tasks",filterInProgressDesc:"Tasks currently being worked on",filterCompletedDesc:"Only show finished tasks",clearFilter:"Clear filter"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today",week:"Week",clickToSetDates:"Click to set dates..."},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},Pc={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso",filterAll:"Todas",filterIncomplete:"Sin completar",filterInProgress:"En progreso",filterCompleted:"Completadas",filter:"Filtrar",filterBy:"Filtrar por estado",filterAllDesc:"Mostrar todas las tareas",filterIncompleteDesc:"Ocultar tareas completadas",filterInProgressDesc:"Tareas en las que se est\xE1 trabajando",filterCompletedDesc:"Solo mostrar tareas terminadas",clearFilter:"Limpiar filtro"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy",week:"Semana",clickToSetDates:"Clic para establecer fechas..."},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},Si={en:Un,es:Pc};function Mc(e){return Si[e]||Si.en}function Ei(e,t){let a=Mc(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 Fo=createContext(Un);function _r(){return useContext(Fo)}function G0({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[m,g]=useState(false),[i,p]=useState(null),l=useRef(null),b=_r();if(useEffect(()=>{let h=f=>{l.current&&!l.current.contains(f.target)&&g(false);};return m&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[m]),!(t||a||r||o||s||n))return null;let k=[{id:"png",label:"PNG",description:"Image",icon:jsx(FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsx(FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsx(FolderKanban,{className:"w-4 h-4"}),handler:n}].filter(h=>h.handler),C=async(h,f)=>{if(f){p(h);try{await f();}catch(u){console.error(`Export ${h} failed:`,u);}finally{p(null),g(false);}}};return jsxs("div",{ref:l,className:"relative",children:[jsxs(motion.button,{onClick:()=>g(!m),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:m?e.accent:e.bgSecondary,border:`1px solid ${m?e.accent:e.borderLight}`,color:m?"#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:b.toolbar.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:m?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:m&&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:k.map((h,f)=>jsxs(motion.button,{onClick:()=>C(h.id,h.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:f<k.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:f*.03},children:[jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===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 _0({options:e,value:t,onChange:a,theme:r,layoutId:o="activeSegment"}){return jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(s=>{let n=t===s.value;return jsxs(motion.button,{onClick:()=>a(s.value),className:"relative px-3 py-1.5 rounded-md text-xs transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:n?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:n?600:500,zIndex:n?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[n&&jsx(motion.div,{layoutId:o,className:"absolute inset-0 rounded-md",style:{backgroundColor:r.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.icon}),jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function V0({options:e,value:t,onChange:a,theme:r}){return jsx("div",{className:"inline-flex items-center gap-1",children:e.map(o=>{let s=t===o.value;return jsxs(motion.button,{onClick:()=>a(o.value),className:"relative px-3 py-1.5 text-xs transition-all",style:{color:s?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsx("span",{children:o.label}),s&&jsx(motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:r.accent},transition:{type:"spring",stiffness:400,damping:30}})]},o.value)})})}function j0({theme:e,value:t,onChange:a}){let[r,o]=useState(false),s=useRef(null),n=_r();useEffect(()=>{let i=p=>{s.current&&!s.current.contains(p.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let m=[{value:"compact",label:n.toolbar.compact||"Compact"},{value:"comfortable",label:n.toolbar.normal||"Normal"},{value:"spacious",label:n.toolbar.spacious||"Spacious"}],g=m.find(i=>i.value===t)?.label||"Normal";return jsxs("div",{ref:s,className:"relative",children:[jsx(motion.button,{onClick:()=>o(!r),className:"flex items-center justify-center p-2 rounded-lg transition-all",style:{backgroundColor:r?e.accentLight:e.bgSecondary,border:`1px solid ${r?e.accent:e.borderLight}`,color:r?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${n.toolbar.density||"Density"}: ${g}`,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:m.map((i,p)=>{let l=t===i.value;return jsxs(motion.button,{onClick:()=>{a(i.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:l?e.accentLight:"transparent",borderBottom:p<m.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:l?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:p*.03},children:[jsx("span",{className:"text-xs",style:{color:l?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:l?600:500},children:i.label}),l&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},i.value)})})})})]})}function K0({theme:e,value:t,onChange:a}){let[r,o]=useState(false),s=useRef(null),n=_r();useEffect(()=>{let i=p=>{s.current&&!s.current.contains(p.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let m=[{value:"all",label:n.toolbar.filterAll||"All tasks",description:n.toolbar.filterAllDesc||"Show all tasks"},{value:"incomplete",label:n.toolbar.filterIncomplete||"Incomplete only",description:n.toolbar.filterIncompleteDesc||"Hide completed tasks"},{value:"in_progress",label:n.toolbar.filterInProgress||"In progress",description:n.toolbar.filterInProgressDesc||"Tasks currently being worked on"},{value:"completed",label:n.toolbar.filterCompleted||"Completed",description:n.toolbar.filterCompletedDesc||"Only show finished tasks"}],g=t!=="all";return jsxs("div",{ref:s,className:"relative",children:[jsxs(motion.button,{onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:g||r?e.accentLight:e.bgSecondary,border:`1px solid ${g||r?e.accent:e.borderLight}`,color:g||r?e.accent:e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.accentLight,borderColor:e.accent,color:e.accent,scale:1.02},whileTap:{scale:.98},children:[jsx(Filter,{className:"w-3.5 h-3.5"}),jsx("span",{children:n.toolbar.filter||"Filter"}),g&&jsx(motion.span,{initial:{scale:0},animate:{scale:1},className:"flex items-center justify-center w-4 h-4 rounded-full text-[10px] font-semibold",style:{backgroundColor:e.accent,color:"#FFFFFF"},children:"1"}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:r?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:r&&jsxs(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-56 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:[jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:e.borderLight},children:jsx("span",{className:"text-xs font-medium",style:{color:e.textTertiary},children:n.toolbar.filterBy||"Filter by status"})}),jsx("div",{className:"py-1",children:m.map((i,p)=>{let l=t===i.value;return jsxs(motion.button,{onClick:()=>{a(i.value),o(false);},className:"w-full flex items-start gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:l?e.accentLight:"transparent"},whileHover:{backgroundColor:l?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:p*.03},children:[jsx("div",{className:"flex items-center justify-center w-4 h-4 rounded border mt-0.5 flex-shrink-0",style:{borderColor:l?e.accent:e.border,backgroundColor:l?e.accent:"transparent"},children:l&&jsx(Check,{className:"w-3 h-3",style:{color:"#FFFFFF"}})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium",style:{color:l?e.accent:e.textPrimary},children:i.label}),jsx("div",{className:"text-[10px] mt-0.5",style:{color:e.textTertiary},children:i.description})]})]},i.value)})}),g&&jsx("div",{className:"px-3 py-2 border-t",style:{borderColor:e.borderLight},children:jsx(motion.button,{onClick:()=>{a("all"),o(false);},className:"w-full text-xs py-1.5 rounded-md",style:{color:e.textTertiary},whileHover:{backgroundColor:e.hoverBg,color:e.textSecondary},children:n.toolbar.clearFilter||"Clear filter"})})]})})]})}function Hn({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:m,onRowDensityChange:g,showThemeSelector:i=false,showCreateTaskButton:p=false,createTaskLabel:l,onCreateTask:b,taskFilter:v="all",onTaskFilterChange:k,onExportPNG:C,onExportPDF:h,onExportExcel:f,onExportCSV:u,onExportJSON:x,onExportMSProject:c}){let N=_r(),w=C||h||f||u||x||c,B=[{value:"day",label:N.toolbar.day},{value:"week",label:N.toolbar.week},{value:"month",label:N.toolbar.month}],y=[{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(V0,{options:B,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(j0,{theme:e,value:m,onChange:g}),k&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsx(K0,{theme:e,value:v,onChange:k})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[p&&b&&jsxs(Fragment,{children:[jsxs(motion.button,{onClick:b,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:l||N.toolbar.createTask})]}),(w||i)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),w&&jsxs(Fragment,{children:[jsx(G0,{theme:e,onExportPNG:C,onExportPDF:h,onExportExcel:f,onExportCSV:u,onExportJSON:x,onExportMSProject:c}),i&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsx(_0,{options:y,value:s,onChange:I=>n(I),theme:e})]})]})}function Wn({columns:e,onToggleColumn:t,theme:a}){let[r,o]=useState(false),[s,n]=useState({x:0,y:0}),m=useRef(null),g=useRef(null);useEffect(()=>{if(!r)return;let p=l=>{m.current&&!m.current.contains(l.target)&&o(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[r]);let i=e.filter(p=>p.id!=="name");return jsxs(Fragment,{children:[jsx(motion.button,{ref:g,onClick:()=>{if(!r&&g.current){let p=g.current.getBoundingClientRect();n({x:p.left,y:p.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(ft,{children:jsx(motion.div,{ref:m,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(p=>jsxs("button",{onClick:()=>{t(p.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{children:p.label}),p.visible&&jsx(Check,{className:"w-4 h-4",style:{color:a.accent}})]},p.id))]})})})})]})}function Lo({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=useRef(null),[m,g]=useState({x:t,y:a});if(useEffect(()=>{if(!e)return;let p=200,l=r.length*36+8,b=8,v=window.innerWidth,k=window.innerHeight,C=t,h=a;t+p+b>v&&(C=t-p,C<b&&(C=b)),a+l+b>k&&(h=k-l-b,h<b&&(h=b)),g({x:C,y:h});},[e,t,a,r.length]),useEffect(()=>{if(!e)return;let p=b=>{n.current&&!n.current.contains(b.target)&&o();},l=b=>{b.key==="Escape"&&o();};return document.addEventListener("mousedown",p),document.addEventListener("keydown",l),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",l);}},[e,o]),!e)return null;let i=p=>p.startsWith("#")&&(p.length===7||p.length===4)?p:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsx(AnimatePresence,{children:jsx(motion.div,{ref:n,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${m.x}px`,top:`${m.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsx("div",{className:"py-1",children:r.map(p=>jsxs("div",{children:[p.separator&&jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxs("button",{onClick:()=>{p.disabled||(p.onClick(),o());},disabled:p.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:p.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:p.disabled?"not-allowed":"pointer",opacity:p.disabled?.5:1},onMouseEnter:l=>{p.disabled||(l.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[p.icon&&jsx("span",{style:{color:s.textSecondary},children:p.icon}),jsx("span",{className:"flex-1",children:p.label}),p.submenu&&jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},p.id))})})})}var Wt={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 Hc({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:m,onTaskOutdent:g,onTaskRename:i,onTaskToggleExpand:p,onOpenTaskModal:l,enableKeyboard:b=true}){let v=useRef(false),k=useCallback(x=>{v.current=x;},[]),C=useCallback(x=>{let c=[],N=w=>{for(let B of w)c.push(B),B.subtasks&&B.subtasks.length>0&&B.isExpanded&&N(B.subtasks);};return N(x),c},[]),h=useCallback(()=>{let x=C(e);for(let c of x)if(t.has(c.id))return c;return null},[e,t,C]),f=useCallback((x,c)=>{let N=C(e);if(N.length===0)return;let w=h();if(!w){a(N[0].id,false);return}let B=N.findIndex(P=>P.id===w.id);if(B===-1)return;let y=x==="up"?B-1:B+1;if(y<0||y>=N.length)return;let I=N[y];a(I.id,c);},[e,h,C,a]),u=useCallback(x=>{if(!b)return;let c=x.target;if(c.tagName==="INPUT"||c.tagName==="TEXTAREA"||c.isContentEditable||v.current){x.key==="Escape"&&(c.blur(),v.current=false);return}let B=navigator.platform.toUpperCase().indexOf("MAC")>=0?x.metaKey:x.ctrlKey,y=Array.from(t),I=h();if(x.key==="ArrowUp"){x.preventDefault(),f("up",x.shiftKey);return}if(x.key==="ArrowDown"){x.preventDefault(),f("down",x.shiftKey);return}if(I&&(x.key==="ArrowRight"||x.key==="ArrowLeft")){I.subtasks&&I.subtasks.length>0&&(x.preventDefault(),(x.key==="ArrowRight"&&!I.isExpanded||x.key==="ArrowLeft"&&I.isExpanded)&&p(I.id));return}if(x.altKey&&(x.key==="ArrowUp"||x.key==="ArrowDown")){y.length>0&&(x.preventDefault(),n(y,x.key==="ArrowUp"?"up":"down"));return}if(x.key==="Tab"&&!x.shiftKey){y.length>0&&(x.preventDefault(),m(y));return}if(x.key==="Tab"&&x.shiftKey){y.length>0&&(x.preventDefault(),g(y));return}if(x.key==="Enter"&&!x.shiftKey&&!B){I&&(x.preventDefault(),r(I.id,"below"));return}if(x.key==="Enter"&&x.shiftKey&&!B){I&&(x.preventDefault(),r(I.id,"above"));return}if(x.key==="Enter"&&B){I&&(x.preventDefault(),l(I.id));return}if(x.key==="F2"){I&&(x.preventDefault(),i(I.id));return}if(x.key==="Delete"||x.key==="Backspace"&&B){y.length>0&&(x.preventDefault(),o(y));return}if(x.key==="d"&&B&&!x.shiftKey){y.length>0&&(x.preventDefault(),s(y));return}},[b,t,h,f,r,o,s,n,m,g,i,p,l]);return useEffect(()=>{if(b)return window.addEventListener("keydown",u),()=>{window.removeEventListener("keydown",u);}},[b,u]),{setIsEditing:k}}function Gc(){let[e,t]=useState(new Set),[a,r]=useState(null),o=useCallback(l=>{t(new Set([l])),r(l);},[]),s=useCallback(l=>{t(b=>{let v=new Set(b);return v.has(l)?v.delete(l):v.add(l),v}),r(l);},[]),n=useCallback((l,b)=>{if(!a){o(l);return}let v=b.indexOf(a),k=b.indexOf(l);if(v===-1||k===-1){o(l);return}let C=Math.min(v,k),h=Math.max(v,k),f=b.slice(C,h+1);t(new Set(f)),r(l);},[a,o]),m=useCallback((l,b,v,k)=>{k?n(l,b):v?s(l):o(l);},[o,s,n]),g=useCallback((l,b)=>{b?t(v=>{let k=new Set(v);return k.add(l),k}):o(l);},[o]),i=useCallback(()=>{t(new Set),r(null);},[]),p=useCallback(l=>e.has(l),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:m,handleKeyboardSelection:g,clearSelection:i,isTaskSelected:p}}function Io(e){let t=[],a=(r,o,s=0)=>{for(let n=0;n<r.length;n++){let m={...r[n],parentId:o,level:s,position:n};t.push(m),m.subtasks&&m.subtasks.length>0&&m.isExpanded&&a(m.subtasks,m.id,s+1);}};return a(e),t}function _c(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=_c(a.subtasks,t);if(r)return r}}return null}function Ii(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=Ii(a.subtasks,t);if(r)return r}return null}function Bi(e,t){if(t.length===0)return e;let a=Io(e),r=t[0],o=a.findIndex(l=>l.id===r);if(o<=0)return e;let s=a[o-1],n=(l,b)=>{let v=[];return {tasks:l.filter(C=>{if(b.has(C.id))return v.push(C),false;if(C.subtasks){let h=n(C.subtasks,b);C.subtasks=h.tasks,v.push(...h.removed);}return true}),removed:v}},m=(l,b,v)=>l.map(k=>k.id===b?{...k,subtasks:[...k.subtasks||[],...v],isExpanded:true}:k.subtasks?{...k,subtasks:m(k.subtasks,b,v)}:k),g=new Set(t),{tasks:i,removed:p}=n(e,g);return m(i,s.id,p)}function Ri(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=Ii(a,r);if(!o)continue;let s=Ii(a,o.id),n=(i,p,l)=>{for(let b=0;b<i.length;b++){let v=i[b];if(v.id===p&&v.subtasks){let k=v.subtasks.findIndex(C=>C.id===l);if(k!==-1){let[C]=v.subtasks.splice(k,1);return C}}if(v.subtasks){let k=n(v.subtasks,p,l);if(k)return k}}return null},m=(i,p,l)=>{let b=i.findIndex(v=>v.id===p);if(b!==-1)return i.splice(b+1,0,l),i;for(let v of i)v.subtasks&&m(v.subtasks,p,l);return i},g=n(a,o.id,r);g&&(s&&s.subtasks?m(s.subtasks,o.id,g):m(a,o.id,g));}return a}function Oi(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,m,g)=>{let i=n.findIndex(l=>l.id===m);if(i===-1){for(let l of n)if(l.subtasks&&s(l.subtasks,m,g))return true;return false}let p=g==="up"?i-1:i+1;return p<0||p>=n.length?false:([n[i],n[p]]=[n[p],n[i]],true)};return s(r,o,a),r}function $i(e,t){let a=new Set(t),r=o=>o.filter(s=>!a.has(s.id)).map(s=>s.subtasks?{...s,subtasks:r(s.subtasks)}:s);return r(e)}function Ui(e,t){let a=[...e];for(let r of t){let o=n=>{let m=n.findIndex(p=>p.id===r);if(m===-1){for(let p of n)if(p.subtasks&&o(p.subtasks))return true;return false}let g=n[m],i={...g,id:`${g.id}-copy-${Date.now()}`,name:`${g.name} (Copy)`,subtasks:g.subtasks?s(g.subtasks):void 0};return n.splice(m+1,0,i),true},s=n=>n.map(m=>({...m,id:`${m.id}-copy-${Date.now()}`,subtasks:m.subtasks?s(m.subtasks):void 0}));o(a);}return a}function Vc(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#6366F1"},m=g=>{let i=g.findIndex(l=>l.id===t);if(i===-1){for(let l of g)if(l.subtasks&&m(l.subtasks))return true;return false}let p=a==="above"?i:i+1;return g.splice(p,0,n),true};return m(r),{tasks:r,newTask:n}}function zi(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:zi(r.subtasks,t,a)}:r)}function Hi(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:Hi(a.subtasks,t)}:a)}function Wi(e,t){let a=p=>{for(let l of p){if(l.id===t)return l;if(l.subtasks){let b=a(l.subtasks);if(b)return b}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,m=r?.endDate||s,g={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(m),color:r?.color||"#3B82F6"},i=p=>p.map(l=>{if(l.id===t){let b=l.subtasks||[];return {...l,subtasks:[...b,g],isExpanded:true}}return l.subtasks?{...l,subtasks:i(l.subtasks)}:l});return {tasks:i(e),newTask:g}}function jc(e,t,a,r){if(t===a)return e;let o=_c(e,t);if(!o)return e;if(a){let m=(g,i)=>{if(!g.subtasks)return false;for(let p of g.subtasks)if(p.id===i||m(p,i))return true;return false};if(m(o,a))return e}let s=m=>m.filter(g=>g.id!==t).map(g=>g.subtasks&&g.subtasks.length>0?{...g,subtasks:s(g.subtasks)}:g),n=s(e);if(a===null){let m=r!==void 0?r:n.length;n.splice(m,0,{...o,parentId:void 0});}else {let m=g=>g.map(i=>{if(i.id===a){let p=i.subtasks||[],l=r!==void 0?r:p.length,b=[...p];return b.splice(l,0,{...o,parentId:a}),{...i,subtasks:b,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:m(i.subtasks)}:i});n=m(n);}return n}function Vn({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:m,onTaskToggle:g,scrollTop:i,columns:p,onToggleColumn:l,onColumnResize:b,onTaskUpdate:v,onTaskIndent:k,onTaskOutdent:C,onTaskMove:h,onMultiTaskDelete:f,onTaskDuplicate:u,onTaskCreate:x,onTaskRename:c,onCreateSubtask:N,onOpenTaskModal:w,onDeleteRequest:B,onTaskReparent:y}){let I=useContext(Fo),[P,T]=useState(null),[W,O]=useState(null),[q,te]=useState(""),ne=useRef(null),[oe,ce]=useState(null),[be,Le]=useState(0),[A,R]=useState(0),[L,j]=useState({isOpen:false,x:0,y:0,type:"header"}),[X,z]=useState(null),[ve,se]=useState(null),[Ie,qe]=useState(null),Qe=useRef(0),ie=5,Xe=useRef(false),[lt,kt]=useState(null),[yt,$]=useState(false),[fe,Ae]=useState(null),[G,ae]=useState(false),xe=useRef(null);useEffect(()=>{function U(Y){xe.current&&!xe.current.contains(Y.target)&&ae(false);}if(G)return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[G]),useEffect(()=>{W&&ne.current&&(ne.current.focus(),ne.current.select());},[W]),useEffect(()=>{if(!oe)return;let U=pe=>{let _e=pe.clientX-be,ze=A+_e;b?.(oe,ze);},Y=()=>{ce(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",U),document.addEventListener("mouseup",Y),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",U),document.removeEventListener("mouseup",Y),document.body.style.cursor="",document.body.style.userSelect="";}},[oe,be,A,b]);let{selectedTaskIds:Oe,handleTaskClick:ye,isTaskSelected:it}=Gc(),{setIsEditing:Ue}=Hc({tasks:e,selectedTaskIds:Oe,onTaskSelect:(U,Y)=>{let _e=Io(e).map(ze=>ze.id);ye(U,_e,Y||false,false);},onTaskCreate:x||(()=>{}),onTaskDelete:f||(()=>{}),onTaskDuplicate:u||(()=>{}),onTaskMove:h||(()=>{}),onTaskIndent:k||(()=>{}),onTaskOutdent:C||(()=>{}),onTaskRename:U=>{let Y=Io(e).find(pe=>pe.id===U);Y&&Ve(Y);},onTaskToggleExpand:g||(()=>{}),onOpenTaskModal:U=>{let Y=Io(e).find(pe=>pe.id===U);Y&&w&&w(Y);},enableKeyboard:true}),wt=(U,Y=0)=>{let pe=[];for(let _e of U)pe.push({task:_e,level:Y}),_e.subtasks&&_e.subtasks.length>0&&_e.isExpanded&&pe.push(...wt(_e.subtasks,Y+1));return pe},ut=wt(e),Bt=48,jt=Math.max(ut.length*a,600-Bt),Se=U=>!U.startDate||!U.endDate?"-":`${Math.ceil((U.endDate.getTime()-U.startDate.getTime())/(1e3*60*60*24))}d`,Ve=U=>{O(U.id),te(U.name),Ue(true);},ua=U=>{q.trim()&&q!==e.find(Y=>Y.id===U)?.name&&c?.(U,q.trim()),O(null),te(""),Ue(false);},Ze=()=>{O(null),te(""),Ue(false);},Ke=(U,Y)=>{Y.stopPropagation(),N?.(U.id);},F=(U,Y)=>{Y.preventDefault(),Qe.current=Y.clientY,z(U),Xe.current=false,$(false),kt({x:Y.clientX,y:Y.clientY});},Te=U=>{if(!X||(Math.abs(U.clientY-Qe.current)>ie&&!Xe.current&&(Xe.current=true,$(true)),kt({x:U.clientX,y:U.clientY}),!Xe.current))return;let pe=document.querySelectorAll("[data-task-row]"),_e=null,ze=null;pe.forEach(H=>{let le=H.getBoundingClientRect(),He=H.getAttribute("data-task-row");if(He&&He!==X&&U.clientY>=le.top&&U.clientY<=le.bottom){_e=He;let Ft=U.clientY-le.top,rt=le.height;Ft<rt*.25?ze="above":Ft>rt*.75?ze="below":ze="child";}}),se(_e),qe(ze);},Z=()=>{if(Xe.current&&X&&ve&&Ie){if(Ie==="child")y?.(X,ve);else if(Ie==="above"||Ie==="below"){let U=(_e,ze,H=null)=>{for(let le of _e){if(le.id===ze)return H;if(le.subtasks){let He=U(le.subtasks,ze,le.id);if(He!==void 0)return He}}},Y=U(e,ve,null),pe=(_e,ze)=>{let H=_e.findIndex(le=>le.id===ze);return Ie==="below"?H+1:H};if(Y===null){let _e=pe(e,ve);y?.(X,null,_e);}else {let _e=ut.find(ze=>ze.task.id===Y)?.task;if(_e?.subtasks){let ze=pe(_e.subtasks,ve);y?.(X,Y,ze);}}}}z(null),se(null),qe(null),kt(null),Xe.current=false,$(false);};useEffect(()=>{if(X)return document.addEventListener("mousemove",Te),document.addEventListener("mouseup",Z),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Te),document.removeEventListener("mouseup",Z),document.body.style.cursor="",document.body.style.userSelect="";}},[X,ve,Ie]);let ke=(U,Y,pe)=>{switch(U.id){case "name":let _e=W===Y.id,ze=P===Y.id;return jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${pe*20}px`},children:[y&&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:ze?1:.3},onMouseDown:V=>F(Y.id,V),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),Y.subtasks&&Y.subtasks.length>0?jsx("button",{onClick:V=>{V.stopPropagation(),g?.(Y.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:Y.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:Y.color||"#3B82F6",opacity:Y.parentId?.6:1,borderColor:Y.isMilestone?t.accent:"transparent",borderWidth:Y.isMilestone?"2px":"0px"},title:Y.isMilestone?"Milestone":Y.parentId?"Subtask":"Task"})}),_e?jsx("input",{ref:ne,type:"text",value:q,onChange:V=>te(V.target.value),onKeyDown:V=>{V.key==="Enter"?ua(Y.id):V.key==="Escape"&&Ze();},onBlur:()=>ua(Y.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:V=>V.stopPropagation()}):jsxs(Fragment,{children:[jsx("span",{className:"flex-1",style:{color:Y.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:Y.parentId?"13px":"14px",fontWeight:Y.isMilestone?600:Y.parentId?400:600,letterSpacing:Y.parentId?"0":"-0.01em"},title:Y.name,children:Y.name}),ze&&!_e&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:V=>V.stopPropagation(),children:[jsx("button",{onClick:V=>Ke(Y,V),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:V=>{V.stopPropagation(),Ve(Y);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsx(Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":case "endDate":let le=U.id==="startDate"?"startDate":"endDate",He=Y[le],Ft=fe?.taskId===Y.id&&fe?.field===le,rt=V=>V?(typeof V=="string"?new Date(V):V).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:V=>V.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:V=>{if(Ft)Ae(null);else {let Me=V.currentTarget.getBoundingClientRect();Ae({taskId:Y.id,field:le,month:He?typeof He=="string"?new Date(He):He:new Date,position:{top:Me.bottom+4,left:Me.left}});}},children:[jsx(Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsx("span",{children:rt(He)})]}),Ft&&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:fe?.position.top,left:fe?.position.left},onClick:V=>V.stopPropagation(),children:[jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let V=new Date,Me=new Date(V);Me.setDate(V.getDate()+1);let Ye=new Date(V);Ye.setDate(V.getDate()+7);let Pt=new Date(V);return Pt.setDate(V.getDate()+14),[{label:"Hoy",date:V},{label:"Ma\xF1ana",date:Me},{label:"Pr\xF3xima semana",date:Ye},{label:"2 semanas",date:Pt}].map((We,vt)=>jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:Re=>Re.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Re=>Re.currentTarget.style.backgroundColor="transparent",onClick:()=>{v?.(Y.id,{[le]:We.date}),Ae(null);},children:We.label},vt))})(),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:V=>V.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:V=>V.currentTarget.style.backgroundColor="transparent",onClick:()=>{v?.(Y.id,{[le]: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(V=>V?{...V,month:new Date(V.month.getFullYear(),V.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:fe?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>Ae(V=>V?{...V,month:new Date(V.month.getFullYear(),V.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((V,Me)=>jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:V},Me))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let V=fe?.month||new Date,Me=V.getFullYear(),Ye=V.getMonth(),Pt=new Date(Me,Ye,1).getDay(),de=new Date(Me,Ye+1,0).getDate(),We=new Date,vt=[];for(let gt=Pt-1;gt>=0;gt--)vt.push({day:new Date(Me,Ye,-gt).getDate(),date:new Date(Me,Ye-1,new Date(Me,Ye,-gt).getDate()),isCurrentMonth:false});for(let gt=1;gt<=de;gt++)vt.push({day:gt,date:new Date(Me,Ye,gt),isCurrentMonth:true});let Re=42-vt.length;for(let gt=1;gt<=Re;gt++)vt.push({day:gt,date:new Date(Me,Ye+1,gt),isCurrentMonth:false});return vt.map((gt,va)=>{let wa=gt.date.toDateString()===We.toDateString(),je=(He?typeof He=="string"?new Date(He):He:null)?.toDateString()===gt.date.toDateString();return jsx("button",{type:"button",className:"w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",style:{color:gt.isCurrentMonth?je?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:je?"#3B82F6":"transparent",boxShadow:wa&&!je?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{v?.(Y.id,{[le]:gt.date}),Ae(null);},children:gt.day},va)})})()})]})]})]}),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:Se(Y)})});case "assignees":let ya=r.filter(V=>Y.assignees?.some(Me=>Me.name===V.name||Me.initials===V.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:V=>V.stopPropagation(),children:jsx(ao,{assignedUsers:ya,availableUsers:r,onChange:V=>{let Me=V.map(Ye=>({id:Ye.id,name:Ye.name,initials:Ye.initials,color:Ye.color}));v?.(Y.id,{assignees:Me.length>0?Me:void 0});}})});case "status":return jsx("div",{className:"flex items-center justify-center w-full",onClick:V=>V.stopPropagation(),children:jsx(Fd,{status:Y.status||"todo",onChange:V=>{v?.(Y.id,{status:V,progress:V==="completed"?100:Y.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:`${Y.progress}%`,backgroundColor:Y.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:[Y.progress,"%"]})]});case "priority":let $a={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},ct={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},M=$a[Y.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:V=>V.stopPropagation(),children:jsx(eo,{priority:M,onChange:V=>{V&&v?.(Y.id,{priority:ct[V]||"medium"});}})});default:return null}},Ce=U=>[{id:"hide",label:"Hide Column",icon:Wt.Hide,onClick:()=>l(U),disabled:U==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Wt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Wt.SortDesc,onClick:()=>{}}],$e=U=>U.subtasks&&U.subtasks.length>0?[{id:"addSubtask",label:I?.contextMenu?.addSubtask||"Add Subtask",icon:Wt.Add,onClick:()=>{N?.(U.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:I?.contextMenu?.deleteTask||"Delete Task",icon:Wt.Delete,onClick:()=>{B?B(U.id,U.name):f?.([U.id]);}}]:[{id:"edit",label:I?.contextMenu?.editTask||"Edit Task",icon:Wt.Pencil,onClick:()=>{n?.(U);}},{id:"addSubtask",label:I?.contextMenu?.addSubtask||"Add Subtask",icon:Wt.Add,onClick:()=>{N?.(U.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:I?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Wt.MarkIncomplete,onClick:()=>{v?.(U.id,{status:"todo",progress:0});},disabled:U.status==="todo"},{id:"setInProgress",label:I?.contextMenu?.setInProgress||"Set In Progress",icon:Wt.SetInProgress,onClick:()=>{v?.(U.id,{status:"in-progress"});},disabled:U.status==="in-progress"},{id:"markComplete",label:I?.contextMenu?.markComplete||"Mark Complete",icon:Wt.MarkComplete,onClick:()=>{v?.(U.id,{status:"completed",progress:100});},disabled:U.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:I?.contextMenu?.splitTask||"Split Task",icon:Wt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:I?.contextMenu?.deleteTask||"Delete Task",icon:Wt.Delete,onClick:()=>{B?B(U.id,U.name):f?.([U.id]);}}],Be=p.filter(U=>U.visible),st=Be.reduce((U,Y)=>U+Y.width,0);return jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:st},children:[jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${Bt}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsx("div",{className:"flex items-center flex-1 min-w-0",children:Be.map((U,Y)=>{let pe=Y===Be.length-1,_e=U.id==="name";return jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${_e?"":"justify-center"}`,style:{width:`${U.width}px`,minWidth:`${U.minWidth??(_e?200:60)}px`,maxWidth:`${U.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:pe?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:ze=>{ze.preventDefault(),j({isOpen:true,x:ze.clientX,y:ze.clientY,type:"header",columnId:U.id});},onMouseEnter:ze=>{ze.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:ze=>{ze.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:U.label,children:U.label}),U.resizable&&jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:oe===U.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:ze=>{ze.preventDefault(),ze.stopPropagation(),ce(U.id),Le(ze.clientX),R(U.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"}})})]},U.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(Wn,{columns:p,onToggleColumn:l,theme:t}),jsx("button",{onClick:()=>ae(!G),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"})}),G&&jsxs("div",{ref:xe,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:U=>U.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:jt},children:ut.map(({task:U,level:Y},pe)=>{let _e=it(U.id),ze=ve===U.id,H=ze&&Ie==="above",le=ze&&Ie==="below",He=ze&&Ie==="child",Ft={};return He&&(Ft.backgroundColor=`${t.accent}15`,Ft.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":U.id,className:`flex items-center cursor-pointer group ${X===U.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:_e?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:_e?t.accentLight:He?`${t.accent}15`:pe%2===0?t.bgPrimary:t.bgGrid,...Ft},onMouseEnter:()=>T(U.id),onMouseLeave:()=>T(null),onClick:rt=>{let $a=Io(e).map(V=>V.id),M=navigator.platform.toUpperCase().indexOf("MAC")>=0?rt.metaKey:rt.ctrlKey;ye(U.id,$a,M,rt.shiftKey),s?.(U);},onDoubleClick:rt=>{rt.stopPropagation(),n?.(U);},onContextMenu:rt=>{rt.preventDefault(),j({isOpen:true,x:rt.clientX,y:rt.clientY,type:"task",task:U}),m?.(U,rt);},whileHover:{backgroundColor:_e?t.accentLight:t.hoverBg},children:[H&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),le&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Be.map((rt,ya)=>{let $a=ya===Be.length-1,ct=rt.id==="name";return jsx("div",{className:`px-4 flex items-center ${ct?"justify-start":"justify-center"}`,style:{width:`${rt.width}px`,minWidth:`${rt.minWidth??(ct?200:60)}px`,maxWidth:`${rt.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:$a?"none":`1px solid ${P===U.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:ke(rt,U,ct?Y:0)},`${U.id}-${rt.id}`)})]},U.id)})}),jsx(Lo,{isOpen:L.isOpen,x:L.x,y:L.y,items:L.type==="header"&&L.columnId?Ce(L.columnId):L.type==="task"&&L.task?$e(L.task):[],onClose:()=>j({...L,isOpen:false}),theme:t}),yt&<&&X&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:lt.x+12,top:lt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let U=ut.find(Y=>Y.task.id===X)?.task;return U?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:U.name})}):null})()}),document.body)]})}function Jc(e,t){let[a,r]=useState("none"),[o,s]=useState(0),[n,m]=useState(e),[g,i]=useState(t),[p,l]=useState(null),[b,v]=useState(null),[k,C]=useState(null),[h,f]=useState(null),[u,x]=useState(0),[c,N]=useState(0),[w,B]=useState(null),[y,I]=useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:m,ghostWidth:g,setGhostWidth:i,connectionLine:p,setConnectionLine:l,hoveredTaskId:b,setHoveredTaskId:v,activeZone:k,setActiveZone:C,draggedSegmentIndex:h,setDraggedSegmentIndex:f,draggedSegmentStartX:u,setDraggedSegmentStartX:x,segmentDragOffsetX:c,setSegmentDragOffsetX:N,hoveredSegmentIndex:w,setHoveredSegmentIndex:B,isHovered:y,setIsHovered:I,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(q,te)=>{r("none"),l(null),v(null),m(q),i(te),N(0),f(null),x(0);}}}function Kn({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:m,onClick:g,onDoubleClick:i,onContextMenu:p,onDateChange:l,onDependencyCreate:b,allTaskPositions:v=[],onDragMove:k,onHoverChange:C}){let h=Jc(t,r),f=useRef(null),u=useRef(null),x=useRef(null),{dragMode:c,setDragMode:N,dragOffset:w,setDragOffset:B,ghostX:y,setGhostX:I,ghostWidth:P,setGhostWidth:T,connectionLine:W,setConnectionLine:O,hoveredTaskId:q,setHoveredTaskId:te,activeZone:ne,setActiveZone:oe,draggedSegmentIndex:ce,setDraggedSegmentIndex:be,draggedSegmentStartX:Le,setDraggedSegmentStartX:A,segmentDragOffsetX:R,setSegmentDragOffsetX:L,hoveredSegmentIndex:j,setHoveredSegmentIndex:X,isHovered:z,setIsHovered:ve,isDragging:se,isResizing:Ie,isConnecting:qe,resetDragState:Qe}=h,ie=32,Xe=8,lt=e.endDate&&e.endDate<new Date&&e.progress<100,kt=e.isCriticalPath,yt=o.name==="neutral"||o.today==="#1C1917",$=e.status==="completed"||e.progress===100,fe={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},G=e.isCriticalPath||lt?"#DC2626":e.color?e.color:e.priority&&fe[e.priority]?fe[e.priority]:o.taskBarPrimary,xe=(Z=>Z>=80?20:Z>=60?15:Z>=50?12:10)(r),Oe=r<50,ye=r<40;useEffect(()=>{if(C)if(z&&!se&&!e.segments){let Z=a<100;C({task:e,x:t,y:a,width:r,height:ie,showBelow:Z});}else C(null);},[z,se,e,t,a,r,ie,C]);let it=Z=>Z.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Ue=()=>{let Z=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${Z} day${Z!==1?"s":""}`},wt=Z=>Math.round(Z/s)*s,ut=Z=>{let ke=Math.round(Z/s),Ce=new Date(n);return Ce.setDate(Ce.getDate()+ke),Ce},Bt=(Z,ke)=>{for(let Ce of v){if(Ce.id===e.id)continue;let $e=5;if(Z>=Ce.x-$e&&Z<=Ce.x+Ce.width+$e&&ke>=Ce.y-$e&&ke<=Ce.y+Ce.height+$e)return Ce.id}return null},jt=useCallback((Z,ke,Ce)=>{Z.preventDefault(),Z.stopPropagation();let $e=f.current?.ownerSVGElement;if(!$e)return;let Be=$e.createSVGPoint();Be.x=Z.clientX,Be.y=Z.clientY;let st=Be.matrixTransform($e.getScreenCTM()?.inverse()),U=Ce!==void 0?Ce:t,Y=ke;if(!Y){let pe=st.x-U;Z.shiftKey?(Y="connect",O({x:t+r,y:a+ie/2})):Z.ctrlKey||Z.metaKey?Y="move":Z.altKey?Y=pe<r/2?"resize-start":"resize-end":ye?pe<r/2?Y="move":Y="resize-end":Oe?pe<=xe/2?Y="resize-start":pe>=r-xe/2?Y="resize-end":Y="move":pe<=xe?Y="resize-start":pe>=r-xe?Y="resize-end":Y="move";}N(Y),ve(false),oe(null),Y==="move"?B(st.x-U):Y==="connect"?O({x:t+r,y:a+ie/2}):B(0),I(U),T(r);},[t,r,a,ie]),Se=useCallback(Z=>{let ke=f.current?.ownerSVGElement;if(!ke)return;let Ce=ke.closest(".gantt-timeline-scroll");if(!Ce)return;let $e=Ce.getBoundingClientRect(),Be=60,st=15,U=0;if(Z.clientX<$e.left+Be){let Y=$e.left+Be-Z.clientX;U=-Math.min(st,Y/2);}else if(Z.clientX>$e.right-Be){let Y=Z.clientX-($e.right-Be);U=Math.min(st,Y/2);}return U!==0&&(Ce.scrollLeft+=U),U!==0},[]),Ve=useCallback(Z=>{if(c==="none")return;x.current=Z;let ke=f.current?.ownerSVGElement;if(!ke)return;if(c==="move"||c==="resize-start"||c==="resize-end"){let Be=Se(Z);Be&&!u.current?u.current=window.setInterval(()=>{x.current&&(Se(x.current),Ve(x.current));},16):!Be&&u.current&&(window.clearInterval(u.current),u.current=null);}let Ce=ke.createSVGPoint();Ce.x=Z.clientX,Ce.y=Z.clientY;let $e=Ce.matrixTransform(ke.getScreenCTM()?.inverse());if(c==="connect"){O({x:$e.x,y:$e.y});let Be=Bt($e.x,$e.y);te(Be);}else if(c==="move"){let Be=$e.x-w,st=wt(Be);I(st),T(r);let U=Math.round((st-t)/s);if(k?.(e.id,U,true),e.segments&&e.segments.length>0&&ce!==null){let Y=st-Le;L(Y);}}else if(c==="resize-start"){let Be=$e.x,st=wt(Be),U=t+r-st;U>=s&&(I(st),T(U));}else if(c==="resize-end"){let Be=$e.x,U=wt(Be)-t;U>=s&&T(U);}},[c,t,r,s,w,e,wt,ce,Le,Bt,te,O,I,T,L,k,Se]),ua=useCallback(()=>{if(u.current&&(window.clearInterval(u.current),u.current=null),x.current=null,c!=="none"){if(c==="connect")q&&b&&b(e,q),O(null),te(null);else {let Z=e.endDate.getTime()-e.startDate.getTime(),ke,Ce,$e=true;if(c==="move"){if(ke=ut(y),Ce=new Date(ke.getTime()+Z),e.segments&&e.segments.length>0&&ce!==null){let Be=Math.round(R/s),st=e.segments.map((_e,ze)=>{if(ze===ce){let H=new Date(_e.startDate),le=new Date(_e.endDate);return H.setDate(H.getDate()+Be),le.setDate(le.getDate()+Be),{startDate:H,endDate:le}}return _e}),U=st.flatMap(_e=>[_e.startDate,_e.endDate]),Y=new Date(Math.min(...U.map(_e=>_e.getTime()))),pe=new Date(Math.max(...U.map(_e=>_e.getTime())));l?.({...e,segments:st},Y,pe),Qe(t,r);return}}else c==="resize-start"?(ke=ut(y),Ce=e.endDate,ke>Ce&&(console.warn("Invalid date range: start date must be before or equal to end date"),$e=false)):c==="resize-end"?(ke=e.startDate,Ce=ut(y+P),Ce<ke&&(console.warn("Invalid date range: end date must be after or equal to start date"),$e=false)):$e=false;$e&&ke&&Ce&&(Ce.getTime()<ke.getTime()?console.warn("Invalid date range: end date cannot be before start date"):l?.(e,ke,Ce));}k?.(e.id,0,false),Qe(t,r);}},[c,y,P,e,l,q,b,t,r,s,ut,R,ce,Qe,k]);useEffect(()=>{if(c==="none")return;let Z=Ce=>{Ve(Ce);},ke=()=>{ua();};return window.addEventListener("mousemove",Z),window.addEventListener("mouseup",ke),()=>{window.removeEventListener("mousemove",Z),window.removeEventListener("mouseup",ke),u.current&&(window.clearInterval(u.current),u.current=null);}},[c,Ve,ua]);let Ze=se&&!qe?y:t,Ke=se&&!qe?P:r,F=m.taskClass(e);return jsxs("g",{ref:f,"data-task-bar":"true",onClick:()=>!se&&g?.(e),onDoubleClick:Z=>{se||(Z.stopPropagation(),i?.(e));},onContextMenu:Z=>{Z.preventDefault(),p?.(e,Z);},onMouseEnter:()=>!se&&ve(true),onMouseLeave:()=>{se||(ve(false),oe(null));},children:[jsx("rect",{x:t,y:a,width:r+24,height:ie,fill:"transparent",style:{pointerEvents:"all"}}),z&&!se&&!Oe&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:xe,height:ie,fill:ne==="resize-start"?o.accent:"transparent",opacity:ne==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>oe("resize-start"),onMouseDown:Z=>jt(Z,"resize-start")}),jsx("rect",{x:t+xe,y:a,width:r-xe*2,height:ie,fill:ne==="move"?o.accent:"transparent",opacity:ne==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>oe("move"),onMouseDown:Z=>jt(Z,"move")}),jsx("rect",{x:t+r-xe,y:a,width:xe,height:ie,fill:ne==="resize-end"?o.accent:"transparent",opacity:ne==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>oe("resize-end"),onMouseDown:Z=>jt(Z,"resize-end")})]}),z&&!se&&ye&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:r/2,height:ie,fill:ne==="move"?o.accent:"transparent",opacity:ne==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>oe("move"),onMouseDown:Z=>jt(Z,"move")}),jsx("rect",{x:t+r/2,y:a,width:r/2,height:ie,fill:ne==="resize-end"?o.accent:"transparent",opacity:ne==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>oe("resize-end"),onMouseDown:Z=>jt(Z,"resize-end")}),z&&jsx(motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+ie-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),se&&!qe&&!e.segments&&jsx(motion.rect,{x:y,y:a,width:P,height:ie,rx:Xe,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:Ze,y:a,width:Ke,height:ie,rx:Xe,fill:G,"data-task-class":F,initial:{opacity:0,scale:.95},animate:{opacity:se&&!qe?.15:e.parentId?.6:z?.9:.8,scale:z&&!se?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Z=>jt(Z),style:{cursor:se?qe?"crosshair":Ie?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsx("rect",{x:Ze,y:a,width:Ke*(e.progress/100),height:ie,rx:Xe,fill:G,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((Z,ke)=>{let Ce=(Z.startDate.getTime()-n.getTime())/864e5*s,Be=(Z.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-Ce+s,st=se&&c==="move"&&ce===ke,U=j===ke,Y=st?Ce+R:Ce;return jsxs("g",{onMouseEnter:()=>!se&&X(ke),onMouseLeave:()=>!se&&X(null),children:[jsx(motion.rect,{x:Y,y:a,width:Be,height:ie,rx:Xe,fill:G,initial:{opacity:0,scale:.95},animate:{opacity:st||e.parentId?.6:U?.9:.8,scale:U&&!se?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:pe=>{pe.stopPropagation(),be(ke),A(Ce),jt(pe,void 0,Ce);},style:{cursor:se?qe?"crosshair":Ie?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsx("rect",{x:Y,y:a,width:Be*(e.progress/100),height:ie,rx:Xe,fill:G,opacity:1,style:{pointerEvents:"none"}})]},`segment-${ke}`)}),yt&&(lt||kt)&&!e.segments&&jsxs(Fragment,{children:[kt&&!lt&&jsx("rect",{x:Ze,y:a,width:Ke,height:ie,rx:Xe,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),lt&&jsx("rect",{x:Ze,y:a,width:Ke,height:ie,rx:Xe,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),Ke>60&&!e.segments&&(()=>{let Z=m.taskLabel(e),ke=typeof Z=="string"?Z:e.name,Ce=ke.length>Math.floor(Ke/8)?`${ke.substring(0,Math.floor(Ke/8))}...`:ke;return jsx("text",{x:Ze+12,y:a+ie/2,dominantBaseline:"middle",fill:$?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:$?"line-through":"none"},children:Ce})})(),Ke>100&&e.progress>0&&e.progress<100&&!se&&!e.segments&&jsxs("text",{x:Ze+Ke-12,y:a+ie/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}),e.status&&Ke>80&&!se&&!e.segments&&jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsx("circle",{cx:Ze+Ke-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsx("circle",{cx:Ze+Ke-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(z||Ie)&&!qe&&!e.segments&&jsxs(Fragment,{children:[jsxs("g",{children:[jsx("rect",{x:Ze-2,y:a,width:16,height:ie,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>oe("resize-start"),onMouseLeave:()=>oe(null),onMouseDown:Z=>{Z.stopPropagation(),jt(Z,"resize-start");}}),jsx(motion.rect,{x:Ze+4,y:a+8,width:3,height:ie-16,rx:1.5,fill:ne==="resize-start"||c==="resize-start"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]}),jsxs("g",{children:[jsx("rect",{x:Ze+Ke-14,y:a,width:16,height:ie,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>oe("resize-end"),onMouseLeave:()=>oe(null),onMouseDown:Z=>{Z.stopPropagation(),jt(Z,"resize-end");}}),jsx(motion.rect,{x:Ze+Ke-7,y:a+8,width:3,height:ie-16,rx:1.5,fill:ne==="resize-end"||c==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsx(AnimatePresence,{children:z&&!se&&!e.segments&&jsxs(motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsx("circle",{cx:t+r+10,cy:a+ie/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>oe("connect"),onMouseLeave:()=>oe(null),onMouseDown:Z=>{Z.stopPropagation(),jt(Z,"connect");}}),jsx(motion.circle,{cx:t+r+10,cy:a+ie/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:ne==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),qe&&W&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:t+r,y1:a+ie/2,x2:W.x,y2:W.y,stroke:q?o.statusCompleted:o.accent,strokeWidth:q?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:q?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:W.x,cy:W.y,r:q?8:6,fill:q?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),q&&jsx(motion.text,{x:W.x+15,y:W.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:W.x+10},animate:{opacity:1,x:W.x+15},transition:{duration:.2},children:"Connect"})]}),(z||se)&&!qe&&!e.segments&&jsx(motion.rect,{x:Ze-2,y:a-2,width:Ke+4,height:ie+4,rx:Xe+2,fill:"none",stroke:se?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:se?.6:.4,initial:{opacity:0},animate:{opacity:se?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Ie&&jsxs(Fragment,{children:[jsx("line",{x1:y,y1:0,x2:y,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsx("line",{x1:y+P,y1:0,x2:y+P,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:z&&!se&&!e.segments&&!C&&(()=>{let Ce=a<100,$e=Ce?a+ie+13:a-82-13,Be=Ce?`M ${Ze+Ke/2-6} ${a+ie+3} L ${Ze+Ke/2} ${a+ie+13} L ${Ze+Ke/2+6} ${a+ie+3}`:`M ${Ze+Ke/2-6} ${a-13} L ${Ze+Ke/2} ${a-3} L ${Ze+Ke/2+6} ${a-13}`,st=$e+22,U=$e+40,Y=$e+55,pe=$e+70,_e=Ce?$e+82-5:a-18;return jsxs(motion.g,{initial:{opacity:0,y:Ce?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:Ce?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:Be,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsx("rect",{x:Ze+Ke/2-120,y:$e,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:Ze+Ke/2,y:st,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:Ze+Ke/2-110,y:U,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:Ze+Ke/2-70,y:U,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:it(e.startDate)}),jsx("text",{x:Ze+Ke/2-110,y:Y,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:Ze+Ke/2-70,y:Y,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:it(e.endDate)}),jsx("text",{x:Ze+Ke/2+10,y:U,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:Ze+Ke/2+65,y:U,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ue()}),jsx("text",{x:Ze+Ke/2+10,y:Y,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:Ze+Ke/2+65,y:Y,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:Ze+Ke/2-110,y:pe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:Ze+Ke/2-50,y:pe,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(ze=>ze.name).join(", ").substring(0,30),e.assignees.map(ze=>ze.name).join(", ").length>30?"...":""]})]}),!Ce&&jsx("text",{x:Ze+Ke/2,y:_e,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:ye?"Left: move \u2022 Right: resize":Oe?"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 em({tooltipData:e,theme:t}){if(!e)return null;let {task:a,x:r,y:o,width:s,height:n,showBelow:m}=e,g=82,i=13,p=m?o+n+i:o-g-i,l=m?`M ${r+s/2-6} ${o+n+3} L ${r+s/2} ${o+n+13} L ${r+s/2+6} ${o+n+3}`:`M ${r+s/2-6} ${o-13} L ${r+s/2} ${o-3} L ${r+s/2+6} ${o-13}`,b=p+22,v=p+40,k=p+55,C=p+70,h=c=>c.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),f=()=>{if(!a.startDate||!a.endDate)return "N/A";let c=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${c} day${c!==1?"s":""}`};return jsx(AnimatePresence,{children:jsxs(motion.g,{initial:{opacity:0,y:m?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:m?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:l,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsx("rect",{x:r+s/2-120,y:p,width:240,height:g,rx:8,fill:t.bgSecondary,stroke:t.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("text",{x:r+s/2,y:b,textAnchor:"middle",fill:t.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:a.name.length>28?`${a.name.substring(0,28)}...`:a.name}),jsx("text",{x:r+s/2-110,y:v,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:r+s/2-70,y:v,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.startDate?h(a.startDate):"N/A"}),jsx("text",{x:r+s/2-110,y:k,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:r+s/2-70,y:k,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?h(a.endDate):"N/A"}),jsx("text",{x:r+s/2+10,y:v,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:r+s/2+65,y:v,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:f()}),jsx("text",{x:r+s/2+10,y:k,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:r+s/2+65,y:k,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.progress,"%"]}),a.assignees&&a.assignees.length>0&&jsxs(Fragment,{children:[jsx("text",{x:r+s/2-110,y:C,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:r+s/2-50,y:C,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.assignees.map(c=>c.name).join(", ").substring(0,30),a.assignees.map(c=>c.name).join(", ").length>30?"...":""]})]})]})})}function Xn({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:m=false}){let[g,i]=useState(false),[p,l]=useState(null),b=r-t,v=b>0,k=Math.abs(b)<5,h=5,f=20,u=!k&&a<=e,x,c;if(k)if(c=(e+a)/2,n==="squared")x=`M ${e} ${t} L ${a} ${r}`;else {let ne=Math.min(Math.abs(a-e)/3,30);x=`M ${e} ${t} C ${e+ne} ${t}, ${a-ne} ${r}, ${a} ${r}`;}else if(c=a-f,u){let oe=e+15,ce=a-f,be=v?t+20:t-20;c=ce,n==="squared"?x=`M ${e} ${t} L ${oe} ${t} L ${oe} ${be} L ${ce} ${be} L ${ce} ${r} L ${a} ${r}`:v?x=`M ${e} ${t} L ${oe-h} ${t} Q ${oe} ${t} ${oe} ${t+h} L ${oe} ${be-h} Q ${oe} ${be} ${oe-h} ${be} L ${ce+h} ${be} Q ${ce} ${be} ${ce} ${be+h} L ${ce} ${r-h} Q ${ce} ${r} ${ce+h} ${r} L ${a} ${r}`:x=`M ${e} ${t} L ${oe-h} ${t} Q ${oe} ${t} ${oe} ${t-h} L ${oe} ${be+h} Q ${oe} ${be} ${oe-h} ${be} L ${ce+h} ${be} Q ${ce} ${be} ${ce} ${be-h} L ${ce} ${r+h} Q ${ce} ${r} ${ce+h} ${r} L ${a} ${r}`;}else n==="squared"?x=`M ${e} ${t} L ${c} ${t} L ${c} ${r} L ${a} ${r}`:v?x=`M ${e} ${t} L ${c-h} ${t} Q ${c} ${t} ${c} ${t+h} L ${c} ${r-h} Q ${c} ${r} ${c+h} ${r} L ${a} ${r}`:x=`M ${e} ${t} L ${c-h} ${t} Q ${c} ${t} ${c} ${t-h} L ${c} ${r+h} Q ${c} ${r} ${c+h} ${r} L ${a} ${r}`;let N=5,w=`M ${a} ${r} L ${a-N} ${r-N*.5} M ${a} ${r} L ${a-N} ${r+N*.5}`,B=o.dependency,y=o.dependencyHover||B,I="#f87171",P="rgba(248, 113, 113, 0.15)",T=c,W=(t+r)/2;if(p)if(k)T=Math.max(e+10,Math.min(a-10,p.x)),W=t;else if(u){let ne=e+15,oe=a-f,ce=v?t+20:t-20,be=[[e,t,ne,t],[ne,t,ne,ce],[ne,ce,oe,ce],[oe,ce,oe,r],[oe,r,a,r]],Le=1/0,A={x:T,y:W};for(let R of be){let L=O(p.x,p.y,R[0],R[1],R[2],R[3]),j=Math.hypot(p.x-L.x,p.y-L.y);j<Le&&(Le=j,A=L);}T=A.x,W=A.y;}else {let ne=[[e,t,c,t],[c,t,c,r],[c,r,a,r]],oe=1/0,ce={x:T,y:W};for(let be of ne){let Le=O(p.x,p.y,be[0],be[1],be[2],be[3]),A=Math.hypot(p.x-Le.x,p.y-Le.y);A<oe&&(oe=A,ce=Le);}T=ce.x,W=ce.y;}function O(ne,oe,ce,be,Le,A){let R=Le-ce,L=A-be,j=R*R+L*L;if(j===0)return {x:ce,y:be};let X=((ne-ce)*R+(oe-be)*L)/j;return X=Math.max(0,Math.min(1,X)),{x:ce+X*R,y:be+X*L}}let q=ne=>{let oe=ne.currentTarget.ownerSVGElement;if(!oe)return;let ce=oe.getBoundingClientRect();l({x:ne.clientX-ce.left,y:ne.clientY-ce.top});},te=()=>{i(false),l(null);};return m?jsxs("g",{"data-dependency-line":"true",onMouseLeave:te,onMouseMove:q,children:[jsx("path",{d:x,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsx("path",{d:x,fill:"none",stroke:y,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsx("path",{d:x,fill:"none",stroke:y,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("path",{d:w,fill:"none",stroke:y,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("circle",{cx:a,cy:r,r:4,fill:y,opacity:.9,style:{pointerEvents:"none"}}),s&&jsxs(motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:ne=>{ne.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsx("circle",{cx:T,cy:W,r:9,fill:P,stroke:I,strokeWidth:1.5}),jsx("line",{x1:T-3,y1:W-3,x2:T+3,y2:W+3,stroke:I,strokeWidth:1.5,strokeLinecap:"round"}),jsx("line",{x1:T+3,y1:W-3,x2:T-3,y2:W+3,stroke:I,strokeWidth:1.5,strokeLinecap:"round"})]})]}):jsxs("g",{"data-dependency-line":"true",onMouseEnter:()=>i(true),onMouseLeave:te,onMouseMove:q,style:{cursor:s?"pointer":"default"},children:[jsx("path",{d:x,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsx(motion.path,{d:x,fill:"none",stroke:g?y:B,strokeWidth:g?2.5:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}}}),jsx(motion.path,{d:w,fill:"none",stroke:g?y:B,strokeWidth:g?2.5:2,strokeLinecap:"round",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3}}),jsx(motion.circle,{cx:a,cy:r,r:g?4:3,fill:g?y:B,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15}}),g&&s&&jsxs(motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.15},onClick:ne=>{ne.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsx("circle",{cx:T,cy:W,r:9,fill:P,stroke:I,strokeWidth:1.5}),jsx("line",{x1:T-3,y1:W-3,x2:T+3,y2:W+3,stroke:I,strokeWidth:1.5,strokeLinecap:"round"}),jsx("line",{x1:T+3,y1:W-3,x2:T-3,y2:W+3,stroke:I,strokeWidth:1.5,strokeLinecap:"round"})]})]})}function Zn({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=useState(false),m=16,g=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxs("g",{"data-task-bar":"true",onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsx(motion.circle,{cx:t,cy:a+16,r:m+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsx(motion.rect,{x:t-m/2,y:a+16-m/2,width:m,height:m,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsx(motion.rect,{x:t-(m+4)/2,y:a+16-(m+4)/2,width:m+4,height:m+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsx(AnimatePresence,{children:s&&jsxs(motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:g(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 he={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(p=>{p.dependencies&&r.set(p.id,p.dependencies),p.subtasks&&o(p.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,m=new Set,g=i=>{if(!n.has(i)){n.add(i),m.add(i);let p=r.get(i)||[];for(let l of p){if(!n.has(l)&&g(l))return true;if(m.has(l))return true}}return m.delete(i),false};return g(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=he.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=he.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=he.findTaskById(e,o);if(s)a.unshift(s),o=s.parentId;else break}return a},exportToJSON:e=>JSON.stringify(e,null,2),importFromJSON:e=>{try{let t=JSON.parse(e);if(!Array.isArray(t))throw new Error("Invalid JSON: expected an array of tasks");return t.forEach((a,r)=>{if(!a.id||!a.name)throw new Error(`Invalid task at index ${r}: missing required fields (id, name)`)}),t}catch(t){throw new Error(`Failed to import tasks: ${t instanceof Error?t.message:"Unknown error"}`)}},exportToCSV:e=>{let t=he.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let s=[o.id,`"${o.name.replace(/"/g,'""')}"`,o.startDate?o.startDate.toISOString().split("T")[0]:"",o.endDate?o.endDate.toISOString().split("T")[0]:"",o.progress.toString(),o.status||"",o.dependencies?.join(";")||""];r.push(s.join(","));}),r.join(`
|
|
112
|
-
`)},formatDate:e=>{let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return `${t}-${a}-${r}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let a=he.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=he.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)=>he.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=he.findTaskById(e,t);return !a||!a.dependencies?[]:he.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>he.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>he.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=he.flattenTasks(e);if(t.length===0)return 0;let a=t.reduce((r,o)=>r+o.progress,0);return Math.round(a/t.length)},getTaskByPath:(e,t)=>{let a=e,r;for(let o=0;o<t.length;o++){let s=t[o];if(!a||s===void 0||s>=a.length||(r=a[s],!r))return;o<t.length-1&&(a=r.subtasks||[]);}return r},cloneTask:(e,t)=>({...e,id:t||`${e.id}-copy`,subtasks:e.subtasks?.map(a=>he.cloneTask(a))}),exportToPDF:async(e,t="gantt-chart.pdf")=>{try{if(!e||e.length===0){alert("No tasks available to export to PDF");return}let{jsPDF:a}=await import('jspdf'),{default:r}=await import('jspdf-autotable'),o=new a,s=he.flattenTasks(e);if(s.length===0){alert("No tasks found to export");return}o.setFontSize(16),o.text("Gantt Chart - Task List",14,20);let n=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],
|
|
111
|
+
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function xi({templates:e,onSelectTemplate:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null);useEffect(()=>{function i(p){s.current&&!s.current.contains(p.target)&&n.current&&!n.current.contains(p.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let c=i=>{t(i),o(false);},g=e.reduce((i,p)=>{let d=p.category||"Other";return i[d]||(i[d]=[]),i[d].push(p),i},{});return jsxs("div",{className:l("relative inline-block",a),children:[jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsx("span",{children:"Templates"}),jsx("svg",{className:l("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(g).map(([i,p])=>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:p.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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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 wi({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,c]=useState("export"),[g,i]=useState("json"),[p,d]=useState(null),f=useRef(null);if(!t)return null;let y=async()=>{let C=o?.current||void 0,h=await md(e,g,C);pd(h,g);},k=async C=>{let h=C.target.files?.[0];if(h){try{let b=await fd(h),u=h.name.endsWith(".json")?"json":"csv",x=gd(b,u);d(x),x.success&&r&&r(x,b);}catch(b){d({success:false,errors:[`Failed to read file: ${b instanceof Error?b.message:"Unknown error"}`]});}f.current&&(f.current.value="");}};return jsxs("div",{className:l("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxs("div",{className:"flex border-b border-white/10",children:[jsx("button",{onClick:()=>c("export"),className:l("flex-1 px-6 py-4 font-semibold transition-colors",n==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsx("button",{onClick:()=>c("import"),className:l("flex-1 px-6 py-4 font-semibold transition-colors",n==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxs("div",{className:"p-6",children:[n==="export"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(C=>jsxs("button",{onClick:()=>i(C),className:l("p-4 rounded-lg border-2 transition-all text-center",g===C?"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:[C==="json"&&"\u{1F4C4}",C==="csv"&&"\u{1F4CA}",C==="pdf"&&"\u{1F4DD}"]}),jsx("div",{className:"font-semibold uppercase text-xs",children:C})]},C))})]}),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:y,className:"w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600 text-white font-semibold rounded-lg transition-all shadow-lg shadow-blue-500/20",children:"Export Board"})]}),n==="import"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsx("input",{ref:f,type:"file",accept:".json,.csv",onChange:k,className:"hidden"}),jsxs("button",{onClick:()=>f.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"})]})]}),p&&jsxs("div",{className:l("p-4 rounded-lg",p.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsx("h3",{className:l("font-semibold mb-2",p.success?"text-green-400":"text-red-400"),children:p.success?"\u2713 Import Successful":"\u2717 Import Failed"}),p.success&&jsxs("div",{className:"text-sm text-white/80",children:[jsxs("div",{children:["Cards imported: ",p.cardsImported]}),jsxs("div",{children:["Columns imported: ",p.columnsImported]})]}),p.errors&&p.errors.length>0&&jsx("div",{className:"mt-2 text-sm",children:p.errors.map((C,h)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",C]},h))})]})]})]})]})]})}var y0=["URGENT","HIGH","MEDIUM","LOW"],v0=[{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"}],x0=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Ci({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:c,availableUsers:g=[],availableLabels:i=[],availableColumns:p=[],showQuickFilters:d=true,compact:f=false,groupBy:y="none",onGroupByChange:k}){let[C,h]=useState(true),b=useCallback(w=>{a({search:w.target.value});},[a]),u=useCallback(w=>{a({dateFilter:w.target.value});},[a]),x=useCallback(w=>{r({by:w.target.value});},[r]),m=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 ${f?"filter-bar--compact":""} ${C?"filter-bar--collapsed":""}`,children:[jsxs("div",{className:"filter-bar__header",onClick:()=>h(!C),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:C?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:w=>{w.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:w=>{w.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:C?"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)"]})]}),!C&&jsxs("div",{className:"filter-bar__content",children:[d&&jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),n&&jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),c&&jsx("button",{onClick:c,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxs("div",{className:"filter-bar__main",children:[jsx("div",{className:"filter-bar__field",children:jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:b,className:"filter-bar__search"})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.dateFilter,onChange:u,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:w=>{let B=w.target.value;a({priorities:B==="all"?[]:[B]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Priorities"}),y0.map(w=>jsx("option",{value:w,children:w},w))]})}),g.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.assignees[0]||"all",onChange:w=>{let B=w.target.value;a({assignees:B==="all"?[]:[B]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Assignees"}),g.map(w=>jsx("option",{value:w.id,children:w.name},w.id))]})}),i.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.labels[0]||"all",onChange:w=>{let B=w.target.value;a({labels:B==="all"?[]:[B]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Labels"}),i.map(w=>jsx("option",{value:w,children:w},w))]})}),jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsx("select",{value:t.by,onChange:x,className:"filter-bar__select filter-bar__select--sm",children:v0.map(w=>jsx("option",{value:w.value,children:w.label},w.value))}),t.by!=="none"&&jsx("button",{onClick:m,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),k&&jsx("div",{className:"filter-bar__field",children:jsx("select",{value:y,onChange:w=>k(w.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:x0.map(w=>jsx("option",{value:w.value,children:w.label},w.value))})}),N&&jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Ti({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:c,onExportGanttCSV:g}){let[i,p]=useState(false),d=useRef(null);useEffect(()=>{let y=k=>{d.current&&!d.current.contains(k.target)&&p(false);};return i&&document.addEventListener("mousedown",y),()=>{document.removeEventListener("mousedown",y);}},[i]);let f=y=>{y(),p(false);};return jsxs("div",{className:l("relative",r),ref:d,children:[jsxs("button",{onClick:()=>p(!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:y=>{y.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",y.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:y=>{y.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",y.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:()=>f(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:y=>{y.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:y=>{y.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:()=>f(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:y=>{y.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:y=>{y.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:()=>f(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:y=>{y.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:y=>{y.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:()=>f(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:y=>{y.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:y=>{y.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:()=>f(()=>g?.()),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:y=>{y.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:y=>{y.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:()=>f(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:y=>{y.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:y=>{y.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:()=>f(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:y=>{y.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:y=>{y.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 Ni={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"}},Di={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"}},Si={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"}},co={dark:Ni,light:Di,neutral:Si},Un="dark";var zn=createContext(void 0),M0="asakaa-theme";function Pc({children:e,defaultTheme:t=Un,storageKey:a=M0}){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}),s=useCallback(c=>{o(c),typeof window<"u"&&localStorage.setItem(a,c);},[a]);useEffect(()=>{if(typeof window>"u")return;let c=document.documentElement,g=co[r];Object.entries(g.colors).forEach(([p,d])=>{d&&c.style.setProperty(`--theme-${A0(p)}`,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(([p,d])=>{let f=g.colors[p];f&&c.style.setProperty(d,f);}),c.setAttribute("data-theme",r),c.classList.remove("theme-dark","theme-light","theme-neutral"),c.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:co};return jsx(zn.Provider,{value:n,children:e})}function Ao(){let e=useContext(zn);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function A0(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Ei({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=Ao();return e?jsxs("div",{className:l("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(co).map(([s,n])=>jsxs("button",{onClick:()=>{o(s),t();},className:l("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsx("div",{className:"text-3xl",children:n.emoji}),jsxs("div",{className:"text-left flex-1",children:[jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:n.displayName}),jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),r===s&&jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}function Mc(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return rt[e]||rt.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",rt[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",rt[e].bgSecondary),bgGrid:r("--theme-bg-card",rt[e].bgGrid),bgWeekend:r("--theme-bg-hover",rt[e].bgWeekend),border:r("--theme-border-primary",rt[e].border),borderLight:r("--theme-border-subtle",rt[e].borderLight),textPrimary:r("--theme-text-primary",rt[e].textPrimary),textSecondary:r("--theme-text-secondary",rt[e].textSecondary),textTertiary:r("--theme-text-tertiary",rt[e].textTertiary),accent:r("--theme-accent-primary",rt[e].accent),accentHover:r("--theme-accent-hover",rt[e].accentHover),accentLight:r("--theme-accent-primary",rt[e].accentLight),taskBarPrimary:r("--theme-accent-primary",rt[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",rt[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",rt[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",rt[e].dependency),dependencyHover:r("--theme-border-secondary",rt[e].dependencyHover),criticalPath:r("--theme-error",rt[e].criticalPath),criticalPathLight:r("--theme-error",rt[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",rt[e].today):e==="neutral"?r("--theme-text-primary",rt[e].today):r("--theme-error",rt[e].today),todayLight:e==="light"?r("--theme-accent-primary",rt[e].todayLight):e==="neutral"?r("--theme-text-primary",rt[e].todayLight):r("--theme-error",rt[e].todayLight),milestone:r("--theme-warning",rt[e].milestone),milestoneLight:r("--theme-warning",rt[e].milestoneLight),statusTodo:r("--theme-text-tertiary",rt[e].statusTodo),statusInProgress:r("--theme-accent-primary",rt[e].statusInProgress),statusCompleted:r("--theme-success",rt[e].statusCompleted),hoverBg:r("--theme-bg-hover",rt[e].hoverBg),focusRing:r("--theme-accent-primary",rt[e].focusRing)}}var Hn={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious",filterAll:"All",filterIncomplete:"Incomplete",filterInProgress:"In Progress",filterCompleted:"Completed",filter:"Filter",filterBy:"Filter by status",filterAllDesc:"Show all tasks",filterIncompleteDesc:"Hide completed tasks",filterInProgressDesc:"Tasks currently being worked on",filterCompletedDesc:"Only show finished tasks",clearFilter:"Clear filter"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today",week:"Week",clickToSetDates:"Click to set dates..."},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},Ac={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso",filterAll:"Todas",filterIncomplete:"Sin completar",filterInProgress:"En progreso",filterCompleted:"Completadas",filter:"Filtrar",filterBy:"Filtrar por estado",filterAllDesc:"Mostrar todas las tareas",filterIncompleteDesc:"Ocultar tareas completadas",filterInProgressDesc:"Tareas en las que se est\xE1 trabajando",filterCompletedDesc:"Solo mostrar tareas terminadas",clearFilter:"Limpiar filtro"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy",week:"Semana",clickToSetDates:"Clic para establecer fechas..."},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},Pi={en:Hn,es:Ac};function Fc(e){return Pi[e]||Pi.en}function Mi(e,t){let a=Fc(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 Lo=createContext(Hn);function Vr(){return useContext(Lo)}function K0({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[c,g]=useState(false),[i,p]=useState(null),d=useRef(null),f=Vr();if(useEffect(()=>{let h=b=>{d.current&&!d.current.contains(b.target)&&g(false);};return c&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[c]),!(t||a||r||o||s||n))return null;let k=[{id:"png",label:"PNG",description:"Image",icon:jsx(FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsx(FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsx(FolderKanban,{className:"w-4 h-4"}),handler:n}].filter(h=>h.handler),C=async(h,b)=>{if(b){p(h);try{await b();}catch(u){console.error(`Export ${h} failed:`,u);}finally{p(null),g(false);}}};return jsxs("div",{ref:d,className:"relative",children:[jsxs(motion.button,{onClick:()=>g(!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:f.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:k.map((h,b)=>jsxs(motion.button,{onClick:()=>C(h.id,h.handler),disabled:i!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:b<k.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:b*.03},children:[jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===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 Y0({options:e,value:t,onChange:a,theme:r,layoutId:o="activeSegment"}){return jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(s=>{let n=t===s.value;return jsxs(motion.button,{onClick:()=>a(s.value),className:"relative px-3 py-1.5 rounded-md text-xs transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:n?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:n?600:500,zIndex:n?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[n&&jsx(motion.div,{layoutId:o,className:"absolute inset-0 rounded-md",style:{backgroundColor:r.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.icon}),jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function q0({options:e,value:t,onChange:a,theme:r}){return jsx("div",{className:"inline-flex items-center gap-1",children:e.map(o=>{let s=t===o.value;return jsxs(motion.button,{onClick:()=>a(o.value),className:"relative px-3 py-1.5 text-xs transition-all",style:{color:s?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsx("span",{children:o.label}),s&&jsx(motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:r.accent},transition:{type:"spring",stiffness:400,damping:30}})]},o.value)})})}function X0({theme:e,value:t,onChange:a}){let[r,o]=useState(false),s=useRef(null),n=Vr();useEffect(()=>{let i=p=>{s.current&&!s.current.contains(p.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let c=[{value:"compact",label:n.toolbar.compact||"Compact"},{value:"comfortable",label:n.toolbar.normal||"Normal"},{value:"spacious",label:n.toolbar.spacious||"Spacious"}],g=c.find(i=>i.value===t)?.label||"Normal";return jsxs("div",{ref:s,className:"relative",children:[jsx(motion.button,{onClick:()=>o(!r),className:"flex items-center justify-center p-2 rounded-lg transition-all",style:{backgroundColor:r?e.accentLight:e.bgSecondary,border:`1px solid ${r?e.accent:e.borderLight}`,color:r?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${n.toolbar.density||"Density"}: ${g}`,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,p)=>{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:p<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:p*.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 J0({theme:e,value:t,onChange:a}){let[r,o]=useState(false),s=useRef(null),n=Vr();useEffect(()=>{let i=p=>{s.current&&!s.current.contains(p.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let c=[{value:"all",label:n.toolbar.filterAll||"All tasks",description:n.toolbar.filterAllDesc||"Show all tasks"},{value:"incomplete",label:n.toolbar.filterIncomplete||"Incomplete only",description:n.toolbar.filterIncompleteDesc||"Hide completed tasks"},{value:"in_progress",label:n.toolbar.filterInProgress||"In progress",description:n.toolbar.filterInProgressDesc||"Tasks currently being worked on"},{value:"completed",label:n.toolbar.filterCompleted||"Completed",description:n.toolbar.filterCompletedDesc||"Only show finished tasks"}],g=t!=="all";return jsxs("div",{ref:s,className:"relative",children:[jsxs(motion.button,{onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:g||r?e.accentLight:e.bgSecondary,border:`1px solid ${g||r?e.accent:e.borderLight}`,color:g||r?e.accent:e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.accentLight,borderColor:e.accent,color:e.accent,scale:1.02},whileTap:{scale:.98},children:[jsx(Filter,{className:"w-3.5 h-3.5"}),jsx("span",{children:n.toolbar.filter||"Filter"}),g&&jsx(motion.span,{initial:{scale:0},animate:{scale:1},className:"flex items-center justify-center w-4 h-4 rounded-full text-[10px] font-semibold",style:{backgroundColor:e.accent,color:"#FFFFFF"},children:"1"}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:r?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:r&&jsxs(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-56 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:[jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:e.borderLight},children:jsx("span",{className:"text-xs font-medium",style:{color:e.textTertiary},children:n.toolbar.filterBy||"Filter by status"})}),jsx("div",{className:"py-1",children:c.map((i,p)=>{let d=t===i.value;return jsxs(motion.button,{onClick:()=>{a(i.value),o(false);},className:"w-full flex items-start gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:d?e.accentLight:"transparent"},whileHover:{backgroundColor:d?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:p*.03},children:[jsx("div",{className:"flex items-center justify-center w-4 h-4 rounded border mt-0.5 flex-shrink-0",style:{borderColor:d?e.accent:e.border,backgroundColor:d?e.accent:"transparent"},children:d&&jsx(Check,{className:"w-3 h-3",style:{color:"#FFFFFF"}})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium",style:{color:d?e.accent:e.textPrimary},children:i.label}),jsx("div",{className:"text-[10px] mt-0.5",style:{color:e.textTertiary},children:i.description})]})]},i.value)})}),g&&jsx("div",{className:"px-3 py-2 border-t",style:{borderColor:e.borderLight},children:jsx(motion.button,{onClick:()=>{a("all"),o(false);},className:"w-full text-xs py-1.5 rounded-md",style:{color:e.textTertiary},whileHover:{backgroundColor:e.hoverBg,color:e.textSecondary},children:n.toolbar.clearFilter||"Clear filter"})})]})})]})}function Gn({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:c,onRowDensityChange:g,showThemeSelector:i=false,showCreateTaskButton:p=false,createTaskLabel:d,onCreateTask:f,taskFilter:y="all",onTaskFilterChange:k,onExportPNG:C,onExportPDF:h,onExportExcel:b,onExportCSV:u,onExportJSON:x,onExportMSProject:m}){let N=Vr(),w=C||h||b||u||x||m,B=[{value:"day",label:N.toolbar.day},{value:"week",label:N.toolbar.week},{value:"month",label:N.toolbar.month}],v=[{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(q0,{options:B,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(X0,{theme:e,value:c,onChange:g}),k&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsx(J0,{theme:e,value:y,onChange:k})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[p&&f&&jsxs(Fragment,{children:[jsxs(motion.button,{onClick:f,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||N.toolbar.createTask})]}),(w||i)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),w&&jsxs(Fragment,{children:[jsx(K0,{theme:e,onExportPNG:C,onExportPDF:h,onExportExcel:b,onExportCSV:u,onExportJSON:x,onExportMSProject:m}),i&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsx(Y0,{options:v,value:s,onChange:I=>n(I),theme:e})]})]})}function _n({columns:e,onToggleColumn:t,theme:a}){let[r,o]=useState(false),[s,n]=useState({x:0,y:0}),c=useRef(null),g=useRef(null);useEffect(()=>{if(!r)return;let p=d=>{c.current&&!c.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[r]);let i=e.filter(p=>p.id!=="name");return jsxs(Fragment,{children:[jsx(motion.button,{ref:g,onClick:()=>{if(!r&&g.current){let p=g.current.getBoundingClientRect();n({x:p.left,y:p.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(Plus,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:r&&jsx(ht,{children:jsx(motion.div,{ref:c,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor: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(p=>jsxs("button",{onClick:()=>{t(p.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:p.label}),p.visible&&jsx(Check,{className:"w-4 h-4",style:{color:a.accent}})]},p.id))]})})})})]})}function Io({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=useRef(null),[c,g]=useState({x:t,y:a});if(useEffect(()=>{if(!e)return;let p=200,d=r.length*36+8,f=8,y=window.innerWidth,k=window.innerHeight,C=t,h=a;t+p+f>y&&(C=t-p,C<f&&(C=f)),a+d+f>k&&(h=k-d-f,h<f&&(h=f)),g({x:C,y:h});},[e,t,a,r.length]),useEffect(()=>{if(!e)return;let p=f=>{n.current&&!n.current.contains(f.target)&&o();},d=f=>{f.key==="Escape"&&o();};return document.addEventListener("mousedown",p),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",d);}},[e,o]),!e)return null;let i=p=>p.startsWith("#")&&(p.length===7||p.length===4)?p:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsx(AnimatePresence,{children:jsx(motion.div,{ref:n,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${c.x}px`,top:`${c.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsx("div",{className:"py-1",children:r.map(p=>jsxs("div",{children:[p.separator&&jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxs("button",{onClick:()=>{p.disabled||(p.onClick(),o());},disabled:p.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:p.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:p.disabled?"not-allowed":"pointer",opacity:p.disabled?.5:1},onMouseEnter:d=>{p.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[p.icon&&jsx("span",{style:{color:s.textSecondary},children:p.icon}),jsx("span",{className:"flex-1",children:p.label}),p.submenu&&jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},p.id))})})})}var Gt={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 Gc({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:c,onTaskOutdent:g,onTaskRename:i,onTaskToggleExpand:p,onOpenTaskModal:d,enableKeyboard:f=true}){let y=useRef(false),k=useCallback(x=>{y.current=x;},[]),C=useCallback(x=>{let m=[],N=w=>{for(let B of w)m.push(B),B.subtasks&&B.subtasks.length>0&&B.isExpanded&&N(B.subtasks);};return N(x),m},[]),h=useCallback(()=>{let x=C(e);for(let m of x)if(t.has(m.id))return m;return null},[e,t,C]),b=useCallback((x,m)=>{let N=C(e);if(N.length===0)return;let w=h();if(!w){a(N[0].id,false);return}let B=N.findIndex(A=>A.id===w.id);if(B===-1)return;let v=x==="up"?B-1:B+1;if(v<0||v>=N.length)return;let I=N[v];a(I.id,m);},[e,h,C,a]),u=useCallback(x=>{if(!f)return;let m=x.target;if(m.tagName==="INPUT"||m.tagName==="TEXTAREA"||m.isContentEditable||y.current){x.key==="Escape"&&(m.blur(),y.current=false);return}let B=navigator.platform.toUpperCase().indexOf("MAC")>=0?x.metaKey:x.ctrlKey,v=Array.from(t),I=h();if(x.key==="ArrowUp"){x.preventDefault(),b("up",x.shiftKey);return}if(x.key==="ArrowDown"){x.preventDefault(),b("down",x.shiftKey);return}if(I&&(x.key==="ArrowRight"||x.key==="ArrowLeft")){I.subtasks&&I.subtasks.length>0&&(x.preventDefault(),(x.key==="ArrowRight"&&!I.isExpanded||x.key==="ArrowLeft"&&I.isExpanded)&&p(I.id));return}if(x.altKey&&(x.key==="ArrowUp"||x.key==="ArrowDown")){v.length>0&&(x.preventDefault(),n(v,x.key==="ArrowUp"?"up":"down"));return}if(x.key==="Tab"&&!x.shiftKey){v.length>0&&(x.preventDefault(),c(v));return}if(x.key==="Tab"&&x.shiftKey){v.length>0&&(x.preventDefault(),g(v));return}if(x.key==="Enter"&&!x.shiftKey&&!B){I&&(x.preventDefault(),r(I.id,"below"));return}if(x.key==="Enter"&&x.shiftKey&&!B){I&&(x.preventDefault(),r(I.id,"above"));return}if(x.key==="Enter"&&B){I&&(x.preventDefault(),d(I.id));return}if(x.key==="F2"){I&&(x.preventDefault(),i(I.id));return}if(x.key==="Delete"||x.key==="Backspace"&&B){v.length>0&&(x.preventDefault(),o(v));return}if(x.key==="d"&&B&&!x.shiftKey){v.length>0&&(x.preventDefault(),s(v));return}},[f,t,h,b,r,o,s,n,c,g,i,p,d]);return useEffect(()=>{if(f)return window.addEventListener("keydown",u),()=>{window.removeEventListener("keydown",u);}},[f,u]),{setIsEditing:k}}function Vc(){let[e,t]=useState(new Set),[a,r]=useState(null),o=useCallback(d=>{t(new Set([d])),r(d);},[]),s=useCallback(d=>{t(f=>{let y=new Set(f);return y.has(d)?y.delete(d):y.add(d),y}),r(d);},[]),n=useCallback((d,f)=>{if(!a){o(d);return}let y=f.indexOf(a),k=f.indexOf(d);if(y===-1||k===-1){o(d);return}let C=Math.min(y,k),h=Math.max(y,k),b=f.slice(C,h+1);t(new Set(b)),r(d);},[a,o]),c=useCallback((d,f,y,k)=>{k?n(d,f):y?s(d):o(d);},[o,s,n]),g=useCallback((d,f)=>{f?t(y=>{let k=new Set(y);return k.add(d),k}):o(d);},[o]),i=useCallback(()=>{t(new Set),r(null);},[]),p=useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:c,handleKeyboardSelection:g,clearSelection:i,isTaskSelected:p}}function Bo(e){let t=[],a=(r,o,s=0)=>{for(let n=0;n<r.length;n++){let c={...r[n],parentId:o,level:s,position:n};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function jc(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=jc(a.subtasks,t);if(r)return r}}return null}function Ri(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=Ri(a.subtasks,t);if(r)return r}return null}function Oi(e,t){if(t.length===0)return e;let a=Bo(e),r=t[0],o=a.findIndex(d=>d.id===r);if(o<=0)return e;let s=a[o-1],n=(d,f)=>{let y=[];return {tasks:d.filter(C=>{if(f.has(C.id))return y.push(C),false;if(C.subtasks){let h=n(C.subtasks,f);C.subtasks=h.tasks,y.push(...h.removed);}return true}),removed:y}},c=(d,f,y)=>d.map(k=>k.id===f?{...k,subtasks:[...k.subtasks||[],...y],isExpanded:true}:k.subtasks?{...k,subtasks:c(k.subtasks,f,y)}:k),g=new Set(t),{tasks:i,removed:p}=n(e,g);return c(i,s.id,p)}function $i(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=Ri(a,r);if(!o)continue;let s=Ri(a,o.id),n=(i,p,d)=>{for(let f=0;f<i.length;f++){let y=i[f];if(y.id===p&&y.subtasks){let k=y.subtasks.findIndex(C=>C.id===d);if(k!==-1){let[C]=y.subtasks.splice(k,1);return C}}if(y.subtasks){let k=n(y.subtasks,p,d);if(k)return k}}return null},c=(i,p,d)=>{let f=i.findIndex(y=>y.id===p);if(f!==-1)return i.splice(f+1,0,d),i;for(let y of i)y.subtasks&&c(y.subtasks,p,d);return i},g=n(a,o.id,r);g&&(s&&s.subtasks?c(s.subtasks,o.id,g):c(a,o.id,g));}return a}function Ui(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,c,g)=>{let i=n.findIndex(d=>d.id===c);if(i===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,c,g))return true;return false}let p=g==="up"?i-1:i+1;return p<0||p>=n.length?false:([n[i],n[p]]=[n[p],n[i]],true)};return s(r,o,a),r}function zi(e,t){let a=new Set(t),r=o=>o.filter(s=>!a.has(s.id)).map(s=>s.subtasks?{...s,subtasks:r(s.subtasks)}:s);return r(e)}function Hi(e,t){let a=[...e];for(let r of t){let o=n=>{let c=n.findIndex(p=>p.id===r);if(c===-1){for(let p of n)if(p.subtasks&&o(p.subtasks))return true;return false}let g=n[c],i={...g,id:`${g.id}-copy-${Date.now()}`,name:`${g.name} (Copy)`,subtasks:g.subtasks?s(g.subtasks):void 0};return n.splice(c+1,0,i),true},s=n=>n.map(c=>({...c,id:`${c.id}-copy-${Date.now()}`,subtasks:c.subtasks?s(c.subtasks):void 0}));o(a);}return a}function Kc(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#6366F1"},c=g=>{let i=g.findIndex(d=>d.id===t);if(i===-1){for(let d of g)if(d.subtasks&&c(d.subtasks))return true;return false}let p=a==="above"?i:i+1;return g.splice(p,0,n),true};return c(r),{tasks:r,newTask:n}}function Wi(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:Wi(r.subtasks,t,a)}:r)}function Gi(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:Gi(a.subtasks,t)}:a)}function _i(e,t){let a=p=>{for(let d of p){if(d.id===t)return d;if(d.subtasks){let f=a(d.subtasks);if(f)return f}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,c=r?.endDate||s,g={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(c),color:r?.color||"#3B82F6"},i=p=>p.map(d=>{if(d.id===t){let f=d.subtasks||[];return {...d,subtasks:[...f,g],isExpanded:true}}return d.subtasks?{...d,subtasks:i(d.subtasks)}:d});return {tasks:i(e),newTask:g}}function Yc(e,t,a,r){if(t===a)return e;let o=jc(e,t);if(!o)return e;if(a){let c=(g,i)=>{if(!g.subtasks)return false;for(let p of g.subtasks)if(p.id===i||c(p,i))return true;return false};if(c(o,a))return e}let s=c=>c.filter(g=>g.id!==t).map(g=>g.subtasks&&g.subtasks.length>0?{...g,subtasks:s(g.subtasks)}:g),n=s(e);if(a===null){let c=r!==void 0?r:n.length;n.splice(c,0,{...o,parentId:void 0});}else {let c=g=>g.map(i=>{if(i.id===a){let p=i.subtasks||[],d=r!==void 0?r:p.length,f=[...p];return f.splice(d,0,{...o,parentId:a}),{...i,subtasks:f,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:c(i.subtasks)}:i});n=c(n);}return n}function Kn({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:c,onTaskToggle:g,scrollTop:i,columns:p,onToggleColumn:d,onColumnResize:f,onTaskUpdate:y,onTaskIndent:k,onTaskOutdent:C,onTaskMove:h,onMultiTaskDelete:b,onTaskDuplicate:u,onTaskCreate:x,onTaskRename:m,onCreateSubtask:N,onOpenTaskModal:w,onDeleteRequest:B,onTaskReparent:v}){let I=useContext(Lo),[A,T]=useState(null),[H,O]=useState(null),[j,ae]=useState(""),ne=useRef(null),[re,ge]=useState(null),[fe,Ie]=useState(0),[M,R]=useState(0),[L,V]=useState({isOpen:false,x:0,y:0,type:"header"}),[q,z]=useState(null),[ye,se]=useState(null),[Be,Ye]=useState(null),tt=useRef(0),ie=5,Je=useRef(false),[mt,Ct]=useState(null),[xt,$]=useState(false),[be,Pe]=useState(null),[Me,je]=useState(false),Ze=useRef(null);useEffect(()=>{function U(Y){Ze.current&&!Ze.current.contains(Y.target)&&je(false);}if(Me)return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[Me]),useEffect(()=>{H&&ne.current&&(ne.current.focus(),ne.current.select());},[H]),useEffect(()=>{if(!re)return;let U=me=>{let Ve=me.clientX-fe,He=M+Ve;f?.(re,He);},Y=()=>{ge(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",U),document.addEventListener("mouseup",Y),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",U),document.removeEventListener("mouseup",Y),document.body.style.cursor="",document.body.style.userSelect="";}},[re,fe,M,f]);let{selectedTaskIds:Pt,handleTaskClick:Le,isTaskSelected:J}=Vc(),{setIsEditing:ve}=Gc({tasks:e,selectedTaskIds:Pt,onTaskSelect:(U,Y)=>{let Ve=Bo(e).map(He=>He.id);Le(U,Ve,Y||false,false);},onTaskCreate:x||(()=>{}),onTaskDelete:b||(()=>{}),onTaskDuplicate:u||(()=>{}),onTaskMove:h||(()=>{}),onTaskIndent:k||(()=>{}),onTaskOutdent:C||(()=>{}),onTaskRename:U=>{let Y=Bo(e).find(me=>me.id===U);Y&&$e(Y);},onTaskToggleExpand:g||(()=>{}),onOpenTaskModal:U=>{let Y=Bo(e).find(me=>me.id===U);Y&&w&&w(Y);},enableKeyboard:true}),Ue=(U,Y=0)=>{let me=[];for(let Ve of U)me.push({task:Ve,level:Y}),Ve.subtasks&&Ve.subtasks.length>0&&Ve.isExpanded&&me.push(...Ue(Ve.subtasks,Y+1));return me},Fe=Ue(e),at=48,ct=Math.max(Fe.length*a,600-at),te=U=>!U.startDate||!U.endDate?"-":`${Math.ceil((U.endDate.getTime()-U.startDate.getTime())/(1e3*60*60*24))}d`,$e=U=>{O(U.id),ae(U.name),ve(true);},Kt=U=>{j.trim()&&j!==e.find(Y=>Y.id===U)?.name&&m?.(U,j.trim()),O(null),ae(""),ve(false);},Qe=()=>{O(null),ae(""),ve(false);},Ke=(U,Y)=>{Y.stopPropagation(),N?.(U.id);},F=(U,Y)=>{Y.preventDefault(),tt.current=Y.clientY,z(U),Je.current=false,$(false),Ct({x:Y.clientX,y:Y.clientY});},Ce=U=>{if(!q||(Math.abs(U.clientY-tt.current)>ie&&!Je.current&&(Je.current=true,$(true)),Ct({x:U.clientX,y:U.clientY}),!Je.current))return;let me=document.querySelectorAll("[data-task-row]"),Ve=null,He=null;me.forEach(W=>{let le=W.getBoundingClientRect(),We=W.getAttribute("data-task-row");if(We&&We!==q&&U.clientY>=le.top&&U.clientY<=le.bottom){Ve=We;let It=U.clientY-le.top,st=le.height;It<st*.25?He="above":It>st*.75?He="below":He="child";}}),se(Ve),Ye(He);},Z=()=>{if(Je.current&&q&&ye&&Be){if(Be==="child")v?.(q,ye);else if(Be==="above"||Be==="below"){let U=(Ve,He,W=null)=>{for(let le of Ve){if(le.id===He)return W;if(le.subtasks){let We=U(le.subtasks,He,le.id);if(We!==void 0)return We}}},Y=U(e,ye,null),me=(Ve,He)=>{let W=Ve.findIndex(le=>le.id===He);return Be==="below"?W+1:W};if(Y===null){let Ve=me(e,ye);v?.(q,null,Ve);}else {let Ve=Fe.find(He=>He.task.id===Y)?.task;if(Ve?.subtasks){let He=me(Ve.subtasks,ye);v?.(q,Y,He);}}}}z(null),se(null),Ye(null),Ct(null),Je.current=false,$(false);};useEffect(()=>{if(q)return document.addEventListener("mousemove",Ce),document.addEventListener("mouseup",Z),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Ce),document.removeEventListener("mouseup",Z),document.body.style.cursor="",document.body.style.userSelect="";}},[q,ye,Be]);let xe=(U,Y,me)=>{switch(U.id){case "name":let Ve=H===Y.id,He=A===Y.id;return jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${me*20}px`},children:[v&&jsx("div",{className:"cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-white/10 transition-all flex-shrink-0",style:{color:t.textTertiary,opacity:He?1:.3},onMouseDown:_=>F(Y.id,_),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),Y.subtasks&&Y.subtasks.length>0?jsx("button",{onClick:_=>{_.stopPropagation(),g?.(Y.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:Y.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:Y.color||"#3B82F6",opacity:Y.parentId?.6:1,borderColor:Y.isMilestone?t.accent:"transparent",borderWidth:Y.isMilestone?"2px":"0px"},title:Y.isMilestone?"Milestone":Y.parentId?"Subtask":"Task"})}),Ve?jsx("input",{ref:ne,type:"text",value:j,onChange:_=>ae(_.target.value),onKeyDown:_=>{_.key==="Enter"?Kt(Y.id):_.key==="Escape"&&Qe();},onBlur:()=>Kt(Y.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:_=>_.stopPropagation()}):jsxs(Fragment,{children:[jsx("span",{className:"flex-1",style:{color:Y.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:Y.parentId?"13px":"14px",fontWeight:Y.isMilestone?600:Y.parentId?400:600,letterSpacing:Y.parentId?"0":"-0.01em"},title:Y.name,children:Y.name}),He&&!Ve&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:_=>_.stopPropagation(),children:[jsx("button",{onClick:_=>Ke(Y,_),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:_=>{_.stopPropagation(),$e(Y);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsx(Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":case "endDate":let le=U.id==="startDate"?"startDate":"endDate",We=Y[le],It=be?.taskId===Y.id&&be?.field===le,st=_=>_?(typeof _=="string"?new Date(_):_).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:_=>_.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:_=>{if(It)Pe(null);else {let Ee=_.currentTarget.getBoundingClientRect();Pe({taskId:Y.id,field:le,month:We?typeof We=="string"?new Date(We):We:new Date,position:{top:Ee.bottom+4,left:Ee.left}});}},children:[jsx(Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsx("span",{children:st(We)})]}),It&&typeof document<"u"&&createPortal(jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>Pe(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:be?.position.top,left:be?.position.left},onClick:_=>_.stopPropagation(),children:[jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let _=new Date,Ee=new Date(_);Ee.setDate(_.getDate()+1);let Xe=new Date(_);Xe.setDate(_.getDate()+7);let At=new Date(_);return At.setDate(_.getDate()+14),[{label:"Hoy",date:_},{label:"Ma\xF1ana",date:Ee},{label:"Pr\xF3xima semana",date:Xe},{label:"2 semanas",date:At}].map((_e,kt)=>jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:Oe=>Oe.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Oe=>Oe.currentTarget.style.backgroundColor="transparent",onClick:()=>{y?.(Y.id,{[le]:_e.date}),Pe(null);},children:_e.label},kt))})(),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:_=>_.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:_=>_.currentTarget.style.backgroundColor="transparent",onClick:()=>{y?.(Y.id,{[le]:void 0}),Pe(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:()=>Pe(_=>_?{..._,month:new Date(_.month.getFullYear(),_.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:be?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>Pe(_=>_?{..._,month:new Date(_.month.getFullYear(),_.month.getMonth()+1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:["D","L","M","M","J","V","S"].map((_,Ee)=>jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:_},Ee))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let _=be?.month||new Date,Ee=_.getFullYear(),Xe=_.getMonth(),At=new Date(Ee,Xe,1).getDay(),de=new Date(Ee,Xe+1,0).getDate(),_e=new Date,kt=[];for(let bt=At-1;bt>=0;bt--)kt.push({day:new Date(Ee,Xe,-bt).getDate(),date:new Date(Ee,Xe-1,new Date(Ee,Xe,-bt).getDate()),isCurrentMonth:false});for(let bt=1;bt<=de;bt++)kt.push({day:bt,date:new Date(Ee,Xe,bt),isCurrentMonth:true});let Oe=42-kt.length;for(let bt=1;bt<=Oe;bt++)kt.push({day:bt,date:new Date(Ee,Xe+1,bt),isCurrentMonth:false});return kt.map((bt,va)=>{let Ca=bt.date.toDateString()===_e.toDateString(),qe=(We?typeof We=="string"?new Date(We):We:null)?.toDateString()===bt.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:bt.isCurrentMonth?qe?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:qe?"#3B82F6":"transparent",boxShadow:Ca&&!qe?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{y?.(Y.id,{[le]:bt.date}),Pe(null);},children:bt.day},va)})})()})]})]})]}),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:te(Y)})});case "assignees":let ya=r.filter(_=>Y.assignees?.some(Ee=>Ee.name===_.name||Ee.initials===_.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:_=>_.stopPropagation(),children:jsx(ro,{assignedUsers:ya,availableUsers:r,onChange:_=>{let Ee=_.map(Xe=>({id:Xe.id,name:Xe.name,initials:Xe.initials,color:Xe.color}));y?.(Y.id,{assignees:Ee.length>0?Ee:void 0});}})});case "status":return jsx("div",{className:"flex items-center justify-center w-full",onClick:_=>_.stopPropagation(),children:jsx(Id,{status:Y.status||"todo",onChange:_=>{y?.(Y.id,{status:_,progress:_==="completed"?100:Y.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:`${Y.progress}%`,backgroundColor:Y.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:[Y.progress,"%"]})]});case "priority":let Ua={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},ut={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},P=Ua[Y.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:_=>_.stopPropagation(),children:jsx(to,{priority:P,onChange:_=>{_&&y?.(Y.id,{priority:ut[_]||"medium"});}})});default:return null}},we=U=>[{id:"hide",label:"Hide Column",icon:Gt.Hide,onClick:()=>d(U),disabled:U==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Gt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Gt.SortDesc,onClick:()=>{}}],ze=U=>U.subtasks&&U.subtasks.length>0?[{id:"addSubtask",label:I?.contextMenu?.addSubtask||"Add Subtask",icon:Gt.Add,onClick:()=>{N?.(U.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:I?.contextMenu?.deleteTask||"Delete Task",icon:Gt.Delete,onClick:()=>{B?B(U.id,U.name):b?.([U.id]);}}]:[{id:"edit",label:I?.contextMenu?.editTask||"Edit Task",icon:Gt.Pencil,onClick:()=>{n?.(U);}},{id:"addSubtask",label:I?.contextMenu?.addSubtask||"Add Subtask",icon:Gt.Add,onClick:()=>{N?.(U.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:I?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Gt.MarkIncomplete,onClick:()=>{y?.(U.id,{status:"todo",progress:0});},disabled:U.status==="todo"},{id:"setInProgress",label:I?.contextMenu?.setInProgress||"Set In Progress",icon:Gt.SetInProgress,onClick:()=>{y?.(U.id,{status:"in-progress"});},disabled:U.status==="in-progress"},{id:"markComplete",label:I?.contextMenu?.markComplete||"Mark Complete",icon:Gt.MarkComplete,onClick:()=>{y?.(U.id,{status:"completed",progress:100});},disabled:U.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:I?.contextMenu?.splitTask||"Split Task",icon:Gt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:I?.contextMenu?.deleteTask||"Delete Task",icon:Gt.Delete,onClick:()=>{B?B(U.id,U.name):b?.([U.id]);}}],Re=p.filter(U=>U.visible),dt=Re.reduce((U,Y)=>U+Y.width,0);return jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:dt},children:[jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${at}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsx("div",{className:"flex items-center flex-1 min-w-0",children:Re.map((U,Y)=>{let me=Y===Re.length-1,Ve=U.id==="name";return jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${Ve?"":"justify-center"}`,style:{width:`${U.width}px`,minWidth:`${U.minWidth??(Ve?200:60)}px`,maxWidth:`${U.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:me?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:He=>{He.preventDefault(),V({isOpen:true,x:He.clientX,y:He.clientY,type:"header",columnId:U.id});},onMouseEnter:He=>{He.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:He=>{He.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,paddingRight:"0"},title:U.label,children:U.label}),U.resizable&&jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:re===U.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:He=>{He.preventDefault(),He.stopPropagation(),ge(U.id),Ie(He.clientX),R(U.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"}})})]},U.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(_n,{columns:p,onToggleColumn:d,theme:t}),jsx("button",{onClick:()=>je(!Me),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"})}),Me&&jsxs("div",{ref:Ze,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:U=>U.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:()=>je(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:ct},children:Fe.map(({task:U,level:Y},me)=>{let Ve=J(U.id),He=ye===U.id,W=He&&Be==="above",le=He&&Be==="below",We=He&&Be==="child",It={};return We&&(It.backgroundColor=`${t.accent}15`,It.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":U.id,className:`flex items-center cursor-pointer group ${q===U.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:Ve?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:Ve?t.accentLight:We?`${t.accent}15`:me%2===0?t.bgPrimary:t.bgGrid,...It},onMouseEnter:()=>T(U.id),onMouseLeave:()=>T(null),onClick:st=>{let Ua=Bo(e).map(_=>_.id),P=navigator.platform.toUpperCase().indexOf("MAC")>=0?st.metaKey:st.ctrlKey;Le(U.id,Ua,P,st.shiftKey),s?.(U);},onDoubleClick:st=>{st.stopPropagation(),n?.(U);},onContextMenu:st=>{st.preventDefault(),V({isOpen:true,x:st.clientX,y:st.clientY,type:"task",task:U}),c?.(U,st);},whileHover:{backgroundColor:Ve?t.accentLight:t.hoverBg},children:[W&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),le&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Re.map((st,ya)=>{let Ua=ya===Re.length-1,ut=st.id==="name";return jsx("div",{className:`px-4 flex items-center ${ut?"justify-start":"justify-center"}`,style:{width:`${st.width}px`,minWidth:`${st.minWidth??(ut?200:60)}px`,maxWidth:`${st.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:Ua?"none":`1px solid ${A===U.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:xe(st,U,ut?Y:0)},`${U.id}-${st.id}`)})]},U.id)})}),jsx(Io,{isOpen:L.isOpen,x:L.x,y:L.y,items:L.type==="header"&&L.columnId?we(L.columnId):L.type==="task"&&L.task?ze(L.task):[],onClose:()=>V({...L,isOpen:false}),theme:t}),xt&&mt&&q&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:mt.x+12,top:mt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let U=Fe.find(Y=>Y.task.id===q)?.task;return U?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:U.name})}):null})()}),document.body)]})}function Qc(e,t){let[a,r]=useState("none"),[o,s]=useState(0),[n,c]=useState(e),[g,i]=useState(t),[p,d]=useState(null),[f,y]=useState(null),[k,C]=useState(null),[h,b]=useState(null),[u,x]=useState(0),[m,N]=useState(0),[w,B]=useState(null),[v,I]=useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:c,ghostWidth:g,setGhostWidth:i,connectionLine:p,setConnectionLine:d,hoveredTaskId:f,setHoveredTaskId:y,activeZone:k,setActiveZone:C,draggedSegmentIndex:h,setDraggedSegmentIndex:b,draggedSegmentStartX:u,setDraggedSegmentStartX:x,segmentDragOffsetX:m,setSegmentDragOffsetX:N,hoveredSegmentIndex:w,setHoveredSegmentIndex:B,isHovered:v,setIsHovered:I,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(j,ae)=>{r("none"),d(null),y(null),c(j),i(ae),N(0),b(null),x(0);}}}function qn({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:c,onClick:g,onDoubleClick:i,onContextMenu:p,onDateChange:d,onDependencyCreate:f,allTaskPositions:y=[],onDragMove:k,onHoverChange:C}){let h=Qc(t,r),b=useRef(null),u=useRef(null),x=useRef(null),{dragMode:m,setDragMode:N,dragOffset:w,setDragOffset:B,ghostX:v,setGhostX:I,ghostWidth:A,setGhostWidth:T,connectionLine:H,setConnectionLine:O,hoveredTaskId:j,setHoveredTaskId:ae,activeZone:ne,setActiveZone:re,draggedSegmentIndex:ge,setDraggedSegmentIndex:fe,draggedSegmentStartX:Ie,setDraggedSegmentStartX:M,segmentDragOffsetX:R,setSegmentDragOffsetX:L,hoveredSegmentIndex:V,setHoveredSegmentIndex:q,isHovered:z,setIsHovered:ye,isDragging:se,isResizing:Be,isConnecting:Ye,resetDragState:tt}=h,ie=32,Je=8,mt=e.endDate&&e.endDate<new Date&&e.progress<100,Ct=e.isCriticalPath,xt=o.name==="neutral"||o.today==="#1C1917",$=e.status==="completed"||e.progress===100,be={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},Me=e.isCriticalPath||mt?"#DC2626":e.color?e.color:e.priority&&be[e.priority]?be[e.priority]:o.taskBarPrimary,Ze=(Z=>Z>=80?20:Z>=60?15:Z>=50?12:10)(r),Pt=r<50,Le=r<40;useEffect(()=>{if(C)if(z&&!se&&!e.segments){let Z=a<100;C({task:e,x:t,y:a,width:r,height:ie,showBelow:Z});}else C(null);},[z,se,e,t,a,r,ie,C]);let J=Z=>Z.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),ve=()=>{let Z=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${Z} day${Z!==1?"s":""}`},Ue=Z=>Math.round(Z/s)*s,Fe=Z=>{let xe=Math.round(Z/s),we=new Date(n);return we.setDate(we.getDate()+xe),we},at=(Z,xe)=>{for(let we of y){if(we.id===e.id)continue;let ze=5;if(Z>=we.x-ze&&Z<=we.x+we.width+ze&&xe>=we.y-ze&&xe<=we.y+we.height+ze)return we.id}return null},ct=useCallback((Z,xe,we)=>{Z.preventDefault(),Z.stopPropagation();let ze=b.current?.ownerSVGElement;if(!ze)return;let Re=ze.createSVGPoint();Re.x=Z.clientX,Re.y=Z.clientY;let dt=Re.matrixTransform(ze.getScreenCTM()?.inverse()),U=we!==void 0?we:t,Y=xe;if(!Y){let me=dt.x-U;Z.shiftKey?(Y="connect",O({x:t+r,y:a+ie/2})):Z.ctrlKey||Z.metaKey?Y="move":Z.altKey?Y=me<r/2?"resize-start":"resize-end":Le?me<r/2?Y="move":Y="resize-end":Pt?me<=Ze/2?Y="resize-start":me>=r-Ze/2?Y="resize-end":Y="move":me<=Ze?Y="resize-start":me>=r-Ze?Y="resize-end":Y="move";}N(Y),ye(false),re(null),Y==="move"?B(dt.x-U):Y==="connect"?O({x:t+r,y:a+ie/2}):B(0),I(U),T(r);},[t,r,a,ie]),te=useCallback(Z=>{let xe=b.current?.ownerSVGElement;if(!xe)return;let we=xe.closest(".gantt-timeline-scroll");if(!we)return;let ze=we.getBoundingClientRect(),Re=60,dt=15,U=0;if(Z.clientX<ze.left+Re){let Y=ze.left+Re-Z.clientX;U=-Math.min(dt,Y/2);}else if(Z.clientX>ze.right-Re){let Y=Z.clientX-(ze.right-Re);U=Math.min(dt,Y/2);}return U!==0&&(we.scrollLeft+=U),U!==0},[]),$e=useCallback(Z=>{if(m==="none")return;x.current=Z;let xe=b.current?.ownerSVGElement;if(!xe)return;if(m==="move"||m==="resize-start"||m==="resize-end"){let Re=te(Z);Re&&!u.current?u.current=window.setInterval(()=>{x.current&&(te(x.current),$e(x.current));},16):!Re&&u.current&&(window.clearInterval(u.current),u.current=null);}let we=xe.createSVGPoint();we.x=Z.clientX,we.y=Z.clientY;let ze=we.matrixTransform(xe.getScreenCTM()?.inverse());if(m==="connect"){O({x:ze.x,y:ze.y});let Re=at(ze.x,ze.y);ae(Re);}else if(m==="move"){let Re=ze.x-w,dt=Ue(Re);I(dt),T(r);let U=Math.round((dt-t)/s);if(k?.(e.id,U,true),e.segments&&e.segments.length>0&&ge!==null){let Y=dt-Ie;L(Y);}}else if(m==="resize-start"){let Re=ze.x,dt=Ue(Re),U=t+r-dt;U>=s&&(I(dt),T(U));}else if(m==="resize-end"){let Re=ze.x,U=Ue(Re)-t;U>=s&&T(U);}},[m,t,r,s,w,e,Ue,ge,Ie,at,ae,O,I,T,L,k,te]),Kt=useCallback(()=>{if(u.current&&(window.clearInterval(u.current),u.current=null),x.current=null,m!=="none"){if(m==="connect")j&&f&&f(e,j),O(null),ae(null);else {let Z=e.endDate.getTime()-e.startDate.getTime(),xe,we,ze=true;if(m==="move"){if(xe=Fe(v),we=new Date(xe.getTime()+Z),e.segments&&e.segments.length>0&&ge!==null){let Re=Math.round(R/s),dt=e.segments.map((Ve,He)=>{if(He===ge){let W=new Date(Ve.startDate),le=new Date(Ve.endDate);return W.setDate(W.getDate()+Re),le.setDate(le.getDate()+Re),{startDate:W,endDate:le}}return Ve}),U=dt.flatMap(Ve=>[Ve.startDate,Ve.endDate]),Y=new Date(Math.min(...U.map(Ve=>Ve.getTime()))),me=new Date(Math.max(...U.map(Ve=>Ve.getTime())));d?.({...e,segments:dt},Y,me),tt(t,r);return}}else m==="resize-start"?(xe=Fe(v),we=e.endDate,xe>we&&(console.warn("Invalid date range: start date must be before or equal to end date"),ze=false)):m==="resize-end"?(xe=e.startDate,we=Fe(v+A),we<xe&&(console.warn("Invalid date range: end date must be after or equal to start date"),ze=false)):ze=false;ze&&xe&&we&&(we.getTime()<xe.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,xe,we));}k?.(e.id,0,false),tt(t,r);}},[m,v,A,e,d,j,f,t,r,s,Fe,R,ge,tt,k]);useEffect(()=>{if(m==="none")return;let Z=we=>{$e(we);},xe=()=>{Kt();};return window.addEventListener("mousemove",Z),window.addEventListener("mouseup",xe),()=>{window.removeEventListener("mousemove",Z),window.removeEventListener("mouseup",xe),u.current&&(window.clearInterval(u.current),u.current=null);}},[m,$e,Kt]);let Qe=se&&!Ye?v:t,Ke=se&&!Ye?A:r,F=c.taskClass(e);return jsxs("g",{ref:b,"data-task-bar":"true",onClick:()=>!se&&g?.(e),onDoubleClick:Z=>{se||(Z.stopPropagation(),i?.(e));},onContextMenu:Z=>{Z.preventDefault(),p?.(e,Z);},onMouseEnter:()=>!se&&ye(true),onMouseLeave:()=>{se||(ye(false),re(null));},children:[jsx("rect",{x:t,y:a,width:r+24,height:ie,fill:"transparent",style:{pointerEvents:"all"}}),z&&!se&&!Pt&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:Ze,height:ie,fill:ne==="resize-start"?o.accent:"transparent",opacity:ne==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>re("resize-start"),onMouseDown:Z=>ct(Z,"resize-start")}),jsx("rect",{x:t+Ze,y:a,width:r-Ze*2,height:ie,fill:ne==="move"?o.accent:"transparent",opacity:ne==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>re("move"),onMouseDown:Z=>ct(Z,"move")}),jsx("rect",{x:t+r-Ze,y:a,width:Ze,height:ie,fill:ne==="resize-end"?o.accent:"transparent",opacity:ne==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>re("resize-end"),onMouseDown:Z=>ct(Z,"resize-end")})]}),z&&!se&&Le&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:r/2,height:ie,fill:ne==="move"?o.accent:"transparent",opacity:ne==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>re("move"),onMouseDown:Z=>ct(Z,"move")}),jsx("rect",{x:t+r/2,y:a,width:r/2,height:ie,fill:ne==="resize-end"?o.accent:"transparent",opacity:ne==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>re("resize-end"),onMouseDown:Z=>ct(Z,"resize-end")}),z&&jsx(motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+ie-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),se&&!Ye&&!e.segments&&jsx(motion.rect,{x:v,y:a,width:A,height:ie,rx:Je,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:Qe,y:a,width:Ke,height:ie,rx:Je,fill:Me,"data-task-class":F,initial:{opacity:0,scale:.95},animate:{opacity:se&&!Ye?.15:e.parentId?.6:z?.9:.8,scale:z&&!se?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Z=>ct(Z),style:{cursor:se?Ye?"crosshair":Be?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsx("rect",{x:Qe,y:a,width:Ke*(e.progress/100),height:ie,rx:Je,fill:Me,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((Z,xe)=>{let we=(Z.startDate.getTime()-n.getTime())/864e5*s,Re=(Z.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-we+s,dt=se&&m==="move"&&ge===xe,U=V===xe,Y=dt?we+R:we;return jsxs("g",{onMouseEnter:()=>!se&&q(xe),onMouseLeave:()=>!se&&q(null),children:[jsx(motion.rect,{x:Y,y:a,width:Re,height:ie,rx:Je,fill:Me,initial:{opacity:0,scale:.95},animate:{opacity:dt||e.parentId?.6:U?.9:.8,scale:U&&!se?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:me=>{me.stopPropagation(),fe(xe),M(we),ct(me,void 0,we);},style:{cursor:se?Ye?"crosshair":Be?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsx("rect",{x:Y,y:a,width:Re*(e.progress/100),height:ie,rx:Je,fill:Me,opacity:1,style:{pointerEvents:"none"}})]},`segment-${xe}`)}),xt&&(mt||Ct)&&!e.segments&&jsxs(Fragment,{children:[Ct&&!mt&&jsx("rect",{x:Qe,y:a,width:Ke,height:ie,rx:Je,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),mt&&jsx("rect",{x:Qe,y:a,width:Ke,height:ie,rx:Je,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),Ke>60&&!e.segments&&(()=>{let Z=c.taskLabel(e),xe=typeof Z=="string"?Z:e.name,we=xe.length>Math.floor(Ke/8)?`${xe.substring(0,Math.floor(Ke/8))}...`:xe;return jsx("text",{x:Qe+12,y:a+ie/2,dominantBaseline:"middle",fill:$?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:$?"line-through":"none"},children:we})})(),Ke>100&&e.progress>0&&e.progress<100&&!se&&!e.segments&&jsxs("text",{x:Qe+Ke-12,y:a+ie/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}),e.status&&Ke>80&&!se&&!e.segments&&jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsx("circle",{cx:Qe+Ke-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsx("circle",{cx:Qe+Ke-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(z||Be)&&!Ye&&!e.segments&&jsxs(Fragment,{children:[jsxs("g",{children:[jsx("rect",{x:Qe-2,y:a,width:16,height:ie,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>re("resize-start"),onMouseLeave:()=>re(null),onMouseDown:Z=>{Z.stopPropagation(),ct(Z,"resize-start");}}),jsx(motion.rect,{x:Qe+4,y:a+8,width:3,height:ie-16,rx:1.5,fill:ne==="resize-start"||m==="resize-start"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]}),jsxs("g",{children:[jsx("rect",{x:Qe+Ke-14,y:a,width:16,height:ie,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>re("resize-end"),onMouseLeave:()=>re(null),onMouseDown:Z=>{Z.stopPropagation(),ct(Z,"resize-end");}}),jsx(motion.rect,{x:Qe+Ke-7,y:a+8,width:3,height:ie-16,rx:1.5,fill:ne==="resize-end"||m==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsx(AnimatePresence,{children:z&&!se&&!e.segments&&jsxs(motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsx("circle",{cx:t+r+10,cy:a+ie/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>re("connect"),onMouseLeave:()=>re(null),onMouseDown:Z=>{Z.stopPropagation(),ct(Z,"connect");}}),jsx(motion.circle,{cx:t+r+10,cy:a+ie/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:ne==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),Ye&&H&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:t+r,y1:a+ie/2,x2:H.x,y2:H.y,stroke:j?o.statusCompleted:o.accent,strokeWidth:j?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:j?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:H.x,cy:H.y,r:j?8:6,fill:j?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),j&&jsx(motion.text,{x:H.x+15,y:H.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:H.x+10},animate:{opacity:1,x:H.x+15},transition:{duration:.2},children:"Connect"})]}),(z||se)&&!Ye&&!e.segments&&jsx(motion.rect,{x:Qe-2,y:a-2,width:Ke+4,height:ie+4,rx:Je+2,fill:"none",stroke:se?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:se?.6:.4,initial:{opacity:0},animate:{opacity:se?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Be&&jsxs(Fragment,{children:[jsx("line",{x1:v,y1:0,x2:v,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsx("line",{x1:v+A,y1:0,x2:v+A,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:z&&!se&&!e.segments&&!C&&(()=>{let we=a<100,ze=we?a+ie+13:a-82-13,Re=we?`M ${Qe+Ke/2-6} ${a+ie+3} L ${Qe+Ke/2} ${a+ie+13} L ${Qe+Ke/2+6} ${a+ie+3}`:`M ${Qe+Ke/2-6} ${a-13} L ${Qe+Ke/2} ${a-3} L ${Qe+Ke/2+6} ${a-13}`,dt=ze+22,U=ze+40,Y=ze+55,me=ze+70,Ve=we?ze+82-5:a-18;return jsxs(motion.g,{initial:{opacity:0,y:we?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:we?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:Re,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsx("rect",{x:Qe+Ke/2-120,y:ze,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:Qe+Ke/2,y:dt,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:Qe+Ke/2-110,y:U,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:Qe+Ke/2-70,y:U,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:J(e.startDate)}),jsx("text",{x:Qe+Ke/2-110,y:Y,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:Qe+Ke/2-70,y:Y,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:J(e.endDate)}),jsx("text",{x:Qe+Ke/2+10,y:U,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:Qe+Ke/2+65,y:U,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:ve()}),jsx("text",{x:Qe+Ke/2+10,y:Y,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:Qe+Ke/2+65,y:Y,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:Qe+Ke/2-110,y:me,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:Qe+Ke/2-50,y:me,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(He=>He.name).join(", ").substring(0,30),e.assignees.map(He=>He.name).join(", ").length>30?"...":""]})]}),!we&&jsx("text",{x:Qe+Ke/2,y:Ve,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Le?"Left: move \u2022 Right: resize":Pt?"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 am({tooltipData:e,theme:t}){if(!e)return null;let {task:a,x:r,y:o,width:s,height:n,showBelow:c}=e,g=82,i=13,p=c?o+n+i:o-g-i,d=c?`M ${r+s/2-6} ${o+n+3} L ${r+s/2} ${o+n+13} L ${r+s/2+6} ${o+n+3}`:`M ${r+s/2-6} ${o-13} L ${r+s/2} ${o-3} L ${r+s/2+6} ${o-13}`,f=p+22,y=p+40,k=p+55,C=p+70,h=m=>m.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),b=()=>{if(!a.startDate||!a.endDate)return "N/A";let m=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${m} day${m!==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+s/2-120,y:p,width:240,height:g,rx:8,fill:t.bgSecondary,stroke:t.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("text",{x:r+s/2,y:f,textAnchor:"middle",fill:t.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:a.name.length>28?`${a.name.substring(0,28)}...`:a.name}),jsx("text",{x:r+s/2-110,y,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:r+s/2-70,y,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.startDate?h(a.startDate):"N/A"}),jsx("text",{x:r+s/2-110,y:k,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:r+s/2-70,y:k,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?h(a.endDate):"N/A"}),jsx("text",{x:r+s/2+10,y,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:r+s/2+65,y,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:b()}),jsx("text",{x:r+s/2+10,y:k,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:r+s/2+65,y:k,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.progress,"%"]}),a.assignees&&a.assignees.length>0&&jsxs(Fragment,{children:[jsx("text",{x:r+s/2-110,y:C,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:r+s/2-50,y:C,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.assignees.map(m=>m.name).join(", ").substring(0,30),a.assignees.map(m=>m.name).join(", ").length>30?"...":""]})]})]})})}function Zn({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:c=false}){let[g,i]=useState(false),[p,d]=useState(null),f=r-t,y=f>0,k=Math.abs(f)<5,h=5,b=20,u=!k&&a<=e,x,m;if(k)if(m=(e+a)/2,n==="squared")x=`M ${e} ${t} L ${a} ${r}`;else {let ne=Math.min(Math.abs(a-e)/3,30);x=`M ${e} ${t} C ${e+ne} ${t}, ${a-ne} ${r}, ${a} ${r}`;}else if(m=a-b,u){let re=e+15,ge=a-b,fe=y?t+20:t-20;m=ge,n==="squared"?x=`M ${e} ${t} L ${re} ${t} L ${re} ${fe} L ${ge} ${fe} L ${ge} ${r} L ${a} ${r}`:y?x=`M ${e} ${t} L ${re-h} ${t} Q ${re} ${t} ${re} ${t+h} L ${re} ${fe-h} Q ${re} ${fe} ${re-h} ${fe} L ${ge+h} ${fe} Q ${ge} ${fe} ${ge} ${fe+h} L ${ge} ${r-h} Q ${ge} ${r} ${ge+h} ${r} L ${a} ${r}`:x=`M ${e} ${t} L ${re-h} ${t} Q ${re} ${t} ${re} ${t-h} L ${re} ${fe+h} Q ${re} ${fe} ${re-h} ${fe} L ${ge+h} ${fe} Q ${ge} ${fe} ${ge} ${fe-h} L ${ge} ${r+h} Q ${ge} ${r} ${ge+h} ${r} L ${a} ${r}`;}else n==="squared"?x=`M ${e} ${t} L ${m} ${t} L ${m} ${r} L ${a} ${r}`:y?x=`M ${e} ${t} L ${m-h} ${t} Q ${m} ${t} ${m} ${t+h} L ${m} ${r-h} Q ${m} ${r} ${m+h} ${r} L ${a} ${r}`:x=`M ${e} ${t} L ${m-h} ${t} Q ${m} ${t} ${m} ${t-h} L ${m} ${r+h} Q ${m} ${r} ${m+h} ${r} L ${a} ${r}`;let N=5,w=`M ${a} ${r} L ${a-N} ${r-N*.5} M ${a} ${r} L ${a-N} ${r+N*.5}`,B=o.dependency,v=o.dependencyHover||B,I="#f87171",A="rgba(248, 113, 113, 0.15)",T=m,H=(t+r)/2;if(p)if(k)T=Math.max(e+10,Math.min(a-10,p.x)),H=t;else if(u){let ne=e+15,re=a-b,ge=y?t+20:t-20,fe=[[e,t,ne,t],[ne,t,ne,ge],[ne,ge,re,ge],[re,ge,re,r],[re,r,a,r]],Ie=1/0,M={x:T,y:H};for(let R of fe){let L=O(p.x,p.y,R[0],R[1],R[2],R[3]),V=Math.hypot(p.x-L.x,p.y-L.y);V<Ie&&(Ie=V,M=L);}T=M.x,H=M.y;}else {let ne=[[e,t,m,t],[m,t,m,r],[m,r,a,r]],re=1/0,ge={x:T,y:H};for(let fe of ne){let Ie=O(p.x,p.y,fe[0],fe[1],fe[2],fe[3]),M=Math.hypot(p.x-Ie.x,p.y-Ie.y);M<re&&(re=M,ge=Ie);}T=ge.x,H=ge.y;}function O(ne,re,ge,fe,Ie,M){let R=Ie-ge,L=M-fe,V=R*R+L*L;if(V===0)return {x:ge,y:fe};let q=((ne-ge)*R+(re-fe)*L)/V;return q=Math.max(0,Math.min(1,q)),{x:ge+q*R,y:fe+q*L}}let j=ne=>{let re=ne.currentTarget.ownerSVGElement;if(!re)return;let ge=re.getBoundingClientRect();d({x:ne.clientX-ge.left,y:ne.clientY-ge.top});},ae=()=>{i(false),d(null);};return c?jsxs("g",{"data-dependency-line":"true",onMouseLeave:ae,onMouseMove:j,children:[jsx("path",{d:x,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsx("path",{d:x,fill:"none",stroke:v,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsx("path",{d:x,fill:"none",stroke:v,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("path",{d:w,fill:"none",stroke:v,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("circle",{cx:a,cy:r,r:4,fill:v,opacity:.9,style:{pointerEvents:"none"}}),s&&jsxs(motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:ne=>{ne.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsx("circle",{cx:T,cy:H,r:9,fill:A,stroke:I,strokeWidth:1.5}),jsx("line",{x1:T-3,y1:H-3,x2:T+3,y2:H+3,stroke:I,strokeWidth:1.5,strokeLinecap:"round"}),jsx("line",{x1:T+3,y1:H-3,x2:T-3,y2:H+3,stroke:I,strokeWidth:1.5,strokeLinecap:"round"})]})]}):jsxs("g",{"data-dependency-line":"true",onMouseEnter:()=>i(true),onMouseLeave:ae,onMouseMove:j,style:{cursor:s?"pointer":"default"},children:[jsx("path",{d:x,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsx(motion.path,{d:x,fill:"none",stroke:g?v:B,strokeWidth:g?2.5:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}}}),jsx(motion.path,{d:w,fill:"none",stroke:g?v:B,strokeWidth:g?2.5:2,strokeLinecap:"round",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3}}),jsx(motion.circle,{cx:a,cy:r,r:g?4:3,fill:g?v:B,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15}}),g&&s&&jsxs(motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.15},onClick:ne=>{ne.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsx("circle",{cx:T,cy:H,r:9,fill:A,stroke:I,strokeWidth:1.5}),jsx("line",{x1:T-3,y1:H-3,x2:T+3,y2:H+3,stroke:I,strokeWidth:1.5,strokeLinecap:"round"}),jsx("line",{x1:T+3,y1:H-3,x2:T-3,y2:H+3,stroke:I,strokeWidth:1.5,strokeLinecap:"round"})]})]})}function es({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=useState(false),c=16,g=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxs("g",{"data-task-bar":"true",onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsx(motion.circle,{cx:t,cy:a+16,r:c+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?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:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsx(motion.rect,{x:t-(c+4)/2,y: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:s&&jsxs(motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:g(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 he={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(p=>{p.dependencies&&r.set(p.id,p.dependencies),p.subtasks&&o(p.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,c=new Set,g=i=>{if(!n.has(i)){n.add(i),c.add(i);let p=r.get(i)||[];for(let d of p){if(!n.has(d)&&g(d))return true;if(c.has(d))return true}}return c.delete(i),false};return g(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=he.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=he.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=he.findTaskById(e,o);if(s)a.unshift(s),o=s.parentId;else break}return a},exportToJSON:e=>JSON.stringify(e,null,2),importFromJSON:e=>{try{let t=JSON.parse(e);if(!Array.isArray(t))throw new Error("Invalid JSON: expected an array of tasks");return t.forEach((a,r)=>{if(!a.id||!a.name)throw new Error(`Invalid task at index ${r}: missing required fields (id, name)`)}),t}catch(t){throw new Error(`Failed to import tasks: ${t instanceof Error?t.message:"Unknown error"}`)}},exportToCSV:e=>{let t=he.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let s=[o.id,`"${o.name.replace(/"/g,'""')}"`,o.startDate?o.startDate.toISOString().split("T")[0]:"",o.endDate?o.endDate.toISOString().split("T")[0]:"",o.progress.toString(),o.status||"",o.dependencies?.join(";")||""];r.push(s.join(","));}),r.join(`
|
|
112
|
+
`)},formatDate:e=>{let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return `${t}-${a}-${r}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let a=he.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=he.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)=>he.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=he.findTaskById(e,t);return !a||!a.dependencies?[]:he.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>he.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>he.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=he.flattenTasks(e);if(t.length===0)return 0;let a=t.reduce((r,o)=>r+o.progress,0);return Math.round(a/t.length)},getTaskByPath:(e,t)=>{let a=e,r;for(let o=0;o<t.length;o++){let s=t[o];if(!a||s===void 0||s>=a.length||(r=a[s],!r))return;o<t.length-1&&(a=r.subtasks||[]);}return r},cloneTask:(e,t)=>({...e,id:t||`${e.id}-copy`,subtasks:e.subtasks?.map(a=>he.cloneTask(a))}),exportToPDF:async(e,t="gantt-chart.pdf")=>{try{if(!e||e.length===0){alert("No tasks available to export to PDF");return}let{jsPDF:a}=await import('jspdf'),{default:r}=await import('jspdf-autotable'),o=new a,s=he.flattenTasks(e);if(s.length===0){alert("No tasks found to export");return}o.setFontSize(16),o.text("Gantt Chart - Task List",14,20);let n=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],c=s.map(g=>{let i=g.startDate&&g.endDate?he.calculateDuration(g.startDate,g.endDate):0;return [g.name,g.startDate?he.formatDate(g.startDate):"N/A",g.endDate?he.formatDate(g.endDate):"N/A",i>0?`${i} days`:"N/A",`${g.progress}%`,g.status||"N/A"]});r(o,{head:n,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=he.flattenTasks(e).map(g=>{let i=g.startDate&&g.endDate?he.calculateDuration(g.startDate,g.endDate):0;return {"Task ID":g.id,"Task Name":g.name,"Start Date":g.startDate?he.formatDate(g.startDate):"","End Date":g.endDate?he.formatDate(g.endDate):"","Duration (days)":i>0?i:"","Progress (%)":g.progress,Status:g.status||"",Assignees:g.assignees?.map(p=>p.name).join(", ")||"",Dependencies:g.dependencies?.join(", ")||"","Is Milestone":g.isMilestone?"Yes":"No","Parent ID":g.parentId||"",Level:g.level||0}}),s=a.utils.json_to_sheet(o),n=[{wch:15},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:20},{wch:12},{wch:15},{wch:8}];s["!cols"]=n;let c=a.utils.book_new();a.utils.book_append_sheet(c,s,"Gantt Tasks"),a.writeFile(c,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=he.flattenTasks(e),o=new Map;r.forEach((f,y)=>{o.set(f.id,y+1);});let s=f=>f.toISOString().replace("Z",""),n=he.getEarliestStartDate(e)||new Date,c=he.getLatestEndDate(e)||new Date,g=r.map((f,y)=>{let k=o.get(f.id),C=f.startDate&&f.endDate?he.calculateDuration(f.startDate,f.endDate):0,h=(f.dependencies||[]).filter(b=>o.has(b)).map(b=>`
|
|
113
113
|
<PredecessorLink>
|
|
114
|
-
<PredecessorUID>${o.get(
|
|
114
|
+
<PredecessorUID>${o.get(b)}</PredecessorUID>
|
|
115
115
|
<Type>1</Type>
|
|
116
116
|
<CrossProject>0</CrossProject>
|
|
117
117
|
<LinkLag>0</LinkLag>
|
|
@@ -119,37 +119,37 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
119
119
|
</PredecessorLink>`).join("");return `
|
|
120
120
|
<Task>
|
|
121
121
|
<UID>${k}</UID>
|
|
122
|
-
<ID>${
|
|
123
|
-
<Name>${
|
|
122
|
+
<ID>${y+1}</ID>
|
|
123
|
+
<Name>${f.name.replace(/[<>&'"]/g,b=>({"<":"<",">":">","&":"&","'":"'",'"':"""})[b]||b)}</Name>
|
|
124
124
|
<Type>0</Type>
|
|
125
125
|
<IsNull>0</IsNull>
|
|
126
126
|
<CreateDate>${s(new Date)}</CreateDate>
|
|
127
|
-
<WBS>${
|
|
128
|
-
<OutlineNumber>${
|
|
129
|
-
<OutlineLevel>${
|
|
127
|
+
<WBS>${y+1}</WBS>
|
|
128
|
+
<OutlineNumber>${y+1}</OutlineNumber>
|
|
129
|
+
<OutlineLevel>${f.level||0}</OutlineLevel>
|
|
130
130
|
<Priority>500</Priority>
|
|
131
|
-
<Start>${
|
|
132
|
-
<Finish>${
|
|
131
|
+
<Start>${f.startDate?s(f.startDate):""}</Start>
|
|
132
|
+
<Finish>${f.endDate?s(f.endDate):""}</Finish>
|
|
133
133
|
<Duration>PT${C*8}H0M0S</Duration>
|
|
134
134
|
<DurationFormat>7</DurationFormat>
|
|
135
135
|
<Work>PT${C*8}H0M0S</Work>
|
|
136
|
-
<Stop>${
|
|
137
|
-
<Resume>${
|
|
136
|
+
<Stop>${f.endDate?s(f.endDate):""}</Stop>
|
|
137
|
+
<Resume>${f.startDate?s(f.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>${f.isMilestone?"1":"0"}</Milestone>
|
|
144
|
+
<Summary>${f.subtasks&&f.subtasks.length>0?"1":"0"}</Summary>
|
|
145
|
+
<Critical>${f.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>${f.startDate?s(f.startDate):""}</EarlyStart>
|
|
150
|
+
<EarlyFinish>${f.endDate?s(f.endDate):""}</EarlyFinish>
|
|
151
|
+
<LateStart>${f.startDate?s(f.startDate):""}</LateStart>
|
|
152
|
+
<LateFinish>${f.endDate?s(f.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>${f.progress}</PercentComplete>
|
|
161
|
+
<PercentWorkComplete>${f.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(C*
|
|
165
|
+
<ActualStart>${f.progress>0&&f.startDate?s(f.startDate):""}</ActualStart>
|
|
166
|
+
<ActualFinish>${f.progress===100&&f.endDate?s(f.endDate):""}</ActualFinish>
|
|
167
|
+
<ActualDuration>PT${Math.round(C*f.progress/100)*8}H0M0S</ActualDuration>
|
|
168
168
|
<ActualCost>0</ActualCost>
|
|
169
169
|
<ActualOvertimeCost>0</ActualOvertimeCost>
|
|
170
|
-
<ActualWork>PT${Math.round(C*
|
|
170
|
+
<ActualWork>PT${Math.round(C*f.progress/100)*8}H0M0S</ActualWork>
|
|
171
171
|
<ActualOvertimeWork>PT0H0M0S</ActualOvertimeWork>
|
|
172
172
|
<RegularWork>PT${C*8}H0M0S</RegularWork>
|
|
173
|
-
<RemainingDuration>PT${Math.round(C*(100-
|
|
173
|
+
<RemainingDuration>PT${Math.round(C*(100-f.progress)/100)*8}H0M0S</RemainingDuration>
|
|
174
174
|
<RemainingCost>0</RemainingCost>
|
|
175
|
-
<RemainingWork>PT${Math.round(C*(100-
|
|
175
|
+
<RemainingWork>PT${Math.round(C*(100-f.progress)/100)*8}H0M0S</RemainingWork>
|
|
176
176
|
<RemainingOvertimeCost>0</RemainingOvertimeCost>
|
|
177
177
|
<RemainingOvertimeWork>PT0H0M0S</RemainingOvertimeWork>
|
|
178
178
|
<ACWP>0</ACWP>
|
|
@@ -195,13 +195,13 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
195
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,f=>({"<":"<",">":">","&":"&","'":"'",'"':"""})[f]||f)}</Name>
|
|
199
|
+
<Title>${t.replace(/[<>&'"]/g,f=>({"<":"<",">":">","&":"&","'":"'",'"':"""})[f]||f)}</Title>
|
|
200
200
|
<CreationDate>${s(new Date)}</CreationDate>
|
|
201
201
|
<LastSaved>${s(new Date)}</LastSaved>
|
|
202
202
|
<ScheduleFromStart>1</ScheduleFromStart>
|
|
203
203
|
<StartDate>${s(n)}</StartDate>
|
|
204
|
-
<FinishDate>${s(
|
|
204
|
+
<FinishDate>${s(c)}</FinishDate>
|
|
205
205
|
<FYStartDate>1</FYStartDate>
|
|
206
206
|
<CriticalSlackLimit>0</CriticalSlackLimit>
|
|
207
207
|
<CurrencyDigits>2</CurrencyDigits>
|
|
@@ -339,9 +339,9 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
339
339
|
</Calendars>
|
|
340
340
|
<Tasks>${g}
|
|
341
341
|
</Tasks>
|
|
342
|
-
</Project>`,p=new Blob([i],{type:"application/xml;charset=utf-8;"}),l=document.createElement("a");l.href=URL.createObjectURL(p),l.download=a,l.click(),URL.revokeObjectURL(l.href);},calculateCriticalPath:e=>{let t=he.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 p=i.startDate&&i.endDate?he.calculateDuration(i.startDate,i.endDate):0,l=0;if(i.dependencies&&i.dependencies.length>0)for(let v of i.dependencies){let k=t.find(C=>C.id===v);if(k){o(k);let C=r.get(v)?.ef||0;l=Math.max(l,C);}}let b=l+p;r.set(i.id,{es:l,ef:b});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),n=new Map,m=i=>{if(n.has(i.id))return;let p=i.startDate&&i.endDate?he.calculateDuration(i.startDate,i.endDate):0,l=t.filter(k=>k.dependencies&&k.dependencies.includes(i.id)),b=s;if(l.length>0)for(let k of l){m(k);let C=n.get(k.id)?.ls||0;b=Math.min(b,C);}let v=b-p;n.set(i.id,{ls:v,lf:b});};a.forEach(m);let g=[];for(let i of a){let p=r.get(i.id),l=n.get(i.id);if(p&&l){let b=l.ls-p.es;Math.abs(b)<.01&&g.push(i.id);}}return g},calculateSlack:(e,t)=>{let a=he.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(he.calculateCriticalPath(e).includes(t))return 0;let o=he.getDependentTasks(e,t);if(o.length===0){let m=he.getLatestEndDate(e);if(!m)return null;let g=he.calculateDuration(a.endDate,m);return Math.max(0,g)}let s=o.filter(m=>m.startDate).map(m=>m.startDate.getTime()).sort((m,g)=>m-g)[0];if(!s)return null;let n=he.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>he.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=he.findTaskById(e,t);if(!r||!r.endDate)return e;let o=he.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let n of o){if(!n.startDate||!n.endDate)continue;let m=he.calculateDuration(n.startDate,n.endDate),g;a!==void 0?(g=new Date(n.startDate),g.setDate(g.getDate()+a)):(g=new Date(r.endDate),g.setDate(g.getDate()+1));let i=he.calculateEndDate(g,m),p=l=>l.map(b=>b.id===n.id?{...b,startDate:g,endDate:i}:b.subtasks?{...b,subtasks:p(b.subtasks)}:b);s=p(s),s=he.autoScheduleDependents(s,n.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,n,m)=>{if(a===0)return [];let g=[],i=o.getTime(),p=1e3*60*60*24,l=he.findTaskById(e,t);if(!l||!l.endDate)return [];let b=(v,k,C=new Set)=>{if(C.has(v))return;C.add(v);let h=he.getDependentTasks(e,v);for(let f of h){if(!f.startDate||!f.endDate)continue;let u=r.findIndex(T=>T.id===f.id);if(u===-1)continue;let x=f.startDate.getTime(),N=(f.endDate.getTime()-x)/p,B=(x-i)/p*s,y=B+k*s,I=Math.max(N*s,s),P=m+u*n+12;g.push({taskId:f.id,taskName:f.name,originalX:B,previewX:y,width:I,y:P,rowIndex:u,daysDelta:k,color:f.color}),b(f.id,k,C);}};return b(t,a),g},splitTask:(e,t,a,r=3)=>{let o=he.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let n=new Date(a);n.setDate(n.getDate()+r);let m=new Date(o.endDate);m.setDate(m.getDate()+r);let g=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:m}],i=p=>p.map(l=>l.id===o.id?{...l,endDate:m,segments:g}:l.subtasks?{...l,subtasks:i(l.subtasks)}:l);return i(e)}};function es({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:m="en",templates:g,dependencyLineStyle:i="curved",onTaskClick:p,onTaskDblClick:l,onTaskContextMenu:b,onTaskDateChange:v,onDependencyCreate:k,onDependencyDelete:C}){let f=_r(),[u,x]=useState([]),[c,N]=useState(null),w=useCallback(A=>{N(A);},[]),B=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),y=r==="day"?60:r==="week"?20:8,I=B*y*n,P=A=>{let R=new Date(Date.UTC(A.getFullYear(),A.getMonth(),A.getDate())),L=R.getUTCDay()||7;R.setUTCDate(R.getUTCDate()+4-L);let j=new Date(Date.UTC(R.getUTCFullYear(),0,1));return Math.ceil(((R.getTime()-j.getTime())/864e5+1)/7)},T=A=>{let R=A.getDay();return R===0||R===6},W=useCallback(A=>{let R=Math.round(A/(y*n)),L=new Date(o);return L.setDate(L.getDate()+R),L},[o,y,n]),O=useCallback((A,R)=>{if(R.startDate&&R.endDate)return;let L=A.currentTarget.ownerSVGElement;if(!L)return;let j=L.createSVGPoint();j.x=A.clientX,j.y=A.clientY;let X=j.matrixTransform(L.getScreenCTM()?.inverse()),z=W(X.x),ve=new Date(z);ve.setDate(ve.getDate()+1),v?.(R,z,ve);},[W,v]),q=useMemo(()=>{let A=X=>X.map(z=>{if(z.subtasks&&z.subtasks.length>0){let ve=A(z.subtasks),se=ve.filter(Ie=>Ie.startDate&&Ie.endDate);if(se.length>0){let Ie=se.map(Xe=>Xe.startDate.getTime()),qe=se.map(Xe=>Xe.endDate.getTime()),Qe=new Date(Math.min(...Ie)),ie=new Date(Math.max(...qe));return {...z,subtasks:ve,startDate:Qe,endDate:ie}}return {...z,subtasks:ve}}return z}),R=(X,z=[])=>{for(let ve of X)z.push(ve),ve.subtasks&&ve.subtasks.length>0&&(ve.isExpanded===void 0||ve.isExpanded)&&R(ve.subtasks,z);return z},L=A(e);return R(L)},[e]),te=useCallback(A=>{if(!A.startDate||!A.endDate)return {x:0,width:0};let R=A.startDate.getTime(),L=A.endDate.getTime(),j=o.getTime(),X=(R-j)/(1e3*60*60*24),z=(L-R)/(1e3*60*60*24),ve=X*y*n,se=Math.max(y*n,40),Ie=Math.max(z*y*n,se);return {x:ve,width:Ie}},[o,y,n]),ne=useMemo(()=>q.filter(A=>A.startDate&&A.endDate).map(A=>{let{x:R,width:L}=te(A),X=q.findIndex(z=>z.id===A.id)*a+12;return {id:A.id,x:R,y:X,width:L,height:32}}),[q,te]),oe=useCallback((A,R,L)=>{if(!L||R===0){x([]);return}let j=he.calculateCascadePreview(e,A,R,q,o,y*n,a,48);x(j);},[e,q,o,y,n,a,48]),ce=useMemo(()=>{let A=[],R=new Date(o);for(;R<=s;){let X=(R.getTime()-o.getTime())/864e5*y*n;if(r==="day")A.push({date:new Date(R),label:R.toLocaleDateString(m,{day:"numeric",month:"short"}),x:X}),R.setDate(R.getDate()+1);else if(r==="week"){let z=P(R);A.push({date:new Date(R),label:`${f.labels.week} ${z}`,x:X}),R.setDate(R.getDate()+7);}else A.push({date:new Date(R),label:R.toLocaleDateString(m,{month:"short",year:"numeric"}),x:X}),R.setMonth(R.getMonth()+1);}return A},[o,s,r,y,n,m,f.labels.week]),be=useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*y*n,[o,y,n]),Le=Math.max(q.length*a,552);return jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},children:[jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.bgGrid,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:jsxs("svg",{width:Math.max(I,1e3),height:47,style:{display:"block"},children:[jsx("rect",{x:0,y:0,width:Math.max(I,1e3),height:48,fill:t.bgGrid}),ce.map((A,R)=>jsxs("g",{children:[R>0&&jsx("line",{x1:A.x,y1:0,x2:A.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsx("text",{x:A.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:A.label})]},`header-${R}`)),be>=0&&be<=I&&jsx("circle",{cx:be,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxs("svg",{width:Math.max(I,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(I,1e3),height:Le,fill:t.bgPrimary}),ce.map((A,R)=>{let L=ce[R+1]?.x||I,j=T(A.date);return jsxs("g",{children:[j&&jsx("rect",{x:A.x,y:0,width:L-A.x,height:q.length*a,fill:t.bgWeekend,opacity:1}),R>0&&jsx("line",{x1:A.x,y1:0,x2:A.x,y2:q.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},R)}),q.map((A,R)=>{let L=A.startDate&&A.endDate;return jsxs("g",{children:[jsx("rect",{x:0,y:R*a,width:I,height:a,fill:R%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-${A.id}`),!L&&jsxs(Fragment,{children:[jsx("rect",{x:0,y:R*a,width:I,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:j=>O(j,A),onMouseEnter:j=>{j.currentTarget.setAttribute("fill",t.accentLight),j.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:j=>{j.currentTarget.setAttribute("fill","transparent"),j.currentTarget.setAttribute("opacity","1");}},`clickable-${A.id}`),jsx("text",{x:be>0?be:100,y:R*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:f.labels.clickToSetDates},`placeholder-${A.id}`)]})]},`row-group-${A.id}`)}),q.map((A,R)=>{if(!A.startDate||!A.endDate)return null;let{x:L,width:j}=te(A),X=R*a+12,z=A.subtasks&&A.subtasks.length>0&&!A.isMilestone;return A.isMilestone?jsx(Zn,{task:A,x:L+j/2,y:X+16,theme:t,onClick:p},A.id):z?jsxs("g",{onClick:()=>p?.(A),onContextMenu:ve=>{ve.preventDefault(),ve.stopPropagation(),b?.(A,ve);},style:{cursor:"default"},children:[jsx("rect",{x:L,y:X,width:j,height:32,fill:t.primary,opacity:.25,rx:6}),jsx("line",{x1:L,y1:X,x2:L+j,y2:X,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsx("line",{x1:L,y1:X,x2:L,y2:X+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsx("line",{x1:L+j,y1:X,x2:L+j,y2:X+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsx("line",{x1:L,y1:X+32,x2:L+j,y2:X+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),j>60&&jsx("text",{x:L+12,y:X+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:A.name})]},A.id):jsx(Kn,{task:A,x:L,y:X,width:j,theme:t,dayWidth:y*n,startDate:o,templates:g,onClick:p,onDoubleClick:l,onContextMenu:b,onDateChange:v,onDependencyCreate:k,allTaskPositions:ne,onDragMove:oe,onHoverChange:w},A.id)}),q.map((A,R)=>!A.dependencies||A.dependencies.length===0||!A.startDate||!A.endDate?null:A.dependencies.map(L=>{let j=q.find(ie=>ie.id===L);if(!j||!j.startDate||!j.endDate)return null;let X=q.findIndex(ie=>ie.id===L),z=te(j),ve=te(A),se=z.x+z.width,Ie=X*a+28,qe=ve.x,Qe=R*a+28;return jsx(Xn,{x1:se,y1:Ie,x2:qe,y2:Qe,theme:t,lineStyle:i,onDelete:()=>C?.(A.id,L)},`dep-${L}-${A.id}`)})),u.map(A=>jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:A.previewX,y:A.y-48,width:A.width,height:32,rx:8,fill:A.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(A.daysDelta)>0&&jsx("text",{x:A.previewX+A.width/2,y:A.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:A.daysDelta>0?`+${A.daysDelta}d`:`${A.daysDelta}d`})]},`cascade-preview-${A.taskId}`)),be>=0&&be<=I&&jsx("line",{x1:be,y1:0,x2:be,y2:Le,stroke:t.today,strokeWidth:1,opacity:1,style:{pointerEvents:"none"}}),c&&jsx(em,{tooltipData:c,theme:t})]})]})}var Rb=['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"'],om=()=>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"})]}),Ob=()=>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"})}),$b=()=>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"})}),Ub=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M5 12h14"})}),zb=()=>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 ts({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:m,onDependencyDelete:g}){let[i,p]=useState(false),[l,b]=useState(false),[v,k]=useState([]),[C,h]=useState(""),[f,u]=useState(false),[x,c]=useState(true),N=useRef(null),w=useRef(null),B=useRef(null),{enabled:y=true,placeholder:I='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:P="bottom-right",onCommand:T,suggestions:W=Rb,maxHistory:O=50,persistHistory:q}=a,te=q?.storageKey||"gantt-ai-history",ne=q?.maxMessages??5;useEffect(()=>{if(q?.enabled)try{let R=localStorage.getItem(te);if(R){let j=JSON.parse(R).map(X=>({...X,timestamp:new Date(X.timestamp)}));k(j.slice(-ne));}}catch(R){console.warn("[GanttAIAssistant] Failed to load persisted history:",R);}},[q?.enabled,te,ne]),useEffect(()=>{if(q?.enabled&&v.length>0)try{let R=v.filter(L=>!L.isLoading).slice(-ne);localStorage.setItem(te,JSON.stringify(R));}catch(R){console.warn("[GanttAIAssistant] Failed to persist history:",R);}},[v,q?.enabled,te,ne]),useEffect(()=>{w.current&&w.current.scrollIntoView({behavior:"smooth"});},[v]),useEffect(()=>{i&&!l&&N.current&&setTimeout(()=>N.current?.focus(),100);},[i,l]);let oe=useCallback(R=>{if(R.success)switch(R.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":R.taskId&&R.updates&&o?.(R.taskId,R.updates);break;case "create_task":R.newTask&&s?.(R.newTask);break;case "delete_task":R.taskId&&n?.(R.taskId);break;case "link_tasks":R.dependencyFrom&&R.dependencyTo&&m?.(R.dependencyFrom,R.dependencyTo);break;case "unlink_tasks":R.taskId&&R.dependencyFrom&&g?.(R.taskId,R.dependencyFrom);break}},[o,s,n,m,g]),ce=useCallback(async R=>{if(!R.trim()||f)return;let L={id:`user-${Date.now()}`,role:"user",content:R,timestamp:new Date};k(X=>[...X.slice(-(O-1)),L]),h(""),c(false),u(true);let j={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};k(X=>[...X,j]);try{if(T){let X=await T(R,e);k(z=>{let ve=z.filter(Ie=>!Ie.isLoading),se={id:`assistant-${Date.now()}`,role:"assistant",content:X.message,timestamp:new Date,command:X};return [...ve,se]}),oe(X);}else k(X=>[...X.filter(ve=>!ve.isLoading),{id:`assistant-${Date.now()}`,role:"assistant",content:"AI handler not configured. Please provide an onCommand handler in the aiAssistant config.",timestamp:new Date}]);}catch(X){k(z=>[...z.filter(se=>!se.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${X instanceof Error?X.message:"Unknown error"}`,timestamp:new Date}]);}finally{u(false);}},[f,O,T,e,oe]),be=R=>{R.preventDefault(),ce(C);},Le=R=>{h(R),N.current?.focus();};if(useEffect(()=>{let R=L=>{(L.metaKey||L.ctrlKey)&&L.key==="k"&&(L.preventDefault(),p(j=>!j),i||b(false)),L.key==="Escape"&&i&&p(false);};return document.addEventListener("keydown",R),()=>document.removeEventListener("keydown",R)},[i]),useEffect(()=>{if(!i)return;let R=j=>{let X=j.target;B.current&&!B.current.contains(X)&&p(false);},L=setTimeout(()=>{document.addEventListener("mousedown",R);},100);return ()=>{clearTimeout(L),document.removeEventListener("mousedown",R);}},[i]),!y)return null;let A={"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(ft,{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 ${A[P]} 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:()=>p(true),children:[jsx(om,{}),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:B,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:l?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${A[P]} 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(om,{}),jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>b(R=>!R),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsx(Ub,{})}),jsx("button",{onClick:()=>p(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsx($b,{})})]})]}),jsx(AnimatePresence,{children:!l&&jsxs(motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[v.length===0&&x&&jsxs("div",{className:"space-y-3",children:[jsx("p",{className:"text-sm text-center",style:{color:t.textSecondary},children:"Try asking me to edit your Gantt chart:"}),jsx("div",{className:"flex flex-wrap gap-2",children:W.slice(0,4).map((R,L)=>jsx("button",{onClick:()=>Le(R),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:R.length>30?R.slice(0,30)+"...":R},L))})]}),v.map(R=>jsx(motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${R.role==="user"?"justify-end":"justify-start"}`,children:jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${R.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:R.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:R.role==="user"?"white":t.textPrimary},children:[R.isLoading?jsx(zb,{}):jsx("p",{className:"text-sm whitespace-pre-wrap",children:R.content}),R.command&&jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:R.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:R.command.success?"#10B981":"#EF4444"},children:[R.command.success?"\u2713":"\u2717",jsx("span",{className:"capitalize",children:R.command.type.replace(/_/g," ")})]})]})},R.id)),jsx("div",{ref:w})]}),jsxs("form",{onSubmit:be,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:C,onChange:R=>h(R.target.value),placeholder:I,disabled:f,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsx("button",{type:"submit",disabled:!C.trim()||f,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:C.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:C.trim()?"white":t.textSecondary},children:jsx(Ob,{})})]}),jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function nm(e,t=50){let[a,r]=useState({past:[],present:e,future:[]}),o=useRef(false),s=useCallback((i,p=true)=>{r(l=>{let b=typeof i=="function"?i(l.present):i;if(o.current)return {...l,present:b};if(!p)return {...l,present:b};let v=[...l.past,l.present];return v.length>t&&v.shift(),{past:v,present:b,future:[]}});},[t]),n=useCallback(()=>{r(i=>{if(i.past.length===0)return i;let p=i.past[i.past.length-1],l=i.past.slice(0,i.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:l,present:p,future:[i.present,...i.future]}});},[]),m=useCallback(()=>{r(i=>{if(i.future.length===0)return i;let p=i.future[0],l=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:p,future:l}});},[]),g=useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:m,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:g}}function sm({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){useEffect(()=>{if(!o)return;let s=n=>{let m=navigator.platform.toUpperCase().indexOf("MAC")>=0,g=m?n.metaKey:n.ctrlKey;if(g&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!m&&g&&n.key==="y"){n.preventDefault(),t();return}if(m&&g&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var _b={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${he.formatDate(e.startDate)} - ${he.formatDate(e.endDate)}`);let a=he.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=>he.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function im(e){return {..._b,...e}}var Zb=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},cm=forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:m="comfortable",showThemeSelector:g=true,showExportButton:i=true,availableUsers:p=[],templates:l,enableAutoCriticalPath:b=true,persistExpandedState:v,aiAssistant:k,locale:C="en",customTranslations:h,showCreateTaskButton:f=false,createTaskLabel:u,onCreateTask:x,taskFilter:c,onTaskFilterChange:N,onThemeChange:w,onTaskClick:B,onTaskDblClick:y,onTaskContextMenu:I,onTaskUpdate:P,onProgressChange:T,onTaskEdit:W,onTaskAddSubtask:O,onTaskMarkIncomplete:q,onTaskSetInProgress:te,onDependencyCreate:ne,onDependencyDelete:oe,onBeforeTaskAdd:ce,onAfterTaskAdd:be,onBeforeTaskUpdate:Le,onAfterTaskUpdate:A,onBeforeTaskDelete:R,onAfterTaskDelete:L}=a,X=useContext($n)?.theme,[z,ve]=useState(X||s||"dark"),[se,Ie]=useState(n),[qe,Qe]=useState(m),[ie,Xe]=useState(1),[lt,kt]=useState("all"),yt=c??lt,$=N??kt,[fe,Ae]=useState(0),[G,ae]=useState(false),[xe,Oe]=useState(null),[ye,it]=useState({isOpen:false,x:0,y:0,task:null}),[Ue,wt]=useState(null),[ut,Bt]=useState(null);useEffect(()=>{X&&X!==z&&ve(X);},[X]),useEffect(()=>{s&&s!==z&&ve(s);},[s]);let jt=useCallback(S=>{ve(S),w?.(S);},[w]),{state:Se,setState:Ve,undo:ua,redo:Ze,canUndo:Ke,canRedo:F,clearHistory:Te}=nm(t,50),Z=useCallback(()=>v?typeof v=="string"?v:"gantt-expanded-tasks":null,[v]),ke=useRef(new Map),Ce=useRef(false);if(!Ce.current&&v){Ce.current=true;let S=typeof v=="string"?v:"gantt-expanded-tasks";try{let E=localStorage.getItem(S);if(E){let K=JSON.parse(E);Array.isArray(K)&&(ke.current=new Map(K));}}catch(E){console.warn("[GanttBoard] Error loading expanded state from localStorage:",E);}}let $e=useCallback(()=>{let S=Z();if(S)try{let E=Array.from(ke.current.entries());localStorage.setItem(S,JSON.stringify(E));}catch(E){console.warn("[GanttBoard] Error saving expanded state to localStorage:",E);}},[Z]);useEffect(()=>{let S=E=>E.map(K=>{let re=ke.current.get(K.id),ue=re!==void 0?{...K,isExpanded:re}:K;return ue.subtasks?.length?{...ue,subtasks:S(ue.subtasks)}:ue});ke.current.size>0?Ve(S(t)):Ve(t);},[t,Ve]);let Be=useRef(t),st=useRef(true);useEffect(()=>{if(st.current){st.current=false,Be.current=Se;return}if(!r)return;let S=JSON.stringify(Be.current),E=JSON.stringify(Se);S!==E&&(Be.current=Se,r(Se));},[Se,r]);let U=useMemo(()=>Ei(C,h),[C,h]),Y=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}],[]),[pe,_e]=useState(()=>Y(U));useEffect(()=>{_e(S=>S.map(E=>({...E,label:U.columns[E.id==="name"?"taskName":E.id]||E.label})));},[U]);let ze=useMemo(()=>pe.filter(E=>E.visible).reduce((E,K)=>E+K.width,0),[pe]),H=useRef(pe.filter(S=>S.visible).map(S=>S.id).join(","));useEffect(()=>{let S=pe.filter(re=>re.visible),E=S.map(re=>re.id).join(","),K=H.current;if(E!==K){let re=S.some(Ee=>Ee.id!=="name"),ue=K.includes(",");re?!ue&&re&&Oe(null):Oe(null),H.current=E;}},[pe]);let le=60,He=.6,Ft=useMemo(()=>{let E=ze+le,K=typeof window<"u"?window.innerWidth*He:800,re=Math.max(E,K);return xe!==null?Math.max(200,Math.min(xe,re)):Math.max(200,E)},[xe,ze]),rt=useRef(null),ya=useRef(null),$a=useRef(null),ct=useMemo(()=>Ec(z),[z]),M=useMemo(()=>({theme:ct,themeName:z}),[ct,z]),V=useMemo(()=>im(l),[l]),Me=useMemo(()=>{if(!b)return Se;let S=he.calculateCriticalPath(Se),E=K=>K.map(re=>({...re,isCriticalPath:S.includes(re.id),subtasks:re.subtasks?E(re.subtasks):void 0}));return E(Se)},[Se,b]),Ye=useMemo(()=>{if(yt==="all")return Me;let S=E=>{let K=[];for(let re of E){let ue=re.subtasks?.length?S(re.subtasks):void 0,Ee=false;switch(yt){case "incomplete":Ee=re.progress<100;break;case "in_progress":Ee=re.progress>0&&re.progress<100;break;case "completed":Ee=re.progress===100;break}(Ee||ue&&ue.length>0)&&K.push({...re,subtasks:ue});}return K};return S(Me)},[Me,yt]),Pt=Zb(qe);sm({undo:ua,redo:Ze,canUndo:Ke,canRedo:F,enabled:true}),useImperativeHandle(o,()=>({getTask:S=>he.findTaskById(Se,S),addTask:(S,E)=>{Ve(K=>{if(!E)return [...K,{...S,level:0}];let re=ue=>ue.map(Ee=>Ee.id===E?{...Ee,subtasks:[...Ee.subtasks||[],{...S,parentId:E,level:(Ee.level||0)+1}],isExpanded:true}:Ee.subtasks?{...Ee,subtasks:re(Ee.subtasks)}:Ee);return re(K)});},updateTask:(S,E)=>{Ve(K=>{let re=ue=>ue.map(Ee=>Ee.id===S?{...Ee,...E}:Ee.subtasks?{...Ee,subtasks:re(Ee.subtasks)}:Ee);return re(K)});},deleteTask:S=>{Ve(E=>{let K=re=>re.filter(ue=>ue.id===S?false:(ue.subtasks&&(ue.subtasks=K(ue.subtasks)),true));return K(E)});},deleteTasks:S=>{Ve(E=>$i(E,S));},duplicateTask:S=>{Ve(E=>Ui(E,[S]));},splitTask:(S,E,K=3)=>{Ve(re=>he.splitTask(re,S,E,K));},calculateEndDate:he.calculateEndDate,calculateDuration:he.calculateDuration,validateDependency:(S,E)=>!he.validateDependencies(Se,S,E),getAllTasks:()=>he.flattenTasks(Se),getTasksByStatus:S=>he.flattenTasks(Se).filter(E=>E.status===S),getTasksByParent:S=>S?he.findTaskById(Se,S)?.subtasks||[]:Se.filter(K=>!K.parentId),getCriticalPath:()=>he.flattenTasks(Se).filter(S=>S.isCriticalPath),indentTask:S=>{Ve(E=>Bi(E,[S]));},outdentTask:S=>{Ve(E=>Ri(E,[S]));},moveTask:(S,E)=>{Ve(K=>Oi(K,[S],E));},createSubtask:async S=>{let{tasks:E,newTask:K}=Wi(Se,S);if(ce){let re=ce({...K,parentId:S});if((re instanceof Promise?await re:re)===false)return}Ve(E),be&&be({...K,parentId:S});},scrollToTask:S=>{let K=he.flattenTasks(Se).findIndex(re=>re.id===S);if(K!==-1&&rt.current){let re=K*Pt;rt.current.scrollTo({top:re,behavior:"smooth"}),ya.current&&ya.current.scrollTo({top:re,behavior:"smooth"});}},highlightTask:(S,E=2e3)=>{},expandTask:S=>{Ve(E=>{let K=re=>re.map(ue=>ue.id===S?{...ue,isExpanded:true}:ue.subtasks?{...ue,subtasks:K(ue.subtasks)}:ue);return K(E)});},collapseTask:S=>{Ve(E=>{let K=re=>re.map(ue=>ue.id===S?{...ue,isExpanded:false}:ue.subtasks?{...ue,subtasks:K(ue.subtasks)}:ue);return K(E)});},expandAll:()=>{Ve(S=>{let E=K=>K.map(re=>({...re,isExpanded:true,subtasks:re.subtasks?E(re.subtasks):void 0}));return E(S)});},collapseAll:()=>{Ve(S=>{let E=K=>K.map(re=>({...re,isExpanded:false,subtasks:re.subtasks?E(re.subtasks):void 0}));return E(S)});},undo:ua,redo:Ze,canUndo:()=>Ke,canRedo:()=>F,clearHistory:Te,exportToPNG:async()=>{if(!$a.current||!rt.current||!ya.current)throw new Error("Gantt container not found");let S=$a.current,E=rt.current.querySelector(".gantt-grid-scroll"),K=ya.current,re=E?.scrollTop||0,ue=K.scrollTop,Ee=S.style.overflow,Lt=S.style.height;try{let mt=E?.querySelector(".gantt-taskgrid-content"),qt=K.querySelector("svg"),Ca=mt?.scrollHeight||E?.scrollHeight||600,Sa=qt?.getBoundingClientRect().height||K.scrollHeight,Jr=(S.querySelector('[class*="h-12"]')?.offsetHeight||48)+Math.max(Ca,Sa)+20;E&&(E.scrollTop=0),K.scrollTop=0,S.style.overflow="visible",S.style.height=`${Jr}px`,await new Promise(Lr=>setTimeout(Lr,100));let fr=await dm(S,{backgroundColor:ct.bgPrimary,scale:2,logging:!1,useCORS:!0,ignoreElements:Lr=>{let xo=window.getComputedStyle(Lr),Zr=parseInt(xo.zIndex,10);return !isNaN(Zr)&&Zr>=50||xo.position==="fixed"}});return new Promise((Lr,xo)=>{fr.toBlob(Zr=>{Zr?Lr(Zr):xo(new Error("Failed to create blob from canvas"));},"image/png");})}finally{S.style.overflow=Ee,S.style.height=Lt,E&&(E.scrollTop=re),K.scrollTop=ue;}},exportToPDF:async S=>{await he.exportToPDF(Se,S);},exportToExcel:async S=>{await he.exportToExcel(Se,S);},exportToJSON:()=>he.exportToJSON(Se),exportToCSV:()=>he.exportToCSV(Se),importFromJSON:S=>{let E=he.importFromJSON(S);Ve(E);},getTasks:()=>Se,refresh:()=>{Ve(S=>[...S]);},clearAll:()=>{Ve([]);}}),[Se,ua,Ze,Ke,F,Te,ct,Pt]);let de=useCallback(S=>{_e(E=>E.map(K=>K.id===S?{...K,visible:!K.visible}:K));},[]),We=useCallback((S,E)=>{_e(K=>K.map(re=>{if(re.id!==S)return re;let ue=re.minWidth??100,Ee=re.maxWidth??800,Lt=Math.max(ue,Math.min(Ee,E));return {...re,width:Lt}}));},[]),vt=useCallback(S=>{Ve(E=>{let K=Hi(E,S),re=ue=>{for(let Ee of ue){if(Ee.id===S){ke.current.set(S,Ee.isExpanded??true);return}Ee.subtasks?.length&&re(Ee.subtasks);}};return re(K),$e(),K}),a.onTaskToggleExpand?.(S);},[a,$e]),Re=useCallback((S,E)=>{if(Le&&Le(S,E)===false)return;let re=he.findTaskById(Se,S)?.progress,ue=Lt=>Lt.map(mt=>mt.id===S?{...mt,...E}:mt.subtasks?{...mt,subtasks:ue(mt.subtasks)}:mt);Ve(ue(Se));let Ee=he.findTaskById(ue(Se),S);Ee&&(P?.(Ee),A?.(Ee),E.progress!==void 0&&re!==void 0&&E.progress!==re&&T?.(S,re,E.progress));},[Se,P,Le,A,T]),gt=useCallback(S=>{S.length!==0&&(Ve(E=>Bi(E,S)),a.onTaskIndent?.(S[0]));},[a]),va=useCallback(S=>{S.length!==0&&(Ve(E=>Ri(E,S)),a.onTaskOutdent?.(S[0]));},[a]),wa=useCallback((S,E,K)=>{Ve(re=>jc(re,S,E,K)),a.onTaskReparent?.(S,E,K);},[a]),Kt=useCallback((S,E)=>{S.length!==0&&(Ve(K=>Oi(K,S,E)),a.onTaskMove?.(S[0],E));},[a]),je=useCallback(async S=>{let E=[];for(let K of S)R&&await Promise.resolve(R(K))===false||E.push(K);E.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(E):(Ve(K=>$i(K,E)),E.forEach(K=>a.onTaskDelete?.(K))),L&&E.forEach(K=>L(K)));},[a,R,L]),Yt=useCallback(S=>{Ve(E=>Ui(E,S)),S.forEach(E=>a.onTaskDuplicate?.(E));},[a]),ga=useCallback((S,E)=>{Ve(K=>{let{tasks:re,newTask:ue}=Vc(K,S,E);return ce&&ce(ue)===false?K:(a.onTaskCreate?.(ue.parentId,ue.position||0),be?.(ue),re)});},[a,ce,be]),Ar=useCallback((S,E)=>{Ve(K=>zi(K,S,E)),a.onTaskRename?.(S,E);},[a]),Ns=useCallback(S=>{Ve(E=>{let{tasks:K}=Wi(E,S);return a.onTaskCreate?.(S,0),K});},[a]),cu=useCallback((S,E,K)=>{let re=S.startDate?Math.round((E.getTime()-S.startDate.getTime())/864e5):0,ue=mt=>mt.map(qt=>qt.id===S.id?{...qt,startDate:E,endDate:K,...S.segments&&{segments:S.segments}}:qt.subtasks?{...qt,subtasks:ue(qt.subtasks)}:qt),Ee=ue(Se);Ee=he.autoScheduleDependents(Ee,S.id,re),Ve(Ee);let Lt={...S,startDate:E,endDate:K};P?.(Lt);},[Se,P]),mu=useCallback((S,E)=>{I?.(S,E),it({isOpen:true,x:E.clientX,y:E.clientY,task:S});},[I]),pu=useCallback((S,E)=>{let K=he.splitTask(Se,S.id,E);Ve(K),it({isOpen:false,x:0,y:0,task:null});},[Se]),Xl=useCallback(S=>{let E=he.findTaskById(Se,S.id)||S;y?.(E),W||wt(E);},[Se,y,W]),Jl=useCallback((S,E,K)=>{let re=new Map,ue=Ca=>{Ca.forEach(Sa=>{Sa.dependencies&&re.set(Sa.id,Sa.dependencies),Sa.subtasks&&ue(Sa.subtasks);});};ue(K);let Ee=re.get(E)||[];re.set(E,[...Ee,S]);let Lt=new Set,mt=new Set,qt=Ca=>{if(!Lt.has(Ca)){Lt.add(Ca),mt.add(Ca);let Sa=re.get(Ca)||[];for(let Fr of Sa){if(!Lt.has(Fr)&&qt(Fr))return true;if(mt.has(Fr))return true}}return mt.delete(Ca),false};return qt(E)},[]),Zl=useCallback((S,E)=>{if(Jl(S.id,E,Se)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
342
|
+
</Project>`,p=new Blob([i],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(p),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=he.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 p=i.startDate&&i.endDate?he.calculateDuration(i.startDate,i.endDate):0,d=0;if(i.dependencies&&i.dependencies.length>0)for(let y of i.dependencies){let k=t.find(C=>C.id===y);if(k){o(k);let C=r.get(y)?.ef||0;d=Math.max(d,C);}}let f=d+p;r.set(i.id,{es:d,ef:f});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),n=new Map,c=i=>{if(n.has(i.id))return;let p=i.startDate&&i.endDate?he.calculateDuration(i.startDate,i.endDate):0,d=t.filter(k=>k.dependencies&&k.dependencies.includes(i.id)),f=s;if(d.length>0)for(let k of d){c(k);let C=n.get(k.id)?.ls||0;f=Math.min(f,C);}let y=f-p;n.set(i.id,{ls:y,lf:f});};a.forEach(c);let g=[];for(let i of a){let p=r.get(i.id),d=n.get(i.id);if(p&&d){let f=d.ls-p.es;Math.abs(f)<.01&&g.push(i.id);}}return g},calculateSlack:(e,t)=>{let a=he.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(he.calculateCriticalPath(e).includes(t))return 0;let o=he.getDependentTasks(e,t);if(o.length===0){let c=he.getLatestEndDate(e);if(!c)return null;let g=he.calculateDuration(a.endDate,c);return Math.max(0,g)}let s=o.filter(c=>c.startDate).map(c=>c.startDate.getTime()).sort((c,g)=>c-g)[0];if(!s)return null;let n=he.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>he.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=he.findTaskById(e,t);if(!r||!r.endDate)return e;let o=he.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let n of o){if(!n.startDate||!n.endDate)continue;let c=he.calculateDuration(n.startDate,n.endDate),g;a!==void 0?(g=new Date(n.startDate),g.setDate(g.getDate()+a)):(g=new Date(r.endDate),g.setDate(g.getDate()+1));let i=he.calculateEndDate(g,c),p=d=>d.map(f=>f.id===n.id?{...f,startDate:g,endDate:i}:f.subtasks?{...f,subtasks:p(f.subtasks)}:f);s=p(s),s=he.autoScheduleDependents(s,n.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,n,c)=>{if(a===0)return [];let g=[],i=o.getTime(),p=1e3*60*60*24,d=he.findTaskById(e,t);if(!d||!d.endDate)return [];let f=(y,k,C=new Set)=>{if(C.has(y))return;C.add(y);let h=he.getDependentTasks(e,y);for(let b of h){if(!b.startDate||!b.endDate)continue;let u=r.findIndex(T=>T.id===b.id);if(u===-1)continue;let x=b.startDate.getTime(),N=(b.endDate.getTime()-x)/p,B=(x-i)/p*s,v=B+k*s,I=Math.max(N*s,s),A=c+u*n+12;g.push({taskId:b.id,taskName:b.name,originalX:B,previewX:v,width:I,y:A,rowIndex:u,daysDelta:k,color:b.color}),f(b.id,k,C);}};return f(t,a),g},splitTask:(e,t,a,r=3)=>{let o=he.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let n=new Date(a);n.setDate(n.getDate()+r);let c=new Date(o.endDate);c.setDate(c.getDate()+r);let g=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:c}],i=p=>p.map(d=>d.id===o.id?{...d,endDate:c,segments:g}:d.subtasks?{...d,subtasks:i(d.subtasks)}:d);return i(e)}};function as({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:c="en",templates:g,dependencyLineStyle:i="curved",onTaskClick:p,onTaskDblClick:d,onTaskContextMenu:f,onTaskDateChange:y,onDependencyCreate:k,onDependencyDelete:C}){let b=Vr(),[u,x]=useState([]),[m,N]=useState(null),w=useCallback(M=>{N(M);},[]),B=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),v=r==="day"?60:r==="week"?20:8,I=B*v*n,A=M=>{let R=new Date(Date.UTC(M.getFullYear(),M.getMonth(),M.getDate())),L=R.getUTCDay()||7;R.setUTCDate(R.getUTCDate()+4-L);let V=new Date(Date.UTC(R.getUTCFullYear(),0,1));return Math.ceil(((R.getTime()-V.getTime())/864e5+1)/7)},T=M=>{let R=M.getDay();return R===0||R===6},H=useCallback(M=>{let R=Math.round(M/(v*n)),L=new Date(o);return L.setDate(L.getDate()+R),L},[o,v,n]),O=useCallback((M,R)=>{if(R.startDate&&R.endDate)return;let L=M.currentTarget.ownerSVGElement;if(!L)return;let V=L.createSVGPoint();V.x=M.clientX,V.y=M.clientY;let q=V.matrixTransform(L.getScreenCTM()?.inverse()),z=H(q.x),ye=new Date(z);ye.setDate(ye.getDate()+1),y?.(R,z,ye);},[H,y]),j=useMemo(()=>{let M=q=>q.map(z=>{if(z.subtasks&&z.subtasks.length>0){let ye=M(z.subtasks),se=ye.filter(Be=>Be.startDate&&Be.endDate);if(se.length>0){let Be=se.map(Je=>Je.startDate.getTime()),Ye=se.map(Je=>Je.endDate.getTime()),tt=new Date(Math.min(...Be)),ie=new Date(Math.max(...Ye));return {...z,subtasks:ye,startDate:tt,endDate:ie}}return {...z,subtasks:ye}}return z}),R=(q,z=[])=>{for(let ye of q)z.push(ye),ye.subtasks&&ye.subtasks.length>0&&(ye.isExpanded===void 0||ye.isExpanded)&&R(ye.subtasks,z);return z},L=M(e);return R(L)},[e]),ae=useCallback(M=>{if(!M.startDate||!M.endDate)return {x:0,width:0};let R=M.startDate.getTime(),L=M.endDate.getTime(),V=o.getTime(),q=(R-V)/(1e3*60*60*24),z=(L-R)/(1e3*60*60*24),ye=q*v*n,se=Math.max(v*n,40),Be=Math.max(z*v*n,se);return {x:ye,width:Be}},[o,v,n]),ne=useMemo(()=>j.filter(M=>M.startDate&&M.endDate).map(M=>{let{x:R,width:L}=ae(M),q=j.findIndex(z=>z.id===M.id)*a+12;return {id:M.id,x:R,y:q,width:L,height:32}}),[j,ae]),re=useCallback((M,R,L)=>{if(!L||R===0){x([]);return}let V=he.calculateCascadePreview(e,M,R,j,o,v*n,a,48);x(V);},[e,j,o,v,n,a,48]),ge=useMemo(()=>{let M=[],R=new Date(o);for(;R<=s;){let q=(R.getTime()-o.getTime())/864e5*v*n;if(r==="day")M.push({date:new Date(R),label:R.toLocaleDateString(c,{day:"numeric",month:"short"}),x:q}),R.setDate(R.getDate()+1);else if(r==="week"){let z=A(R);M.push({date:new Date(R),label:`${b.labels.week} ${z}`,x:q}),R.setDate(R.getDate()+7);}else M.push({date:new Date(R),label:R.toLocaleDateString(c,{month:"short",year:"numeric"}),x:q}),R.setMonth(R.getMonth()+1);}return M},[o,s,r,v,n,c,b.labels.week]),fe=useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*v*n,[o,v,n]),Ie=Math.max(j.length*a,552);return jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},children:[jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.bgGrid,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:jsxs("svg",{width:Math.max(I,1e3),height:47,style:{display:"block"},children:[jsx("rect",{x:0,y:0,width:Math.max(I,1e3),height:48,fill:t.bgGrid}),ge.map((M,R)=>jsxs("g",{children:[R>0&&jsx("line",{x1:M.x,y1:0,x2:M.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsx("text",{x:M.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:M.label})]},`header-${R}`)),fe>=0&&fe<=I&&jsx("circle",{cx:fe,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxs("svg",{width:Math.max(I,1e3),height:Ie,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(I,1e3),height:Ie,fill:t.bgPrimary}),ge.map((M,R)=>{let L=ge[R+1]?.x||I,V=T(M.date);return jsxs("g",{children:[V&&jsx("rect",{x:M.x,y:0,width:L-M.x,height:j.length*a,fill:t.bgWeekend,opacity:1}),R>0&&jsx("line",{x1:M.x,y1:0,x2:M.x,y2:j.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},R)}),j.map((M,R)=>{let L=M.startDate&&M.endDate;return jsxs("g",{children:[jsx("rect",{x:0,y:R*a,width:I,height:a,fill:R%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-${M.id}`),!L&&jsxs(Fragment,{children:[jsx("rect",{x:0,y:R*a,width:I,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:V=>O(V,M),onMouseEnter:V=>{V.currentTarget.setAttribute("fill",t.accentLight),V.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:V=>{V.currentTarget.setAttribute("fill","transparent"),V.currentTarget.setAttribute("opacity","1");}},`clickable-${M.id}`),jsx("text",{x:fe>0?fe:100,y:R*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:b.labels.clickToSetDates},`placeholder-${M.id}`)]})]},`row-group-${M.id}`)}),j.map((M,R)=>{if(!M.startDate||!M.endDate)return null;let{x:L,width:V}=ae(M),q=R*a+12,z=M.subtasks&&M.subtasks.length>0&&!M.isMilestone;return M.isMilestone?jsx(es,{task:M,x:L+V/2,y:q+16,theme:t,onClick:p},M.id):z?jsxs("g",{onClick:()=>p?.(M),onContextMenu:ye=>{ye.preventDefault(),ye.stopPropagation(),f?.(M,ye);},style:{cursor:"default"},children:[jsx("rect",{x:L,y:q,width:V,height:32,fill:t.primary,opacity:.25,rx:6}),jsx("line",{x1:L,y1:q,x2:L+V,y2:q,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsx("line",{x1:L,y1:q,x2:L,y2:q+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsx("line",{x1:L+V,y1:q,x2:L+V,y2:q+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsx("line",{x1:L,y1:q+32,x2:L+V,y2:q+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),V>60&&jsx("text",{x:L+12,y:q+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:M.name})]},M.id):jsx(qn,{task:M,x:L,y:q,width:V,theme:t,dayWidth:v*n,startDate:o,templates:g,onClick:p,onDoubleClick:d,onContextMenu:f,onDateChange:y,onDependencyCreate:k,allTaskPositions:ne,onDragMove:re,onHoverChange:w},M.id)}),j.map((M,R)=>!M.dependencies||M.dependencies.length===0||!M.startDate||!M.endDate?null:M.dependencies.map(L=>{let V=j.find(ie=>ie.id===L);if(!V||!V.startDate||!V.endDate)return null;let q=j.findIndex(ie=>ie.id===L),z=ae(V),ye=ae(M),se=z.x+z.width,Be=q*a+28,Ye=ye.x,tt=R*a+28;return jsx(Zn,{x1:se,y1:Be,x2:Ye,y2:tt,theme:t,lineStyle:i,onDelete:()=>C?.(M.id,L)},`dep-${L}-${M.id}`)})),u.map(M=>jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:M.previewX,y:M.y-48,width:M.width,height:32,rx:8,fill:M.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(M.daysDelta)>0&&jsx("text",{x:M.previewX+M.width/2,y:M.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:M.daysDelta>0?`+${M.daysDelta}d`:`${M.daysDelta}d`})]},`cascade-preview-${M.taskId}`)),fe>=0&&fe<=I&&jsx("line",{x1:fe,y1:0,x2:fe,y2:Ie,stroke:t.today,strokeWidth:1,opacity:1,style:{pointerEvents:"none"}}),m&&jsx(am,{tooltipData:m,theme:t})]})]})}var zb=['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"'],sm=()=>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"})]}),Hb=()=>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"})}),Wb=()=>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"})}),Gb=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M5 12h14"})}),_b=()=>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 rs({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:c,onDependencyDelete:g}){let[i,p]=useState(false),[d,f]=useState(false),[y,k]=useState([]),[C,h]=useState(""),[b,u]=useState(false),[x,m]=useState(true),N=useRef(null),w=useRef(null),B=useRef(null),{enabled:v=true,placeholder:I='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:A="bottom-right",onCommand:T,suggestions:H=zb,maxHistory:O=50,persistHistory:j}=a,ae=j?.storageKey||"gantt-ai-history",ne=j?.maxMessages??5;useEffect(()=>{if(j?.enabled)try{let R=localStorage.getItem(ae);if(R){let V=JSON.parse(R).map(q=>({...q,timestamp:new Date(q.timestamp)}));k(V.slice(-ne));}}catch(R){console.warn("[GanttAIAssistant] Failed to load persisted history:",R);}},[j?.enabled,ae,ne]),useEffect(()=>{if(j?.enabled&&y.length>0)try{let R=y.filter(L=>!L.isLoading).slice(-ne);localStorage.setItem(ae,JSON.stringify(R));}catch(R){console.warn("[GanttAIAssistant] Failed to persist history:",R);}},[y,j?.enabled,ae,ne]),useEffect(()=>{w.current&&w.current.scrollIntoView({behavior:"smooth"});},[y]),useEffect(()=>{i&&!d&&N.current&&setTimeout(()=>N.current?.focus(),100);},[i,d]);let re=useCallback(R=>{if(R.success)switch(R.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":R.taskId&&R.updates&&o?.(R.taskId,R.updates);break;case "create_task":R.newTask&&s?.(R.newTask);break;case "delete_task":R.taskId&&n?.(R.taskId);break;case "link_tasks":R.dependencyFrom&&R.dependencyTo&&c?.(R.dependencyFrom,R.dependencyTo);break;case "unlink_tasks":R.taskId&&R.dependencyFrom&&g?.(R.taskId,R.dependencyFrom);break}},[o,s,n,c,g]),ge=useCallback(async R=>{if(!R.trim()||b)return;let L={id:`user-${Date.now()}`,role:"user",content:R,timestamp:new Date};k(q=>[...q.slice(-(O-1)),L]),h(""),m(false),u(true);let V={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};k(q=>[...q,V]);try{if(T){let q=await T(R,e);k(z=>{let ye=z.filter(Be=>!Be.isLoading),se={id:`assistant-${Date.now()}`,role:"assistant",content:q.message,timestamp:new Date,command:q};return [...ye,se]}),re(q);}else k(q=>[...q.filter(ye=>!ye.isLoading),{id:`assistant-${Date.now()}`,role:"assistant",content:"AI handler not configured. Please provide an onCommand handler in the aiAssistant config.",timestamp:new Date}]);}catch(q){k(z=>[...z.filter(se=>!se.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${q instanceof Error?q.message:"Unknown error"}`,timestamp:new Date}]);}finally{u(false);}},[b,O,T,e,re]),fe=R=>{R.preventDefault(),ge(C);},Ie=R=>{h(R),N.current?.focus();};if(useEffect(()=>{let R=L=>{(L.metaKey||L.ctrlKey)&&L.key==="k"&&(L.preventDefault(),p(V=>!V),i||f(false)),L.key==="Escape"&&i&&p(false);};return document.addEventListener("keydown",R),()=>document.removeEventListener("keydown",R)},[i]),useEffect(()=>{if(!i)return;let R=V=>{let q=V.target;B.current&&!B.current.contains(q)&&p(false);},L=setTimeout(()=>{document.addEventListener("mousedown",R);},100);return ()=>{clearTimeout(L),document.removeEventListener("mousedown",R);}},[i]),!v)return null;let M={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"};return jsxs(ht,{children:[jsx(AnimatePresence,{children:!i&&jsxs(motion.button,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},className:`fixed ${M[A]} 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:()=>p(true),children:[jsx(sm,{}),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:B,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:d?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${M[A]} 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(sm,{}),jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>f(R=>!R),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsx(Gb,{})}),jsx("button",{onClick:()=>p(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsx(Wb,{})})]})]}),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:[y.length===0&&x&&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((R,L)=>jsx("button",{onClick:()=>Ie(R),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:R.length>30?R.slice(0,30)+"...":R},L))})]}),y.map(R=>jsx(motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${R.role==="user"?"justify-end":"justify-start"}`,children:jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${R.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:R.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:R.role==="user"?"white":t.textPrimary},children:[R.isLoading?jsx(_b,{}):jsx("p",{className:"text-sm whitespace-pre-wrap",children:R.content}),R.command&&jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:R.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:R.command.success?"#10B981":"#EF4444"},children:[R.command.success?"\u2713":"\u2717",jsx("span",{className:"capitalize",children:R.command.type.replace(/_/g," ")})]})]})},R.id)),jsx("div",{ref:w})]}),jsxs("form",{onSubmit:fe,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:C,onChange:R=>h(R.target.value),placeholder:I,disabled:b,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsx("button",{type:"submit",disabled:!C.trim()||b,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:C.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:C.trim()?"white":t.textSecondary},children:jsx(Hb,{})})]}),jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function im(e,t=50){let[a,r]=useState({past:[],present:e,future:[]}),o=useRef(false),s=useCallback((i,p=true)=>{r(d=>{let f=typeof i=="function"?i(d.present):i;if(o.current)return {...d,present:f};if(!p)return {...d,present:f};let y=[...d.past,d.present];return y.length>t&&y.shift(),{past:y,present:f,future:[]}});},[t]),n=useCallback(()=>{r(i=>{if(i.past.length===0)return i;let p=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:p,future:[i.present,...i.future]}});},[]),c=useCallback(()=>{r(i=>{if(i.future.length===0)return i;let p=i.future[0],d=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:p,future:d}});},[]),g=useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:c,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:g}}function lm({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){useEffect(()=>{if(!o)return;let s=n=>{let c=navigator.platform.toUpperCase().indexOf("MAC")>=0,g=c?n.metaKey:n.ctrlKey;if(g&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!c&&g&&n.key==="y"){n.preventDefault(),t();return}if(c&&g&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var Yb={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${he.formatDate(e.startDate)} - ${he.formatDate(e.endDate)}`);let a=he.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=>he.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function dm(e){return {...Yb,...e}}var ah=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},pm=forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:c="comfortable",showThemeSelector:g=true,showExportButton:i=true,availableUsers:p=[],templates:d,enableAutoCriticalPath:f=true,persistExpandedState:y,aiAssistant:k,locale:C="en",customTranslations:h,showCreateTaskButton:b=false,createTaskLabel:u,onCreateTask:x,taskFilter:m,onTaskFilterChange:N,onThemeChange:w,onTaskClick:B,onTaskDblClick:v,onTaskContextMenu:I,onTaskUpdate:A,onProgressChange:T,onTaskEdit:H,onTaskAddSubtask:O,onTaskMarkIncomplete:j,onTaskSetInProgress:ae,onDependencyCreate:ne,onDependencyDelete:re,onBeforeTaskAdd:ge,onAfterTaskAdd:fe,onBeforeTaskUpdate:Ie,onAfterTaskUpdate:M,onBeforeTaskDelete:R,onAfterTaskDelete:L}=a,q=useContext(zn)?.theme,[z,ye]=useState(q||s||"dark"),[se,Be]=useState(n),[Ye,tt]=useState(c),[ie,Je]=useState(1),[mt,Ct]=useState("all"),xt=m??mt,$=N??Ct,[be,Pe]=useState(0),[Me,je]=useState(false),[Ze,Pt]=useState(null),[Le,J]=useState({isOpen:false,x:0,y:0,task:null}),[ve,Ue]=useState(null),[Fe,at]=useState(null);useEffect(()=>{q&&q!==z&&ye(q);},[q]),useEffect(()=>{s&&s!==z&&ye(s);},[s]);let ct=useCallback(S=>{ye(S),w?.(S);},[w]),{state:te,setState:$e,undo:Kt,redo:Qe,canUndo:Ke,canRedo:F,clearHistory:Ce}=im(t,50),Z=useCallback(()=>y?typeof y=="string"?y:"gantt-expanded-tasks":null,[y]),xe=useRef(new Map),we=useRef(false);if(!we.current&&y){we.current=true;let S=typeof y=="string"?y:"gantt-expanded-tasks";try{let E=localStorage.getItem(S);if(E){let K=JSON.parse(E);Array.isArray(K)&&(xe.current=new Map(K));}}catch(E){console.warn("[GanttBoard] Error loading expanded state from localStorage:",E);}}let ze=useCallback(()=>{let S=Z();if(S)try{let E=Array.from(xe.current.entries());localStorage.setItem(S,JSON.stringify(E));}catch(E){console.warn("[GanttBoard] Error saving expanded state to localStorage:",E);}},[Z]);useEffect(()=>{let S=E=>E.map(K=>{let oe=xe.current.get(K.id),pe=oe!==void 0?{...K,isExpanded:oe}:K;return pe.subtasks?.length?{...pe,subtasks:S(pe.subtasks)}:pe});xe.current.size>0?$e(S(t)):$e(t);},[t,$e]);let Re=useRef(t),dt=useRef(true);useEffect(()=>{if(dt.current){dt.current=false,Re.current=te;return}if(!r)return;let S=JSON.stringify(Re.current),E=JSON.stringify(te);S!==E&&(Re.current=te,r(te));},[te,r]);let U=useMemo(()=>Mi(C,h),[C,h]),Y=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}],[]),[me,Ve]=useState(()=>Y(U));useEffect(()=>{Ve(S=>S.map(E=>({...E,label:U.columns[E.id==="name"?"taskName":E.id]||E.label})));},[U]);let He=useMemo(()=>me.filter(E=>E.visible).reduce((E,K)=>E+K.width,0),[me]),W=useRef(me.filter(S=>S.visible).map(S=>S.id).join(","));useEffect(()=>{let S=me.filter(oe=>oe.visible),E=S.map(oe=>oe.id).join(","),K=W.current;if(E!==K){let oe=S.some(De=>De.id!=="name"),pe=K.includes(",");oe?!pe&&oe&&Pt(null):Pt(null),W.current=E;}},[me]);let le=60,We=.6,It=useMemo(()=>{let E=He+le,K=typeof window<"u"?window.innerWidth*We:800,oe=Math.max(E,K);return Ze!==null?Math.max(200,Math.min(Ze,oe)):Math.max(200,E)},[Ze,He]),st=useRef(null),ya=useRef(null),Ua=useRef(null),ut=useMemo(()=>Mc(z),[z]),P=useMemo(()=>({theme:ut,themeName:z}),[ut,z]),_=useMemo(()=>dm(d),[d]),Ee=useMemo(()=>{if(!f)return te;let S=he.calculateCriticalPath(te),E=K=>K.map(oe=>({...oe,isCriticalPath:S.includes(oe.id),subtasks:oe.subtasks?E(oe.subtasks):void 0}));return E(te)},[te,f]),Xe=useMemo(()=>{if(xt==="all")return Ee;let S=E=>{let K=[];for(let oe of E){let pe=oe.subtasks?.length?S(oe.subtasks):void 0,De=false;switch(xt){case "incomplete":De=oe.progress<100;break;case "in_progress":De=oe.progress>0&&oe.progress<100;break;case "completed":De=oe.progress===100;break}(De||pe&&pe.length>0)&&K.push({...oe,subtasks:pe});}return K};return S(Ee)},[Ee,xt]),At=ah(Ye);lm({undo:Kt,redo:Qe,canUndo:Ke,canRedo:F,enabled:true}),useImperativeHandle(o,()=>({getTask:S=>he.findTaskById(te,S),addTask:(S,E)=>{$e(K=>{if(!E)return [...K,{...S,level:0}];let oe=pe=>pe.map(De=>De.id===E?{...De,subtasks:[...De.subtasks||[],{...S,parentId:E,level:(De.level||0)+1}],isExpanded:true}:De.subtasks?{...De,subtasks:oe(De.subtasks)}:De);return oe(K)});},updateTask:(S,E)=>{$e(K=>{let oe=pe=>pe.map(De=>De.id===S?{...De,...E}:De.subtasks?{...De,subtasks:oe(De.subtasks)}:De);return oe(K)});},deleteTask:S=>{$e(E=>{let K=oe=>oe.filter(pe=>pe.id===S?false:(pe.subtasks&&(pe.subtasks=K(pe.subtasks)),true));return K(E)});},deleteTasks:S=>{$e(E=>zi(E,S));},duplicateTask:S=>{$e(E=>Hi(E,[S]));},splitTask:(S,E,K=3)=>{$e(oe=>he.splitTask(oe,S,E,K));},calculateEndDate:he.calculateEndDate,calculateDuration:he.calculateDuration,validateDependency:(S,E)=>!he.validateDependencies(te,S,E),getAllTasks:()=>he.flattenTasks(te),getTasksByStatus:S=>he.flattenTasks(te).filter(E=>E.status===S),getTasksByParent:S=>S?he.findTaskById(te,S)?.subtasks||[]:te.filter(K=>!K.parentId),getCriticalPath:()=>he.flattenTasks(te).filter(S=>S.isCriticalPath),indentTask:S=>{$e(E=>Oi(E,[S]));},outdentTask:S=>{$e(E=>$i(E,[S]));},moveTask:(S,E)=>{$e(K=>Ui(K,[S],E));},createSubtask:async S=>{let{tasks:E,newTask:K}=_i(te,S);if(ge){let oe=ge({...K,parentId:S});if((oe instanceof Promise?await oe:oe)===false)return}$e(E),fe&&fe({...K,parentId:S});},scrollToTask:S=>{let K=he.flattenTasks(te).findIndex(oe=>oe.id===S);if(K!==-1&&st.current){let oe=K*At;st.current.scrollTo({top:oe,behavior:"smooth"}),ya.current&&ya.current.scrollTo({top:oe,behavior:"smooth"});}},highlightTask:(S,E=2e3)=>{},expandTask:S=>{$e(E=>{let K=oe=>oe.map(pe=>pe.id===S?{...pe,isExpanded:true}:pe.subtasks?{...pe,subtasks:K(pe.subtasks)}:pe);return K(E)});},collapseTask:S=>{$e(E=>{let K=oe=>oe.map(pe=>pe.id===S?{...pe,isExpanded:false}:pe.subtasks?{...pe,subtasks:K(pe.subtasks)}:pe);return K(E)});},expandAll:()=>{$e(S=>{let E=K=>K.map(oe=>({...oe,isExpanded:true,subtasks:oe.subtasks?E(oe.subtasks):void 0}));return E(S)});},collapseAll:()=>{$e(S=>{let E=K=>K.map(oe=>({...oe,isExpanded:false,subtasks:oe.subtasks?E(oe.subtasks):void 0}));return E(S)});},undo:Kt,redo:Qe,canUndo:()=>Ke,canRedo:()=>F,clearHistory:Ce,exportToPNG:async()=>{if(!Ua.current||!st.current||!ya.current)throw new Error("Gantt container not found");let S=Ua.current,E=st.current.querySelector(".gantt-grid-scroll"),K=ya.current,oe=E?.scrollTop||0,pe=K.scrollTop,De=S.style.overflow,Bt=S.style.height;try{let gt=E?.querySelector(".gantt-taskgrid-content"),Xt=K.querySelector("svg"),Ta=gt?.scrollHeight||E?.scrollHeight||600,Ea=Xt?.getBoundingClientRect().height||K.scrollHeight,Zr=(S.querySelector('[class*="h-12"]')?.offsetHeight||48)+Math.max(Ta,Ea)+20;E&&(E.scrollTop=0),K.scrollTop=0,S.style.overflow="visible",S.style.height=`${Zr}px`,await new Promise(Ir=>setTimeout(Ir,100));let hr=await mm(S,{backgroundColor:ut.bgPrimary,scale:2,logging:!1,useCORS:!0,ignoreElements:Ir=>{let ko=window.getComputedStyle(Ir),Qr=parseInt(ko.zIndex,10);return !isNaN(Qr)&&Qr>=50||ko.position==="fixed"}});return new Promise((Ir,ko)=>{hr.toBlob(Qr=>{Qr?Ir(Qr):ko(new Error("Failed to create blob from canvas"));},"image/png");})}finally{S.style.overflow=De,S.style.height=Bt,E&&(E.scrollTop=oe),K.scrollTop=pe;}},exportToPDF:async S=>{await he.exportToPDF(te,S);},exportToExcel:async S=>{await he.exportToExcel(te,S);},exportToJSON:()=>he.exportToJSON(te),exportToCSV:()=>he.exportToCSV(te),importFromJSON:S=>{let E=he.importFromJSON(S);$e(E);},getTasks:()=>te,refresh:()=>{$e(S=>[...S]);},clearAll:()=>{$e([]);}}),[te,Kt,Qe,Ke,F,Ce,ut,At]);let de=useCallback(S=>{Ve(E=>E.map(K=>K.id===S?{...K,visible:!K.visible}:K));},[]),_e=useCallback((S,E)=>{Ve(K=>K.map(oe=>{if(oe.id!==S)return oe;let pe=oe.minWidth??100,De=oe.maxWidth??800,Bt=Math.max(pe,Math.min(De,E));return {...oe,width:Bt}}));},[]),kt=useCallback(S=>{$e(E=>{let K=Gi(E,S),oe=pe=>{for(let De of pe){if(De.id===S){xe.current.set(S,De.isExpanded??true);return}De.subtasks?.length&&oe(De.subtasks);}};return oe(K),ze(),K}),a.onTaskToggleExpand?.(S);},[a,ze]),Oe=useCallback((S,E)=>{if(Ie&&Ie(S,E)===false)return;let oe=he.findTaskById(te,S)?.progress,pe=Bt=>Bt.map(gt=>gt.id===S?{...gt,...E}:gt.subtasks?{...gt,subtasks:pe(gt.subtasks)}:gt);$e(pe(te));let De=he.findTaskById(pe(te),S);De&&(A?.(De),M?.(De),E.progress!==void 0&&oe!==void 0&&E.progress!==oe&&T?.(S,oe,E.progress));},[te,A,Ie,M,T]),bt=useCallback(S=>{S.length!==0&&($e(E=>Oi(E,S)),a.onTaskIndent?.(S[0]));},[a]),va=useCallback(S=>{S.length!==0&&($e(E=>$i(E,S)),a.onTaskOutdent?.(S[0]));},[a]),Ca=useCallback((S,E,K)=>{$e(oe=>Yc(oe,S,E,K)),a.onTaskReparent?.(S,E,K);},[a]),Yt=useCallback((S,E)=>{S.length!==0&&($e(K=>Ui(K,S,E)),a.onTaskMove?.(S[0],E));},[a]),qe=useCallback(async S=>{let E=[];for(let K of S)R&&await Promise.resolve(R(K))===false||E.push(K);E.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(E):($e(K=>zi(K,E)),E.forEach(K=>a.onTaskDelete?.(K))),L&&E.forEach(K=>L(K)));},[a,R,L]),qt=useCallback(S=>{$e(E=>Hi(E,S)),S.forEach(E=>a.onTaskDuplicate?.(E));},[a]),ga=useCallback((S,E)=>{$e(K=>{let{tasks:oe,newTask:pe}=Kc(K,S,E);return ge&&ge(pe)===false?K:(a.onTaskCreate?.(pe.parentId,pe.position||0),fe?.(pe),oe)});},[a,ge,fe]),Fr=useCallback((S,E)=>{$e(K=>Wi(K,S,E)),a.onTaskRename?.(S,E);},[a]),Ss=useCallback(S=>{$e(E=>{let{tasks:K}=_i(E,S);return a.onTaskCreate?.(S,0),K});},[a]),gu=useCallback((S,E,K)=>{let oe=S.startDate?Math.round((E.getTime()-S.startDate.getTime())/864e5):0,pe=gt=>gt.map(Xt=>Xt.id===S.id?{...Xt,startDate:E,endDate:K,...S.segments&&{segments:S.segments}}:Xt.subtasks?{...Xt,subtasks:pe(Xt.subtasks)}:Xt),De=pe(te);De=he.autoScheduleDependents(De,S.id,oe),$e(De);let Bt={...S,startDate:E,endDate:K};A?.(Bt);},[te,A]),fu=useCallback((S,E)=>{I?.(S,E),J({isOpen:true,x:E.clientX,y:E.clientY,task:S});},[I]),bu=useCallback((S,E)=>{let K=he.splitTask(te,S.id,E);$e(K),J({isOpen:false,x:0,y:0,task:null});},[te]),Zl=useCallback(S=>{let E=he.findTaskById(te,S.id)||S;v?.(E),H||Ue(E);},[te,v,H]),Ql=useCallback((S,E,K)=>{let oe=new Map,pe=Ta=>{Ta.forEach(Ea=>{Ea.dependencies&&oe.set(Ea.id,Ea.dependencies),Ea.subtasks&&pe(Ea.subtasks);});};pe(K);let De=oe.get(E)||[];oe.set(E,[...De,S]);let Bt=new Set,gt=new Set,Xt=Ta=>{if(!Bt.has(Ta)){Bt.add(Ta),gt.add(Ta);let Ea=oe.get(Ta)||[];for(let Lr of Ea){if(!Bt.has(Lr)&&Xt(Lr))return true;if(gt.has(Lr))return true}}return gt.delete(Ta),false};return Xt(E)},[]),ed=useCallback((S,E)=>{if(Ql(S.id,E,te)){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 K=re=>re.map(ue=>{if(ue.id===E){let Ee=ue.dependencies||[];if(!Ee.includes(S.id))return {...ue,dependencies:[...Ee,S.id]}}return ue.subtasks?{...ue,subtasks:K(ue.subtasks)}:ue});Ve(K(Se)),ne?.(S.id,E);},[Se,ne,Jl]),Ql=useCallback((S,E)=>{let K=re=>re.map(ue=>{if(ue.id===S&&ue.dependencies){let Ee=ue.dependencies.filter(Lt=>Lt!==E);return {...ue,dependencies:Ee}}return ue.subtasks?{...ue,subtasks:K(ue.subtasks)}:ue});Ve(K(Se)),oe?.(S,E);},[Se,oe]),{startDate:bn,endDate:uu}=useMemo(()=>{let S=Se.filter(Ee=>Ee.startDate&&Ee.endDate);if(S.length===0){let Ee=new Date,Lt=new Date(Ee);Lt.setDate(Lt.getDate()-30);let mt=new Date(Ee);return mt.setDate(mt.getDate()+60),{startDate:Lt,endDate:mt}}let E=S.flatMap(Ee=>[Ee.startDate,Ee.endDate]).filter(Ee=>Ee!==void 0),K=new Date(Math.min(...E.map(Ee=>Ee.getTime()))),re=new Date(Math.max(...E.map(Ee=>Ee.getTime()))),ue=se==="day"?7:se==="week"?14:30;return K.setDate(K.getDate()-ue),re.setDate(re.getDate()+ue),{startDate:K,endDate:re}},[Se,se]),gu=useCallback(async()=>{if(!$a.current||!rt.current||!ya.current)return;await new Promise(Jr=>setTimeout(Jr,200));let S=$a.current,E=rt.current.querySelector(".gantt-grid-scroll"),K=ya.current,re=E?.scrollTop||0,ue=E?.scrollLeft||0,Ee=K.scrollTop,Lt=K.scrollLeft,mt=S.style.overflow,qt=S.style.height,Ca=E?.style.overflow||"",Sa=K.style.overflow,Fr=S.style.width,hn=K.style.width;try{let Jr=E?.querySelector(".gantt-taskgrid-content"),fr=K.querySelector("svg"),Lr=fr?.getAttribute("height")?parseInt(fr.getAttribute("height"),10):fr?.getBoundingClientRect().height||0,xo=Jr?.scrollHeight||E?.scrollHeight||600,Zr=Math.max(Lr,K.scrollHeight),ad=fr?.getAttribute("width")?parseInt(fr.getAttribute("width"),10):fr?.getBoundingClientRect().width||K.scrollWidth,wu=S.querySelector('[class*="h-12"]')?.offsetHeight||48,Ss=Math.max(xo,Zr,Lr),Es=wu+Ss+50,Ps=(E?.offsetWidth||300)+ad+10;E&&(E.scrollTop=0,E.scrollLeft=0),K.scrollTop=0,K.scrollLeft=0,S.style.overflow="visible",S.style.height=`${Es}px`,S.style.width=`${Ps}px`,E&&(E.style.overflow="visible",E.style.height=`${Ss+50}px`),K.style.overflow="visible",K.style.height=`${Ss+50}px`,K.style.width=`${ad+10}px`,await new Promise(As=>setTimeout(As,150));let Cu=await dm(S,{backgroundColor:ct.bgPrimary,scale:2,logging:!1,useCORS:!0,allowTaint:!0,width:Ps,height:Es,windowWidth:Ps+100,windowHeight:Es+100,scrollX:0,scrollY:0,ignoreElements:As=>{let rd=window.getComputedStyle(As),od=parseInt(rd.zIndex,10);return !isNaN(od)&&od>=50||rd.position==="fixed"}}),Ms=document.createElement("a");Ms.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,Ms.href=Cu.toDataURL("image/png"),Ms.click();}finally{S.style.overflow=mt,S.style.height=qt,S.style.width=Fr,E&&(E.style.overflow=Ca,E.style.height="",E.scrollTop=re,E.scrollLeft=ue),K.style.overflow=Sa,K.style.height="",K.style.width=hn,K.scrollTop=Ee,K.scrollLeft=Lt;}},[ct]),fu=useCallback(async()=>{await he.exportToPDF(Se);},[Se]),bu=useCallback(async()=>{await he.exportToExcel(Se);},[Se]),hu=useCallback(()=>{let S=he.exportToCSV(Se),E=new Blob([S],{type:"text/csv;charset=utf-8;"}),K=document.createElement("a");K.href=URL.createObjectURL(E),K.download="gantt-chart.csv",K.click(),URL.revokeObjectURL(K.href);},[Se]),yu=useCallback(()=>{let S=he.exportToJSON(Se),E=new Blob([S],{type:"application/json;charset=utf-8;"}),K=document.createElement("a");K.href=URL.createObjectURL(E),K.download="gantt-chart.json",K.click(),URL.revokeObjectURL(K.href);},[Se]),vu=useCallback(()=>{he.exportToMSProject(Se,"Gantt Project","project.xml");},[Se]),xu=S=>{S.preventDefault(),ae(true);},vo=useRef(false),[Ds,ed]=useState(false),zo=useRef({x:0,y:0,scrollLeft:0,scrollTop:0});useEffect(()=>{let S=ya.current,E=rt.current?.querySelector(".gantt-grid-scroll");if(!S||!E)return;let K=()=>{if(vo.current)return;vo.current=true;let mt=S.scrollTop;Ae(mt),E.scrollTop=mt,requestAnimationFrame(()=>{vo.current=false;});},re=()=>{if(vo.current)return;vo.current=true;let mt=E.scrollTop;Ae(mt),S.scrollTop=mt,requestAnimationFrame(()=>{vo.current=false;});},ue=mt=>{if(G&&E){let Ca=E.parentElement?.getBoundingClientRect()?.left||0,Sa=mt.clientX-Ca,Fr=200,hn=ze+le,Jr=window.innerWidth*He,fr=Math.max(hn,Jr);Sa>=Fr&&Sa<=fr&&Oe(Sa);}if(Ds&&S){let qt=mt.clientX-zo.current.x,Ca=mt.clientY-zo.current.y;S.scrollLeft=zo.current.scrollLeft-qt,S.scrollTop=zo.current.scrollTop-Ca;}},Ee=()=>{ae(false),ed(false);},Lt=mt=>{if(mt.button!==0)return;let qt=mt.target;qt.closest("[data-task-bar]")||qt.closest("[data-dependency-line]")||qt.closest("button")||qt.closest('[role="button"]')||qt.tagName==="rect"&&qt.getAttribute("data-clickable")==="true"||(ed(true),zo.current={x:mt.clientX,y:mt.clientY,scrollLeft:S.scrollLeft,scrollTop:S.scrollTop},mt.preventDefault());};return S.addEventListener("scroll",K),E.addEventListener("scroll",re),S.addEventListener("mousedown",Lt),document.addEventListener("mousemove",ue),document.addEventListener("mouseup",Ee),()=>{S.removeEventListener("scroll",K),E.removeEventListener("scroll",re),S.removeEventListener("mousedown",Lt),document.removeEventListener("mousemove",ue),document.removeEventListener("mouseup",Ee);}},[G,Ds,ze]);let td=useRef(false),ku=useRef(null);return useLayoutEffect(()=>{if(td.current||Se.length===0||!ya.current)return;td.current=true,ku.current=bn;let S=ya.current,E=new Date,K=se==="day"?60:se==="week"?20:8,re=(E.getTime()-bn.getTime())/(1e3*60*60*24),ue=S.clientWidth,Lt=re*K*ie-ue/2;re>=0&&ue>0&&(S.scrollLeft=Math.max(0,Lt));},[Se.length,bn,se,ie]),jsx(Fo.Provider,{value:U,children:jsx(Rs.Provider,{value:M,children:jsxs("div",{ref:$a,className:"flex flex-col h-full w-full",style:{backgroundColor:ct.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsx(Hn,{theme:ct,timeScale:se,onTimeScaleChange:Ie,zoom:ie,onZoomChange:Xe,currentTheme:z,onThemeChange:jt,rowDensity:qe,onRowDensityChange:Qe,showThemeSelector:g,showCreateTaskButton:f,createTaskLabel:u,onCreateTask:x,taskFilter:yt,onTaskFilterChange:$,onExportPNG:i?gu:void 0,onExportPDF:i?fu:void 0,onExportExcel:i?bu:void 0,onExportCSV:i?hu:void 0,onExportJSON:i?yu:void 0,onExportMSProject:i?vu:void 0}),jsxs("div",{ref:rt,className:"flex-1 flex min-h-0",style:{overflow:"clip",overflowClipMargin:"100px"},children:[jsx("div",{className:"gantt-grid-scroll flex-shrink-0",style:{width:Ft,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsx(Vn,{tasks:Ye,theme:ct,rowHeight:Pt,availableUsers:p,templates:V,onTaskClick:B,onTaskDblClick:Xl,onTaskContextMenu:I,onTaskToggle:vt,scrollTop:fe,columns:pe,onToggleColumn:de,onColumnResize:We,onTaskUpdate:Re,onTaskIndent:gt,onTaskOutdent:va,onTaskMove:Kt,onMultiTaskDelete:je,onTaskDuplicate:Yt,onTaskCreate:ga,onTaskRename:Ar,onCreateSubtask:Ns,onOpenTaskModal:B?S=>B(S):void 0,onDeleteRequest:(S,E)=>Bt({taskId:S,taskName:E}),onTaskReparent:wa})}),jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:ct.border,zIndex:15},onMouseDown:xu}),jsx("div",{ref:ya,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:Ds?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsx(es,{tasks:Ye,theme:ct,rowHeight:Pt,timeScale:se,startDate:bn,endDate:uu,zoom:ie,locale:C,templates:V,dependencyLineStyle:a?.dependencyLineStyle,onTaskClick:B,onTaskDblClick:Xl,onTaskContextMenu:mu,onTaskDateChange:cu,onDependencyCreate:Zl,onDependencyDelete:Ql})})]}),ye.task&&jsx(Lo,{isOpen:ye.isOpen,x:ye.x,y:ye.y,theme:ct,onClose:()=>it({isOpen:false,x:0,y:0,task:null}),items:(()=>{let S=ye.task;if(!S)return [];let E=he.findTaskById(Se,S.id)||S;return E.subtasks&&E.subtasks.length>0?[{id:"addSubtask",label:U.contextMenu?.addSubtask||"Add Subtask",icon:Wt.Add,onClick:()=>{O?O(E):Ns(E.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:U.contextMenu?.deleteTask||"Delete Task",icon:Wt.Delete,onClick:()=>{Bt({taskId:E.id,taskName:E.name});}}]:[{id:"edit",label:U.contextMenu?.editTask||"Edit Task",icon:Wt.Pencil,onClick:()=>{W?W(E):wt(E);}},{id:"addSubtask",label:U.contextMenu?.addSubtask||"Add Subtask",icon:Wt.Add,onClick:()=>{O?O(E):Ns(E.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:U.contextMenu?.markIncomplete||"Mark Incomplete",icon:Wt.MarkIncomplete,onClick:()=>{q?q(E):Re(E.id,{status:"todo",progress:0});},disabled:E.status==="todo"},{id:"setInProgress",label:U.contextMenu?.setInProgress||"Set In Progress",icon:Wt.SetInProgress,onClick:()=>{te?te(E):Re(E.id,{status:"in-progress"});},disabled:E.status==="in-progress"},{id:"markComplete",label:U.contextMenu?.markComplete||"Mark Complete",icon:Wt.MarkComplete,onClick:()=>{Re(E.id,{status:"completed",progress:100});},disabled:E.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:U.contextMenu?.splitTask||"Split Task",icon:Wt.Split,onClick:()=>{if(!E.startDate||!E.endDate){console.warn("Cannot split task without dates");return}let re=E.startDate.getTime(),ue=E.endDate.getTime(),Ee=re+(ue-re)/2,Lt=new Date(Ee);pu(E,Lt);},disabled:!E.startDate||!E.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:U.contextMenu?.deleteTask||"Delete Task",icon:Wt.Delete,onClick:()=>{Bt({taskId:E.id,taskName:E.name});}}]})()}),jsx(no,{task:Ue,isOpen:!!Ue,onClose:()=>wt(null),onTaskUpdate:S=>{Ue&&(Re(Ue.id,S),wt(null));},theme:z==="light"?"light":"dark",locale:C==="es"?"es":"en",availableUsers:p,availableTasks:t}),jsx(AnimatePresence,{children:ut&&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:()=>Bt(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:ct.bgSecondary,border:`1px solid ${ct.border}`},children:[jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${ct.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:ct.textPrimary,fontFamily:"Inter, sans-serif"},children:[U.contextMenu?.deleteTask||"Delete Task","?"]}),jsx("p",{className:"text-sm mt-1",style:{color:ct.textSecondary,fontFamily:"Inter, sans-serif"},children:C==="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:ct.textSecondary,fontFamily:"Inter, sans-serif"},children:[C==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxs("span",{className:"font-semibold",style:{color:ct.textPrimary},children:['"',ut.taskName,'"']}),"."]})}),jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:ct.bgPrimary,borderTop:`1px solid ${ct.border}`},children:[jsx("button",{onClick:()=>Bt(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:ct.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:S=>{S.currentTarget.style.backgroundColor=ct.hoverBg;},onMouseLeave:S=>{S.currentTarget.style.backgroundColor="transparent";},children:C==="es"?"Cancelar":"Cancel"}),jsxs("button",{onClick:()=>{je([ut.taskId]),Bt(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"}),C==="es"?"Eliminar":"Delete"]})]})]})})}),k?.enabled&&jsx(ts,{tasks:Se,theme:ct,config:k,onTasksUpdate:Ve,onTaskUpdate:Re,onTaskCreate:S=>{Ve(E=>[...E,S]);},onTaskDelete:S=>{je([S]);},onDependencyCreate:(S,E)=>{let K=he.findTaskById(Se,S);K&&Zl(K,E);},onDependencyDelete:Ql})]})})})});var Yi=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],qi=[{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 um({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:m=a?"edit":"create",theme:g="dark",customStatuses:i=[],availableTags:p=[],onCreateTag:l,attachments:b=[],onUploadAttachments:v,onDeleteAttachment:k}){let C=[...Yi,...i.filter($=>!Yi.some(fe=>fe.id===$.id))],h=et[g]||et.dark,[f,u]=useState(false),[x,c]=useState(false),[N,w]=useState(false),[B,y]=useState(false),[I,P]=useState({top:0,left:0}),[T,W]=useState(null),[O,q]=useState(new Date),[te,ne]=useState({top:0,left:0}),[oe,ce]=useState(false),[be,Le]=useState([]),A=useRef(null),R=useRef(null),L=useRef(null),j=useRef(null),X$1=useRef(null),[z,ve]=useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[se,Ie]=useState({});useEffect(()=>{a?(ve({name:a.name,description:a.description||"",startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",priority:a.priority||"medium",isMilestone:a.isMilestone||false,color:a.color||"#6366F1",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&ce(true)):(ve({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),ce(false),Le([]));},[a,e]),useEffect(()=>{let $=fe=>{A.current&&!A.current.contains(fe.target)&&u(false),R.current&&!R.current.contains(fe.target)&&c(false),L.current&&!L.current.contains(fe.target)&&w(false),j.current&&!j.current.contains(fe.target)&&y(false);};return document.addEventListener("mousedown",$),()=>document.removeEventListener("mousedown",$)},[]);let qe=()=>{let $={};return z.name.trim()||($.name="El nombre es requerido"),z.startDate&&z.endDate&&z.startDate>z.endDate&&($.endDate="La fecha de fin debe ser posterior a la de inicio"),Ie($),Object.keys($).length===0},Qe=async $=>{if($.preventDefault(),!!qe())try{let fe=m==="create"&&be.length>0?{...z,pendingFiles:be}:z;await s(fe),Le([]),t();}catch(fe){console.error("Error submitting task:",fe);}},ie=($,fe)=>{ve(Ae=>{let G={...Ae,[$]:fe};if($==="status"){let ae=fe;ae==="todo"?G.progress=0:ae==="in-progress"?(Ae.progress===0||Ae.progress===100)&&(G.progress=50):ae==="completed"||ae==="closed"?G.progress=100:(ae==="in-review"||ae==="review")&&(G.progress=75);}if($==="progress"){let ae=typeof fe=="number"?fe:parseInt(fe,10);ae===100&&Ae.status!=="completed"?G.status="completed":ae>0&&ae<100&&Ae.status==="todo"?G.status="in-progress":ae===0&&Ae.status!=="todo"&&(G.status="todo");}return G}),se[$]&&Ie(Ae=>{let G={...Ae};return delete G[$],G});},Xe=C.find($=>$.id===z.status)??Yi[0],lt=qi.find($=>$.id===z.priority)??qi[1],kt=hr.find($=>$.value===z.color)??hr[0],yt={backgroundColor:h.bgSecondary,border:`1px solid ${h.borderLight}`,color:h.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":g,style:{backgroundColor:h.bgPrimary,border:`1px solid ${h.border}`},onClick:$=>$.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${h.border}`},children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:Xe.color||h.accent}}),jsx("span",{className:"text-sm font-medium",style:{color:h.textSecondary},children:m==="create"?"Nueva tarea":"Editar tarea"})]}),jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:h.textTertiary},onMouseEnter:$=>{$.currentTarget.style.backgroundColor=h.hoverBg,$.currentTarget.style.color=h.textPrimary;},onMouseLeave:$=>{$.currentTarget.style.backgroundColor="transparent",$.currentTarget.style.color=h.textTertiary;},disabled:n,children:jsx(X,{className:"w-4 h-4"})})]}),jsxs("form",{onSubmit:Qe,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:z.name,onChange:$=>ie("name",$.target.value),className:"w-full text-lg font-medium bg-transparent border-none focus:outline-none focus:ring-0 placeholder:opacity-50",style:{color:h.textPrimary},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),se.name&&jsxs("p",{className:"mt-1 text-xs text-red-400 flex items-center gap-1",children:[jsx(AlertCircle,{className:"w-3 h-3"}),se.name]})]}),jsx("div",{children:jsx("textarea",{value:z.description||"",onChange:$=>ie("description",$.target.value),className:"w-full text-sm bg-transparent border-none focus:outline-none focus:ring-0 resize-none placeholder:opacity-40",style:{color:h.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})}),jsx("div",{style:{borderTop:`1px solid ${h.borderLight}`}}),jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxs("div",{ref:A,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&u(!f),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...yt,borderColor:Xe.color,backgroundColor:`${Xe.color}15`},disabled:n,children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:Xe.color}}),jsx("span",{style:{color:Xe.color},children:Xe.title}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:Xe.color}})]}),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-[140px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:h.bgPrimary,border:`1px solid ${h.border}`},children:C.map($=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:h.textPrimary},onMouseEnter:fe=>fe.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:fe=>fe.currentTarget.style.backgroundColor="transparent",onClick:()=>{ie("status",$.id),u(false);},children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:$.color}}),$.title,z.status===$.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:h.accent}})]},$.id))})})]}),jsxs("div",{ref:R,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&c(!x),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:yt,disabled:n,children:[jsx(Flag,{className:"w-3.5 h-3.5",style:{color:lt.color}}),jsx("span",{children:lt.label}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:h.textTertiary}})]}),jsx(AnimatePresence,{children:x&&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:h.bgPrimary,border:`1px solid ${h.border}`},children:qi.map($=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:h.textPrimary},onMouseEnter:fe=>fe.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:fe=>fe.currentTarget.style.backgroundColor="transparent",onClick:()=>{ie("priority",$.id),c(false);},children:[jsx("span",{children:$.icon}),$.label,z.priority===$.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:h.accent}})]},$.id))})})]}),o.length>0&&jsxs("div",{ref:L,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&w(!N),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:yt,disabled:n,children:[z.assignees&&z.assignees.length>0?jsxs(Fragment,{children:[jsx("div",{className:"flex -space-x-1",children:z.assignees.slice(0,3).map(($,fe)=>jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:$.color||h.accent,borderColor:h.bgSecondary},children:$.initials},fe))}),z.assignees.length>3&&jsxs("span",{style:{color:h.textTertiary},children:["+",z.assignees.length-3]})]}):jsxs(Fragment,{children:[jsx(Users,{className:"w-3.5 h-3.5",style:{color:h.textTertiary}}),jsx("span",{style:{color:h.textTertiary},children:"Asignar"})]}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:h.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:h.bgPrimary,border:`1px solid ${h.border}`},children:o.map($=>{let fe=z.assignees?.some(Ae=>Ae.name===$.name);return jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:h.textPrimary},onMouseEnter:Ae=>Ae.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:Ae=>Ae.currentTarget.style.backgroundColor="transparent",onClick:()=>{let Ae=fe?(z.assignees||[]).filter(G=>G.name!==$.name):[...z.assignees||[],{name:$.name,avatar:$.avatar,initials:$.name.split(" ").map(G=>G[0]).join("").toUpperCase().slice(0,2),color:h.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:h.accent},children:$.name.charAt(0).toUpperCase()}),jsx("span",{className:"truncate flex-1 text-left",children:$.name}),jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:fe&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:h.accent}})})]},$.id)})})})]}),jsxs("div",{ref:j,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>{if(!n)if(B)y(false);else {if(j.current){let $=j.current.getBoundingClientRect(),fe=window.innerHeight,Ae=120,ae=fe-$.bottom<Ae?$.top-Ae-8:$.bottom+8;P({top:ae,left:$.left});}y(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:yt,disabled:n,children:[jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:z.color}}),jsx("span",{children:kt.name}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:h.textTertiary}})]}),jsx(AnimatePresence,{children:B&&jsxs(ft,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>y(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${I.top}px`,left:`${I.left}px`,zIndex:99999,backgroundColor:h.bgPrimary,border:`1px solid ${h.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:$=>$.stopPropagation(),children:jsx("div",{style:{padding:"6px 8px"},children:jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:hr.slice(0,18).map($=>{let fe=z.color===$.value;return jsx("button",{type:"button",onClick:Ae=>{Ae.preventDefault(),Ae.stopPropagation(),ie("color",$.value),y(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:$.name,children:jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:$.value,outline:fe?`2px solid ${$.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},$.value)})})})})]})})]}),p.length>0||l?jsx(br,{selectedTags:z.tags||[],availableTags:p,onChange:$=>ie("tags",$),onCreateTag:l,theme:h,disabled:n}):null]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Calendar,{className:"w-4 h-4",style:{color:h.textTertiary}}),jsxs("div",{ref:X$1,className:"flex items-center gap-2 flex-1 relative",children:[jsx("button",{type:"button",onClick:()=>{if(!n&&!z.isMilestone)if(T==="start")W(null);else {if(X$1.current){let $=X$1.current.getBoundingClientRect(),fe=window.innerHeight,Ae=320,ae=fe-$.bottom<Ae?$.top-Ae-8:$.bottom+8;ne({top:ae,left:$.left});}W("start"),q(z.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...yt,opacity:z.isMilestone?.5:1,cursor:z.isMilestone?"not-allowed":"pointer"},disabled:n||z.isMilestone,children:z.startDate?z.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsx("span",{style:{color:h.textTertiary},children:"\u2192"}),jsx("button",{type:"button",onClick:()=>{if(!n&&!z.isMilestone)if(T==="end")W(null);else {if(X$1.current){let $=X$1.current.getBoundingClientRect(),fe=window.innerHeight,Ae=320,ae=fe-$.bottom<Ae?$.top-Ae-8:$.bottom+8;ne({top:ae,left:$.left});}W("end"),q(z.endDate||z.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...yt,opacity:z.isMilestone?.5:1,cursor:z.isMilestone?"not-allowed":"pointer"},disabled:n||z.isMilestone,children:z.endDate?z.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsx(AnimatePresence,{children:T&&jsxs(ft,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>W(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"rounded-xl shadow-2xl overflow-hidden flex",style:{position:"fixed",top:`${te.top}px`,left:`${te.left}px`,zIndex:99999,backgroundColor:h.bgPrimary,border:`1px solid ${h.border}`},onClick:$=>$.stopPropagation(),children:[jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${h.border}`},children:[(()=>{let $=new Date,fe=new Date($);fe.setDate($.getDate()+1);let Ae=new Date($);Ae.setDate($.getDate()+7);let G=new Date($);return G.setDate($.getDate()+14),[{label:"Hoy",date:$},{label:"Ma\xF1ana",date:fe},{label:"Pr\xF3xima semana",date:Ae},{label:"2 semanas",date:G}].map((xe,Oe)=>jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:h.textPrimary},onMouseEnter:ye=>ye.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:ye=>ye.currentTarget.style.backgroundColor="transparent",onClick:()=>{T==="start"?(ie("startDate",xe.date),(!z.endDate||xe.date>z.endDate)&&ie("endDate",xe.date),W("end")):(ie("endDate",xe.date),(!z.startDate||xe.date<z.startDate)&&ie("startDate",xe.date),W(null));},children:xe.label},Oe))})(),jsx("div",{style:{borderTop:`1px solid ${h.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:$=>$.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:$=>$.currentTarget.style.backgroundColor="transparent",onClick:()=>{ie("startDate",void 0),ie("endDate",void 0),W(null);},children:"Borrar fechas"})]}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("button",{type:"button",onClick:()=>q(new Date(O.getFullYear(),O.getMonth()-1)),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronLeft,{className:"w-4 h-4",style:{color:h.textSecondary}})}),jsx("span",{className:"text-sm font-medium",style:{color:h.textPrimary},children:O.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>q(new Date(O.getFullYear(),O.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronRight,{className:"w-4 h-4",style:{color:h.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map(($,fe)=>jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:h.textTertiary},children:$},fe))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let $=O.getFullYear(),fe=O.getMonth(),Ae=new Date($,fe,1).getDay(),G=new Date($,fe+1,0).getDate(),ae=new Date,xe=[];for(let ye=Ae-1;ye>=0;ye--)xe.push({day:new Date($,fe,-ye).getDate(),date:new Date($,fe-1,new Date($,fe,-ye).getDate()),isCurrentMonth:false});for(let ye=1;ye<=G;ye++)xe.push({day:ye,date:new Date($,fe,ye),isCurrentMonth:true});let Oe=42-xe.length;for(let ye=1;ye<=Oe;ye++)xe.push({day:ye,date:new Date($,fe+1,ye),isCurrentMonth:false});return xe.map((ye,it)=>{let Ue=ye.date.toDateString()===ae.toDateString(),wt=z.startDate?.toDateString()===ye.date.toDateString(),ut=z.endDate?.toDateString()===ye.date.toDateString(),Bt=z.startDate&&z.endDate&&ye.date>=z.startDate&&ye.date<=z.endDate;return jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:ye.isCurrentMonth?wt||ut?"#FFF":h.textPrimary:h.textTertiary,backgroundColor:wt?"#3B82F6":ut?"#7C3AED":Bt?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Ue&&!wt&&!ut?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{T==="start"?(ie("startDate",ye.date),z.endDate&&ye.date>z.endDate&&ie("endDate",ye.date),W("end")):(ie("endDate",ye.date),z.startDate&&ye.date<z.startDate&&ie("startDate",ye.date),W(null));},children:ye.day},it)})})()})]})]})]})})]}),se.endDate&&jsx("span",{className:"text-xs text-red-400",children:se.endDate})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:"w-4 h-4",style:{color:h.textTertiary}}),jsxs("div",{className:"flex items-center gap-3 flex-1",children:[jsx("input",{type:"range",min:"0",max:"100",step:"5",value:z.progress,onChange:$=>ie("progress",parseInt($.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:h.bgSecondary,accentColor:z.progress<30?"#EF4444":z.progress<70?"#F59E0B":"#10B981"},disabled:n}),jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${z.progress<30?"#EF4444":z.progress<70?"#F59E0B":"#10B981"}20`,color:z.progress<30?"#EF4444":z.progress<70?"#F59E0B":"#10B981"},children:[z.progress,"%"]})]})]}),jsxs("div",{children:[jsxs("button",{type:"button",onClick:()=>ce(!oe),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:h.textTertiary},children:[jsx(ChevronDown,{className:`w-3 h-3 transition-transform ${oe?"rotate-180":""}`}),"Opciones avanzadas"]}),jsx(AnimatePresence,{children:oe&&jsx(motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxs("div",{className:"pt-3 space-y-3",children:[(v||b.length>0||m==="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:h.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:h.textTertiary},children:["Adjuntos ",m==="create"?be.length>0&&`(${be.length})`:b.length>0&&`(${b.length})`]})]}),m==="create"?jsx(xr,{cardId:"pending",attachments:be.map(($,fe)=>({id:`pending-${fe}`,cardId:"pending",name:$.name,size:$.size,type:$.type,url:URL.createObjectURL($),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:$=>Le(fe=>[...fe,...$]),onDelete:$=>{let fe=parseInt($.replace("pending-",""),10);Le(Ae=>Ae.filter((G,ae)=>ae!==fe));},maxSizeMB:10,maxFiles:20}):jsx(xr,{cardId:a?.id||"new",attachments:b,onUpload:v&&a?.id?$=>v(a.id,$):void 0,onDelete:k,maxSizeMB:10,maxFiles:20}),m==="create"&&be.length>0&&jsxs("p",{className:"text-xs mt-1",style:{color:h.textTertiary},children:[be.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:z.isMilestone,onChange:$=>ie("isMilestone",$.target.checked),className:"w-4 h-4 rounded",style:{accentColor:h.accent},disabled:n}),jsx(Milestone,{className:"w-4 h-4 text-yellow-500"}),jsx("span",{className:"text-sm",style:{color:h.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:h.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:h.bgSecondary},children:r.filter($=>$.id!==a?.id).map($=>{let fe=z.dependencies?.includes($.id);return jsx("button",{type:"button",onClick:()=>{let Ae=fe?(z.dependencies||[]).filter(G=>G!==$.id):[...z.dependencies||[],$.id];ie("dependencies",Ae);},className:"px-2 py-1 rounded-full text-xs transition-colors",style:{backgroundColor:fe?`${h.accent}30`:h.bgPrimary,color:fe?h.accent:h.textSecondary,border:`1px solid ${fe?h.accent:h.borderLight}`},disabled:n,children:$.name},$.id)})})]})]})})})]})]}),jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${h.border}`},children:[jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:h.textSecondary},onMouseEnter:$=>$.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:$=>$.currentTarget.style.backgroundColor="transparent",disabled:n,children:"Cancelar"}),jsx("button",{type:"submit",disabled:n,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:h.accent,color:"#FFF"},onMouseEnter:$=>!n&&($.currentTarget.style.opacity="0.9"),onMouseLeave:$=>!n&&($.currentTarget.style.opacity="1"),children:n?jsxs(Fragment,{children:[jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsx(Fragment,{children:m==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var gm=`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 K=oe=>oe.map(pe=>{if(pe.id===E){let De=pe.dependencies||[];if(!De.includes(S.id))return {...pe,dependencies:[...De,S.id]}}return pe.subtasks?{...pe,subtasks:K(pe.subtasks)}:pe});$e(K(te)),ne?.(S.id,E);},[te,ne,Ql]),td=useCallback((S,E)=>{let K=oe=>oe.map(pe=>{if(pe.id===S&&pe.dependencies){let De=pe.dependencies.filter(Bt=>Bt!==E);return {...pe,dependencies:De}}return pe.subtasks?{...pe,subtasks:K(pe.subtasks)}:pe});$e(K(te)),re?.(S,E);},[te,re]),{startDate:yn,endDate:hu}=useMemo(()=>{let S=te.filter(De=>De.startDate&&De.endDate);if(S.length===0){let De=new Date,Bt=new Date(De);Bt.setDate(Bt.getDate()-30);let gt=new Date(De);return gt.setDate(gt.getDate()+60),{startDate:Bt,endDate:gt}}let E=S.flatMap(De=>[De.startDate,De.endDate]).filter(De=>De!==void 0),K=new Date(Math.min(...E.map(De=>De.getTime()))),oe=new Date(Math.max(...E.map(De=>De.getTime()))),pe=se==="day"?7:se==="week"?14:30;return K.setDate(K.getDate()-pe),oe.setDate(oe.getDate()+pe),{startDate:K,endDate:oe}},[te,se]),yu=useCallback(async()=>{if(!Ua.current||!st.current||!ya.current)return;await new Promise(Zr=>setTimeout(Zr,200));let S=Ua.current,E=st.current.querySelector(".gantt-grid-scroll"),K=ya.current,oe=E?.scrollTop||0,pe=E?.scrollLeft||0,De=K.scrollTop,Bt=K.scrollLeft,gt=S.style.overflow,Xt=S.style.height,Ta=E?.style.overflow||"",Ea=K.style.overflow,Lr=S.style.width,vn=K.style.width;try{let Zr=E?.querySelector(".gantt-taskgrid-content"),hr=K.querySelector("svg"),Ir=hr?.getAttribute("height")?parseInt(hr.getAttribute("height"),10):hr?.getBoundingClientRect().height||0,ko=Zr?.scrollHeight||E?.scrollHeight||600,Qr=Math.max(Ir,K.scrollHeight),od=hr?.getAttribute("width")?parseInt(hr.getAttribute("width"),10):hr?.getBoundingClientRect().width||K.scrollWidth,Du=S.querySelector('[class*="h-12"]')?.offsetHeight||48,Ps=Math.max(ko,Qr,Ir),Ms=Du+Ps+50,As=(E?.offsetWidth||300)+od+10;E&&(E.scrollTop=0,E.scrollLeft=0),K.scrollTop=0,K.scrollLeft=0,S.style.overflow="visible",S.style.height=`${Ms}px`,S.style.width=`${As}px`,E&&(E.style.overflow="visible",E.style.height=`${Ps+50}px`),K.style.overflow="visible",K.style.height=`${Ps+50}px`,K.style.width=`${od+10}px`,await new Promise(Ls=>setTimeout(Ls,150));let Su=await mm(S,{backgroundColor:ut.bgPrimary,scale:2,logging:!1,useCORS:!0,allowTaint:!0,width:As,height:Ms,windowWidth:As+100,windowHeight:Ms+100,scrollX:0,scrollY:0,ignoreElements:Ls=>{let nd=window.getComputedStyle(Ls),sd=parseInt(nd.zIndex,10);return !isNaN(sd)&&sd>=50||nd.position==="fixed"}}),Fs=document.createElement("a");Fs.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,Fs.href=Su.toDataURL("image/png"),Fs.click();}finally{S.style.overflow=gt,S.style.height=Xt,S.style.width=Lr,E&&(E.style.overflow=Ta,E.style.height="",E.scrollTop=oe,E.scrollLeft=pe),K.style.overflow=Ea,K.style.height="",K.style.width=vn,K.scrollTop=De,K.scrollLeft=Bt;}},[ut]),vu=useCallback(async()=>{await he.exportToPDF(te);},[te]),xu=useCallback(async()=>{await he.exportToExcel(te);},[te]),ku=useCallback(()=>{let S=he.exportToCSV(te),E=new Blob([S],{type:"text/csv;charset=utf-8;"}),K=document.createElement("a");K.href=URL.createObjectURL(E),K.download="gantt-chart.csv",K.click(),URL.revokeObjectURL(K.href);},[te]),wu=useCallback(()=>{let S=he.exportToJSON(te),E=new Blob([S],{type:"application/json;charset=utf-8;"}),K=document.createElement("a");K.href=URL.createObjectURL(E),K.download="gantt-chart.json",K.click(),URL.revokeObjectURL(K.href);},[te]),Cu=useCallback(()=>{he.exportToMSProject(te,"Gantt Project","project.xml");},[te]),Tu=S=>{S.preventDefault(),je(true);},xo=useRef(false),[Es,ad]=useState(false),Ho=useRef({x:0,y:0,scrollLeft:0,scrollTop:0});useEffect(()=>{let S=ya.current,E=st.current?.querySelector(".gantt-grid-scroll");if(!S||!E)return;let K=()=>{if(xo.current)return;xo.current=true;let gt=S.scrollTop;Pe(gt),E.scrollTop=gt,requestAnimationFrame(()=>{xo.current=false;});},oe=()=>{if(xo.current)return;xo.current=true;let gt=E.scrollTop;Pe(gt),S.scrollTop=gt,requestAnimationFrame(()=>{xo.current=false;});},pe=gt=>{if(Me&&E){let Ta=E.parentElement?.getBoundingClientRect()?.left||0,Ea=gt.clientX-Ta,Lr=200,vn=He+le,Zr=window.innerWidth*We,hr=Math.max(vn,Zr);Ea>=Lr&&Ea<=hr&&Pt(Ea);}if(Es&&S){let Xt=gt.clientX-Ho.current.x,Ta=gt.clientY-Ho.current.y;S.scrollLeft=Ho.current.scrollLeft-Xt,S.scrollTop=Ho.current.scrollTop-Ta;}},De=()=>{je(false),ad(false);},Bt=gt=>{if(gt.button!==0)return;let Xt=gt.target;Xt.closest("[data-task-bar]")||Xt.closest("[data-dependency-line]")||Xt.closest("button")||Xt.closest('[role="button"]')||Xt.tagName==="rect"&&Xt.getAttribute("data-clickable")==="true"||(ad(true),Ho.current={x:gt.clientX,y:gt.clientY,scrollLeft:S.scrollLeft,scrollTop:S.scrollTop},gt.preventDefault());};return S.addEventListener("scroll",K),E.addEventListener("scroll",oe),S.addEventListener("mousedown",Bt),document.addEventListener("mousemove",pe),document.addEventListener("mouseup",De),()=>{S.removeEventListener("scroll",K),E.removeEventListener("scroll",oe),S.removeEventListener("mousedown",Bt),document.removeEventListener("mousemove",pe),document.removeEventListener("mouseup",De);}},[Me,Es,He]);let rd=useRef(false),Nu=useRef(null);return useLayoutEffect(()=>{if(rd.current||te.length===0||!ya.current)return;rd.current=true,Nu.current=yn;let S=ya.current,E=new Date,K=se==="day"?60:se==="week"?20:8,oe=(E.getTime()-yn.getTime())/(1e3*60*60*24),pe=S.clientWidth,Bt=oe*K*ie-pe/2;oe>=0&&pe>0&&(S.scrollLeft=Math.max(0,Bt));},[te.length,yn,se,ie]),jsx(Lo.Provider,{value:U,children:jsx($s.Provider,{value:P,children:jsxs("div",{ref:Ua,className:"flex flex-col h-full w-full",style:{backgroundColor:ut.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsx(Gn,{theme:ut,timeScale:se,onTimeScaleChange:Be,zoom:ie,onZoomChange:Je,currentTheme:z,onThemeChange:ct,rowDensity:Ye,onRowDensityChange:tt,showThemeSelector:g,showCreateTaskButton:b,createTaskLabel:u,onCreateTask:x,taskFilter:xt,onTaskFilterChange:$,onExportPNG:i?yu:void 0,onExportPDF:i?vu:void 0,onExportExcel:i?xu:void 0,onExportCSV:i?ku:void 0,onExportJSON:i?wu:void 0,onExportMSProject:i?Cu:void 0}),jsxs("div",{ref:st,className:"flex-1 flex min-h-0",style:{overflow:"clip",overflowClipMargin:"100px"},children:[jsx("div",{className:"gantt-grid-scroll flex-shrink-0",style:{width:It,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsx(Kn,{tasks:Xe,theme:ut,rowHeight:At,availableUsers:p,templates:_,onTaskClick:B,onTaskDblClick:Zl,onTaskContextMenu:I,onTaskToggle:kt,scrollTop:be,columns:me,onToggleColumn:de,onColumnResize:_e,onTaskUpdate:Oe,onTaskIndent:bt,onTaskOutdent:va,onTaskMove:Yt,onMultiTaskDelete:qe,onTaskDuplicate:qt,onTaskCreate:ga,onTaskRename:Fr,onCreateSubtask:Ss,onOpenTaskModal:B?S=>B(S):void 0,onDeleteRequest:(S,E)=>at({taskId:S,taskName:E}),onTaskReparent:Ca})}),jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:ut.border,zIndex:15},onMouseDown:Tu}),jsx("div",{ref:ya,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:Es?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsx(as,{tasks:Xe,theme:ut,rowHeight:At,timeScale:se,startDate:yn,endDate:hu,zoom:ie,locale:C,templates:_,dependencyLineStyle:a?.dependencyLineStyle,onTaskClick:B,onTaskDblClick:Zl,onTaskContextMenu:fu,onTaskDateChange:gu,onDependencyCreate:ed,onDependencyDelete:td})})]}),Le.task&&jsx(Io,{isOpen:Le.isOpen,x:Le.x,y:Le.y,theme:ut,onClose:()=>J({isOpen:false,x:0,y:0,task:null}),items:(()=>{let S=Le.task;if(!S)return [];let E=he.findTaskById(te,S.id)||S;return E.subtasks&&E.subtasks.length>0?[{id:"addSubtask",label:U.contextMenu?.addSubtask||"Add Subtask",icon:Gt.Add,onClick:()=>{O?O(E):Ss(E.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:U.contextMenu?.deleteTask||"Delete Task",icon:Gt.Delete,onClick:()=>{at({taskId:E.id,taskName:E.name});}}]:[{id:"edit",label:U.contextMenu?.editTask||"Edit Task",icon:Gt.Pencil,onClick:()=>{H?H(E):Ue(E);}},{id:"addSubtask",label:U.contextMenu?.addSubtask||"Add Subtask",icon:Gt.Add,onClick:()=>{O?O(E):Ss(E.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:U.contextMenu?.markIncomplete||"Mark Incomplete",icon:Gt.MarkIncomplete,onClick:()=>{j?j(E):Oe(E.id,{status:"todo",progress:0});},disabled:E.status==="todo"},{id:"setInProgress",label:U.contextMenu?.setInProgress||"Set In Progress",icon:Gt.SetInProgress,onClick:()=>{ae?ae(E):Oe(E.id,{status:"in-progress"});},disabled:E.status==="in-progress"},{id:"markComplete",label:U.contextMenu?.markComplete||"Mark Complete",icon:Gt.MarkComplete,onClick:()=>{Oe(E.id,{status:"completed",progress:100});},disabled:E.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:U.contextMenu?.splitTask||"Split Task",icon:Gt.Split,onClick:()=>{if(!E.startDate||!E.endDate){console.warn("Cannot split task without dates");return}let oe=E.startDate.getTime(),pe=E.endDate.getTime(),De=oe+(pe-oe)/2,Bt=new Date(De);bu(E,Bt);},disabled:!E.startDate||!E.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:U.contextMenu?.deleteTask||"Delete Task",icon:Gt.Delete,onClick:()=>{at({taskId:E.id,taskName:E.name});}}]})()}),jsx(so,{task:ve,isOpen:!!ve,onClose:()=>Ue(null),onTaskUpdate:S=>{ve&&(Oe(ve.id,S),Ue(null));},theme:z==="light"?"light":"dark",locale:C==="es"?"es":"en",availableUsers:p,availableTasks:t}),jsx(AnimatePresence,{children:Fe&&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:()=>at(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:ut.bgSecondary,border:`1px solid ${ut.border}`},children:[jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${ut.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:ut.textPrimary,fontFamily:"Inter, sans-serif"},children:[U.contextMenu?.deleteTask||"Delete Task","?"]}),jsx("p",{className:"text-sm mt-1",style:{color:ut.textSecondary,fontFamily:"Inter, sans-serif"},children:C==="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:ut.textSecondary,fontFamily:"Inter, sans-serif"},children:[C==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxs("span",{className:"font-semibold",style:{color:ut.textPrimary},children:['"',Fe.taskName,'"']}),"."]})}),jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:ut.bgPrimary,borderTop:`1px solid ${ut.border}`},children:[jsx("button",{onClick:()=>at(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:ut.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:S=>{S.currentTarget.style.backgroundColor=ut.hoverBg;},onMouseLeave:S=>{S.currentTarget.style.backgroundColor="transparent";},children:C==="es"?"Cancelar":"Cancel"}),jsxs("button",{onClick:()=>{qe([Fe.taskId]),at(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"}),C==="es"?"Eliminar":"Delete"]})]})]})})}),k?.enabled&&jsx(rs,{tasks:te,theme:ut,config:k,onTasksUpdate:$e,onTaskUpdate:Oe,onTaskCreate:S=>{$e(E=>[...E,S]);},onTaskDelete:S=>{qe([S]);},onDependencyCreate:(S,E)=>{let K=he.findTaskById(te,S);K&&ed(K,E);},onDependencyDelete:td})]})})})});var Xi=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Ji=[{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 fm({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:c=a?"edit":"create",theme:g="dark",customStatuses:i=[],availableTags:p=[],onCreateTag:d,attachments:f=[],onUploadAttachments:y,onDeleteAttachment:k}){let C=[...Xi,...i.filter($=>!Xi.some(be=>be.id===$.id))],h=rt[g]||rt.dark,[b,u]=useState(false),[x,m]=useState(false),[N,w]=useState(false),[B,v]=useState(false),[I,A]=useState({top:0,left:0}),[T,H]=useState(null),[O,j]=useState(new Date),[ae,ne]=useState({top:0,left:0}),[re,ge]=useState(false),[fe,Ie]=useState([]),M=useRef(null),R=useRef(null),L=useRef(null),V=useRef(null),q=useRef(null),[z,ye]=useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[se,Be]=useState({});useEffect(()=>{a?(ye({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)&&ge(true)):(ye({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),ge(false),Ie([]));},[a,e]),useEffect(()=>{let $=be=>{M.current&&!M.current.contains(be.target)&&u(false),R.current&&!R.current.contains(be.target)&&m(false),L.current&&!L.current.contains(be.target)&&w(false),V.current&&!V.current.contains(be.target)&&v(false);};return document.addEventListener("mousedown",$),()=>document.removeEventListener("mousedown",$)},[]);let Ye=()=>{let $={};return z.name.trim()||($.name="El nombre es requerido"),z.startDate&&z.endDate&&z.startDate>z.endDate&&($.endDate="La fecha de fin debe ser posterior a la de inicio"),Be($),Object.keys($).length===0},tt=async $=>{if($.preventDefault(),!!Ye())try{let be=c==="create"&&fe.length>0?{...z,pendingFiles:fe}:z;await s(be),Ie([]),t();}catch(be){console.error("Error submitting task:",be);}},ie=($,be)=>{ye(Pe=>{let Me={...Pe,[$]:be};if($==="status"){let je=be;je==="todo"?Me.progress=0:je==="in-progress"?(Pe.progress===0||Pe.progress===100)&&(Me.progress=50):je==="completed"||je==="closed"?Me.progress=100:(je==="in-review"||je==="review")&&(Me.progress=75);}if($==="progress"){let je=typeof be=="number"?be:parseInt(be,10);je===100&&Pe.status!=="completed"?Me.status="completed":je>0&&je<100&&Pe.status==="todo"?Me.status="in-progress":je===0&&Pe.status!=="todo"&&(Me.status="todo");}return Me}),se[$]&&Be(Pe=>{let Me={...Pe};return delete Me[$],Me});},Je=C.find($=>$.id===z.status)??Xi[0],mt=Ji.find($=>$.id===z.priority)??Ji[1],Ct=vr.find($=>$.value===z.color)??vr[0],xt={backgroundColor:h.bgSecondary,border:`1px solid ${h.borderLight}`,color:h.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":g,style:{backgroundColor:h.bgPrimary,border:`1px solid ${h.border}`},onClick:$=>$.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${h.border}`},children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:Je.color||h.accent}}),jsx("span",{className:"text-sm font-medium",style:{color:h.textSecondary},children:c==="create"?"Nueva tarea":"Editar tarea"})]}),jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:h.textTertiary},onMouseEnter:$=>{$.currentTarget.style.backgroundColor=h.hoverBg,$.currentTarget.style.color=h.textPrimary;},onMouseLeave:$=>{$.currentTarget.style.backgroundColor="transparent",$.currentTarget.style.color=h.textTertiary;},disabled:n,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:z.name,onChange:$=>ie("name",$.target.value),className:"w-full text-lg font-medium bg-transparent border-none focus:outline-none focus:ring-0 placeholder:opacity-50",style:{color:h.textPrimary},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),se.name&&jsxs("p",{className:"mt-1 text-xs text-red-400 flex items-center gap-1",children:[jsx(AlertCircle,{className:"w-3 h-3"}),se.name]})]}),jsx("div",{children:jsx("textarea",{value:z.description||"",onChange:$=>ie("description",$.target.value),className:"w-full text-sm bg-transparent border-none focus:outline-none focus:ring-0 resize-none placeholder:opacity-40",style:{color:h.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})}),jsx("div",{style:{borderTop:`1px solid ${h.borderLight}`}}),jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxs("div",{ref:M,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&u(!b),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...xt,borderColor:Je.color,backgroundColor:`${Je.color}15`},disabled:n,children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:Je.color}}),jsx("span",{style:{color:Je.color},children:Je.title}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:Je.color}})]}),jsx(AnimatePresence,{children:b&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:h.bgPrimary,border:`1px solid ${h.border}`},children:C.map($=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:h.textPrimary},onMouseEnter:be=>be.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:be=>be.currentTarget.style.backgroundColor="transparent",onClick:()=>{ie("status",$.id),u(false);},children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:$.color}}),$.title,z.status===$.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:h.accent}})]},$.id))})})]}),jsxs("div",{ref:R,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&m(!x),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:xt,disabled:n,children:[jsx(Flag,{className:"w-3.5 h-3.5",style:{color:mt.color}}),jsx("span",{children:mt.label}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:h.textTertiary}})]}),jsx(AnimatePresence,{children:x&&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:h.bgPrimary,border:`1px solid ${h.border}`},children:Ji.map($=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:h.textPrimary},onMouseEnter:be=>be.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:be=>be.currentTarget.style.backgroundColor="transparent",onClick:()=>{ie("priority",$.id),m(false);},children:[jsx("span",{children:$.icon}),$.label,z.priority===$.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:h.accent}})]},$.id))})})]}),o.length>0&&jsxs("div",{ref:L,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&w(!N),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:xt,disabled:n,children:[z.assignees&&z.assignees.length>0?jsxs(Fragment,{children:[jsx("div",{className:"flex -space-x-1",children:z.assignees.slice(0,3).map(($,be)=>jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:$.color||h.accent,borderColor:h.bgSecondary},children:$.initials},be))}),z.assignees.length>3&&jsxs("span",{style:{color:h.textTertiary},children:["+",z.assignees.length-3]})]}):jsxs(Fragment,{children:[jsx(Users,{className:"w-3.5 h-3.5",style:{color:h.textTertiary}}),jsx("span",{style:{color:h.textTertiary},children:"Asignar"})]}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:h.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:h.bgPrimary,border:`1px solid ${h.border}`},children:o.map($=>{let be=z.assignees?.some(Pe=>Pe.name===$.name);return jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:h.textPrimary},onMouseEnter:Pe=>Pe.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:Pe=>Pe.currentTarget.style.backgroundColor="transparent",onClick:()=>{let Pe=be?(z.assignees||[]).filter(Me=>Me.name!==$.name):[...z.assignees||[],{name:$.name,avatar:$.avatar,initials:$.name.split(" ").map(Me=>Me[0]).join("").toUpperCase().slice(0,2),color:h.accent}];ie("assignees",Pe);},children:[jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:h.accent},children:$.name.charAt(0).toUpperCase()}),jsx("span",{className:"truncate flex-1 text-left",children:$.name}),jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:be&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:h.accent}})})]},$.id)})})})]}),jsxs("div",{ref:V,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>{if(!n)if(B)v(false);else {if(V.current){let $=V.current.getBoundingClientRect(),be=window.innerHeight,Pe=120,je=be-$.bottom<Pe?$.top-Pe-8:$.bottom+8;A({top:je,left:$.left});}v(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:xt,disabled:n,children:[jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:z.color}}),jsx("span",{children:Ct.name}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:h.textTertiary}})]}),jsx(AnimatePresence,{children:B&&jsxs(ht,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>v(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${I.top}px`,left:`${I.left}px`,zIndex:99999,backgroundColor:h.bgPrimary,border:`1px solid ${h.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:$=>$.stopPropagation(),children:jsx("div",{style:{padding:"6px 8px"},children:jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:vr.slice(0,18).map($=>{let be=z.color===$.value;return jsx("button",{type:"button",onClick:Pe=>{Pe.preventDefault(),Pe.stopPropagation(),ie("color",$.value),v(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:$.name,children:jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:$.value,outline:be?`2px solid ${$.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},$.value)})})})})]})})]}),p.length>0||d?jsx(yr,{selectedTags:z.tags||[],availableTags:p,onChange:$=>ie("tags",$),onCreateTag:d,theme:h,disabled:n}):null]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Calendar,{className:"w-4 h-4",style:{color:h.textTertiary}}),jsxs("div",{ref:q,className:"flex items-center gap-2 flex-1 relative",children:[jsx("button",{type:"button",onClick:()=>{if(!n&&!z.isMilestone)if(T==="start")H(null);else {if(q.current){let $=q.current.getBoundingClientRect(),be=window.innerHeight,Pe=320,je=be-$.bottom<Pe?$.top-Pe-8:$.bottom+8;ne({top:je,left:$.left});}H("start"),j(z.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...xt,opacity:z.isMilestone?.5:1,cursor:z.isMilestone?"not-allowed":"pointer"},disabled:n||z.isMilestone,children:z.startDate?z.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsx("span",{style:{color:h.textTertiary},children:"\u2192"}),jsx("button",{type:"button",onClick:()=>{if(!n&&!z.isMilestone)if(T==="end")H(null);else {if(q.current){let $=q.current.getBoundingClientRect(),be=window.innerHeight,Pe=320,je=be-$.bottom<Pe?$.top-Pe-8:$.bottom+8;ne({top:je,left:$.left});}H("end"),j(z.endDate||z.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...xt,opacity:z.isMilestone?.5:1,cursor:z.isMilestone?"not-allowed":"pointer"},disabled:n||z.isMilestone,children:z.endDate?z.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsx(AnimatePresence,{children:T&&jsxs(ht,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>H(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"rounded-xl shadow-2xl overflow-hidden flex",style:{position:"fixed",top:`${ae.top}px`,left:`${ae.left}px`,zIndex:99999,backgroundColor:h.bgPrimary,border:`1px solid ${h.border}`},onClick:$=>$.stopPropagation(),children:[jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${h.border}`},children:[(()=>{let $=new Date,be=new Date($);be.setDate($.getDate()+1);let Pe=new Date($);Pe.setDate($.getDate()+7);let Me=new Date($);return Me.setDate($.getDate()+14),[{label:"Hoy",date:$},{label:"Ma\xF1ana",date:be},{label:"Pr\xF3xima semana",date:Pe},{label:"2 semanas",date:Me}].map((Ze,Pt)=>jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:h.textPrimary},onMouseEnter:Le=>Le.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:Le=>Le.currentTarget.style.backgroundColor="transparent",onClick:()=>{T==="start"?(ie("startDate",Ze.date),(!z.endDate||Ze.date>z.endDate)&&ie("endDate",Ze.date),H("end")):(ie("endDate",Ze.date),(!z.startDate||Ze.date<z.startDate)&&ie("startDate",Ze.date),H(null));},children:Ze.label},Pt))})(),jsx("div",{style:{borderTop:`1px solid ${h.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:$=>$.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:$=>$.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(O.getFullYear(),O.getMonth()-1)),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronLeft,{className:"w-4 h-4",style:{color:h.textSecondary}})}),jsx("span",{className:"text-sm font-medium",style:{color:h.textPrimary},children:O.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>j(new Date(O.getFullYear(),O.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronRight,{className:"w-4 h-4",style:{color:h.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map(($,be)=>jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:h.textTertiary},children:$},be))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let $=O.getFullYear(),be=O.getMonth(),Pe=new Date($,be,1).getDay(),Me=new Date($,be+1,0).getDate(),je=new Date,Ze=[];for(let Le=Pe-1;Le>=0;Le--)Ze.push({day:new Date($,be,-Le).getDate(),date:new Date($,be-1,new Date($,be,-Le).getDate()),isCurrentMonth:false});for(let Le=1;Le<=Me;Le++)Ze.push({day:Le,date:new Date($,be,Le),isCurrentMonth:true});let Pt=42-Ze.length;for(let Le=1;Le<=Pt;Le++)Ze.push({day:Le,date:new Date($,be+1,Le),isCurrentMonth:false});return Ze.map((Le,J)=>{let ve=Le.date.toDateString()===je.toDateString(),Ue=z.startDate?.toDateString()===Le.date.toDateString(),Fe=z.endDate?.toDateString()===Le.date.toDateString(),at=z.startDate&&z.endDate&&Le.date>=z.startDate&&Le.date<=z.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?Ue||Fe?"#FFF":h.textPrimary:h.textTertiary,backgroundColor:Ue?"#3B82F6":Fe?"#7C3AED":at?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:ve&&!Ue&&!Fe?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{T==="start"?(ie("startDate",Le.date),z.endDate&&Le.date>z.endDate&&ie("endDate",Le.date),H("end")):(ie("endDate",Le.date),z.startDate&&Le.date<z.startDate&&ie("startDate",Le.date),H(null));},children:Le.day},J)})})()})]})]})]})})]}),se.endDate&&jsx("span",{className:"text-xs text-red-400",children:se.endDate})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:"w-4 h-4",style:{color:h.textTertiary}}),jsxs("div",{className:"flex items-center gap-3 flex-1",children:[jsx("input",{type:"range",min:"0",max:"100",step:"5",value:z.progress,onChange:$=>ie("progress",parseInt($.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:h.bgSecondary,accentColor:z.progress<30?"#EF4444":z.progress<70?"#F59E0B":"#10B981"},disabled:n}),jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${z.progress<30?"#EF4444":z.progress<70?"#F59E0B":"#10B981"}20`,color:z.progress<30?"#EF4444":z.progress<70?"#F59E0B":"#10B981"},children:[z.progress,"%"]})]})]}),jsxs("div",{children:[jsxs("button",{type:"button",onClick:()=>ge(!re),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:h.textTertiary},children:[jsx(ChevronDown,{className:`w-3 h-3 transition-transform ${re?"rotate-180":""}`}),"Opciones avanzadas"]}),jsx(AnimatePresence,{children:re&&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:[(y||f.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:h.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:h.textTertiary},children:["Adjuntos ",c==="create"?fe.length>0&&`(${fe.length})`:f.length>0&&`(${f.length})`]})]}),c==="create"?jsx(wr,{cardId:"pending",attachments:fe.map(($,be)=>({id:`pending-${be}`,cardId:"pending",name:$.name,size:$.size,type:$.type,url:URL.createObjectURL($),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:$=>Ie(be=>[...be,...$]),onDelete:$=>{let be=parseInt($.replace("pending-",""),10);Ie(Pe=>Pe.filter((Me,je)=>je!==be));},maxSizeMB:10,maxFiles:20}):jsx(wr,{cardId:a?.id||"new",attachments:f,onUpload:y&&a?.id?$=>y(a.id,$):void 0,onDelete:k,maxSizeMB:10,maxFiles:20}),c==="create"&&fe.length>0&&jsxs("p",{className:"text-xs mt-1",style:{color:h.textTertiary},children:[fe.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:z.isMilestone,onChange:$=>ie("isMilestone",$.target.checked),className:"w-4 h-4 rounded",style:{accentColor:h.accent},disabled:n}),jsx(Milestone,{className:"w-4 h-4 text-yellow-500"}),jsx("span",{className:"text-sm",style:{color:h.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:h.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:h.bgSecondary},children:r.filter($=>$.id!==a?.id).map($=>{let be=z.dependencies?.includes($.id);return jsx("button",{type:"button",onClick:()=>{let Pe=be?(z.dependencies||[]).filter(Me=>Me!==$.id):[...z.dependencies||[],$.id];ie("dependencies",Pe);},className:"px-2 py-1 rounded-full text-xs transition-colors",style:{backgroundColor:be?`${h.accent}30`:h.bgPrimary,color:be?h.accent:h.textSecondary,border:`1px solid ${be?h.accent:h.borderLight}`},disabled:n,children:$.name},$.id)})})]})]})})})]})]}),jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${h.border}`},children:[jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:h.textSecondary},onMouseEnter:$=>$.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:$=>$.currentTarget.style.backgroundColor="transparent",disabled:n,children:"Cancelar"}),jsx("button",{type:"submit",disabled:n,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:h.accent,color:"#FFF"},onMouseEnter:$=>!n&&($.currentTarget.style.opacity="0.9"),onMouseLeave:$=>!n&&($.currentTarget.style.opacity="1"),children:n?jsxs(Fragment,{children:[jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsx(Fragment,{children:c==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var bm=`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 hm(e){return `CURRENT TASKS:
|
|
386
|
+
${ym(e).map(r=>{let o=r.startDate?r.startDate.toISOString().split("T")[0]:"no date",s=r.endDate?r.endDate.toISOString().split("T")[0]:"no date",n=r.dependencies?.length?`deps: [${r.dependencies.join(", ")}]`:"";return `- ${r.id}: "${r.name}" (${o} to ${s}, ${r.progress}%, ${r.status||"todo"}) ${n}`}).join(`
|
|
387
387
|
`)}
|
|
388
388
|
|
|
389
|
-
Today's date: ${new Date().toISOString().split("T")[0]}`}function bm(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function Mr(e,t){let a=bm(e),r=t.toLowerCase().trim(),o=a.find(m=>m.name.toLowerCase()===r);if(o)return o;let s=a.find(m=>m.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(m=>{let g=m.name.toLowerCase();return n.every(i=>g.includes(i))})}function Xi(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 b=new Date(r);return b.setDate(b.getDate()+1),b}if(a==="yesterday"||a==="ayer"){let b=new Date(r);return b.setDate(b.getDate()-1),b}if(a==="next week"||a==="la pr\xF3xima semana"){let b=new Date(r);return b.setDate(b.getDate()+7),b}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 v={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(v!==void 0){let k=new Date(r),C=k.getDay(),h=v-C;return h<=0&&(h+=7),k.setDate(k.getDate()+h),k}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let b=parseInt(s[1],10),v=s[2].toLowerCase(),k=new Date(r);return v==="day"||v==="d\xEDa"||v==="dias"?k.setDate(k.getDate()+b):v==="week"||v==="semana"||v==="semanas"?k.setDate(k.getDate()+b*7):(v==="month"||v==="mes"||v==="meses")&&k.setMonth(k.getMonth()+b),k}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let m=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(m&&m[1]&&m[2]&&m[3]){let b=parseInt(m[1],10),v=parseInt(m[2],10)-1,k=parseInt(m[3],10);return new Date(k,v,b)}let g={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 b=parseInt(i[1],10),v=g[i[2].toLowerCase()],k=i[3]?parseInt(i[3],10):r.getFullYear();if(v!==void 0)return new Date(k,v,b)}let p={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},l=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(l&&l[1]&&l[2]){let b=p[l[1].toLowerCase()],v=parseInt(l[2],10),k=l[3]?parseInt(l[3],10):r.getFullYear();if(b!==void 0)return new Date(k,b,v)}return null}function Ji(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 Zi(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 hm(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 ym(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(),p=r[2].trim(),l=Mr(t,i),b=Xi(p);if(!l)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!b)return {type:"move_task",taskId:l.id,taskName:l.name,message:`Could not parse the date "${p}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let v=l.startDate&&l.endDate?Math.round((l.endDate.getTime()-l.startDate.getTime())/(1e3*60*60*24)):1,k=new Date(b);return k.setDate(k.getDate()+v),{type:"move_task",taskId:l.id,taskName:l.name,updates:{startDate:b,endDate:k},message:`Moved "${l.name}" to ${b.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(),p=o[2].trim(),l=Mr(t,i),b=Ji(p);if(!l)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!b||!l.endDate)return {type:"resize_task",taskId:l.id,taskName:l.name,message:`Could not parse the duration "${p}".`,success:false,error:"Invalid duration"};let v=new Date(l.endDate);return v.setDate(v.getDate()+b),{type:"resize_task",taskId:l.id,taskName:l.name,updates:{endDate:v},message:`Extended "${l.name}" by ${b} days. New end date: ${v.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let i=s[1].trim(),p=s[2].trim(),l=Mr(t,i),b=Zi(p);return l?b===null?{type:"set_progress",taskId:l.id,taskName:l.name,message:`Could not parse the progress value "${p}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:l.id,taskName:l.name,updates:{progress:b},message:`Set "${l.name}" progress to ${b}%.`,success:true}:{type:"set_progress",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let n=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),p=n[2].trim(),l=Mr(t,i);return l?{type:"rename_task",taskId:l.id,taskName:l.name,updates:{name:p},message:`Renamed "${l.name}" to "${p}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let m=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(m&&m[1]&&m[2]){let i=m[1].trim(),p=m[2].trim(),l=Mr(t,i),b=Mr(t,p);return l?b?{type:"link_tasks",taskId:b.id,taskName:b.name,dependencyFrom:l.id,dependencyTo:b.id,message:`Linked "${l.name}" \u2192 "${b.name}".`,success:true}:{type:"link_tasks",taskName:p,message:`Could not find a task named "${p}".`,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 g=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(g&&g[1]){let i=g[1].trim(),p=Mr(t,i);return p?{type:"delete_task",taskId:p.id,taskName:p.name,message:`Deleted "${p.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 vm(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 dh(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 ch(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function rs(e,t=[],a=[]){let r=e.assignedUserIds?.map(p=>{let l=a.find(b=>b.id===p);return l?{name:l.name,initials:l.initials,color:l.color}:null}).filter(p=>p!==null),o=t.filter(p=>p.metadata?.parentCardId===e.id).map(p=>rs(p,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(p=>p.type==="finish-to-start").map(p=>p.taskId));let n=p=>{if(p)return typeof p=="string"?new Date(p):p},m=n(e.startDate),g=n(e.endDate),i=e.metadata?.isMilestone===true||m&&g&&Math.abs(g.getTime()-m.getTime())<=864e5;return {id:e.id,name:e.title,startDate:m,endDate:g,progress:e.progress||0,status:dh(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:i,isCriticalPath:e.metadata?.isCriticalPath===true}}function xm(e,t=[]){let a;return e.assignees&&e.assignees.length>0&&(a=e.assignees.map(r=>t.find(s=>s.name===r.name||s.initials===r.initials)?.id).filter(r=>r!==void 0)),{id:e.id,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,assignedUserIds:a?.length?a:void 0,metadata:{status:ch(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function km(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>rs(r,e,t))}var Qi={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"}},el={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"}},os={en:Qi,es:el};function tl(e){return os[e]||os.en}function ns(e,t){let a=tl(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},filters:{...a.filters,...t.filters},status:{...a.status,...t.status},actions:{...a.actions,...t.actions},empty:{...a.empty,...t.empty},pagination:{...a.pagination,...t.pagination},bulk:{...a.bulk,...t.bulk}}:a}var al=[{value:"todo",icon:Circle,color:"text-gray-400"},{value:"in-progress",icon:PlayCircle,color:"text-blue-500"},{value:"completed",icon:CheckCircle2,color:"text-green-500"}];function wm({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=useState(false),m=useRef(null);useEffect(()=>{let b=v=>{m.current&&!m.current.contains(v.target)&&n(false);};return s&&document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[s]);let g=al[0],i=al.find(b=>b.value===e)??g,p=i.icon,l=b=>{switch(b){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return o||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(p,{className:d("w-4 h-4",i.color)}),jsx("span",{className:d("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:l(e)})]}):jsxs("div",{ref:m,className:"relative",children:[jsxs("button",{onClick:b=>{b.stopPropagation(),n(!s);},className:d("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsx(p,{className:d("w-4 h-4",i.color)}),jsx("span",{className:d("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:l(e)}),jsx(ChevronDown,{className:d("w-3 h-3",a?"text-[#6B7280]":"text-gray-400")})]}),s&&jsx("div",{className:d("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:al.map(b=>{let v=b.icon;return jsxs("button",{onClick:k=>{k.stopPropagation(),t(b.value),n(false);},className:d("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",e===b.value&&(a?"bg-white/5":"bg-gray-50")),children:[jsx(v,{className:d("w-4 h-4",b.color)}),jsx("span",{className:a?"text-white":"text-gray-900",children:l(b.value)})]},b.value)})})]})}var rl=[{value:"urgent",label:{en:"Urgent",es:"Urgente"},color:"text-red-500",bg:"bg-red-500"},{value:"high",label:{en:"High",es:"Alta"},color:"text-orange-500",bg:"bg-orange-500"},{value:"medium",label:{en:"Medium",es:"Media"},color:"text-yellow-500",bg:"bg-yellow-500"},{value:"low",label:{en:"Low",es:"Baja"},color:"text-blue-500",bg:"bg-blue-500"},{value:"none",label:{en:"None",es:"Ninguna"},color:"text-gray-400",bg:"bg-gray-400"}];function Tm({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=useState(false),m=useRef(null);useEffect(()=>{let p=l=>{m.current&&!m.current.contains(l.target)&&n(false);};return s&&document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]);let g=rl.find(p=>p.value===e)??rl[4],i=r==="es"?"es":"en";return o||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(Flag,{className:d("w-4 h-4",g.color)}),jsx("span",{className:d("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:g.label[i]})]}):jsxs("div",{ref:m,className:"relative",children:[jsxs("button",{onClick:p=>{p.stopPropagation(),n(!s);},className:d("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsx(Flag,{className:d("w-4 h-4",g.color)}),jsx("span",{className:d("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:g.label[i]}),jsx(ChevronDown,{className:d("w-3 h-3",a?"text-[#6B7280]":"text-gray-400")})]}),s&&jsx("div",{className:d("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:rl.map(p=>jsxs("button",{onClick:l=>{l.stopPropagation(),t(p.value),n(false);},className:d("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",e===p.value&&(a?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:d("w-2 h-2 rounded-full",p.bg)}),jsx("span",{className:a?"text-white":"text-gray-900",children:p.label[i]})]},p.value))})]})}function ls(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function ds(e){let t=["bg-blue-500","bg-green-500","bg-purple-500","bg-pink-500","bg-yellow-500","bg-red-500","bg-indigo-500","bg-teal-500"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"bg-blue-500"}function Dm({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false}){let[n,m]=useState(false),[g,i]=useState(""),p=useRef(null);useEffect(()=>{let k=C=>{p.current&&!p.current.contains(C.target)&&(m(false),i(""));};return n&&document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[n]);let l=t.filter(k=>k.name.toLowerCase().includes(g.toLowerCase())||k.email?.toLowerCase().includes(g.toLowerCase())),b=k=>e.some(C=>C.name===k),v=k=>{if(a)if(b(k.name))a(e.filter(C=>C.name!==k.name));else {let C={name:k.name,initials:ls(k.name),color:k.color||ds(k.name).replace("bg-","").replace("-500",""),avatar:k.avatarUrl};a([...e,C]);}};return s||!a?e.length===0?jsx("span",{className:d("text-sm",r?"text-[#6B7280]":"text-gray-400"),children:"-"}):jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((k,C)=>jsx("div",{className:d("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0F1117]":"border-white",!k.avatar&&ds(k.name)),style:k.color&&!k.avatar?{backgroundColor:k.color}:void 0,title:k.name,children:k.avatar?jsx("img",{src:k.avatar,alt:k.name,className:"w-full h-full rounded-full object-cover"}):k.initials||ls(k.name)},`${k.name}-${C}`)),e.length>3&&jsxs("div",{className:d("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#374151] border-[#0F1117] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxs("div",{ref:p,className:"relative",children:[jsx("button",{onClick:k=>{k.stopPropagation(),m(!n);},className:d("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100"),children:e.length===0?jsxs(Fragment,{children:[jsx(User,{className:d("w-4 h-4",r?"text-[#6B7280]":"text-gray-400")}),jsx(Plus,{className:d("w-3 h-3",r?"text-[#6B7280]":"text-gray-400")})]}):jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((k,C)=>jsx("div",{className:d("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0F1117]":"border-white",!k.avatar&&ds(k.name)),style:k.color&&!k.avatar?{backgroundColor:k.color}:void 0,children:k.avatar?jsx("img",{src:k.avatar,alt:k.name,className:"w-full h-full rounded-full object-cover"}):k.initials||ls(k.name)},`${k.name}-${C}`)),e.length>2&&jsxs("span",{className:d("text-xs ml-1",r?"text-[#9CA3AF]":"text-gray-500"),children:["+",e.length-2]})]})}),n&&jsxs("div",{className:d("absolute z-50 top-full left-0 mt-1 rounded-lg shadow-lg border w-64",r?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:[jsx("div",{className:"p-2 border-b",style:{borderColor:r?"rgba(255,255,255,0.1)":"#E5E7EB"},children:jsx("input",{type:"text",value:g,onChange:k=>i(k.target.value),placeholder:o==="es"?"Buscar usuario...":"Search user...",className:d("w-full px-3 py-1.5 text-sm rounded border outline-none",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),onClick:k=>k.stopPropagation()})}),jsx("div",{className:"max-h-48 overflow-y-auto py-1",children:l.length===0?jsx("p",{className:d("px-3 py-2 text-sm",r?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"No se encontraron usuarios":"No users found"}):l.map(k=>jsxs("button",{onClick:C=>{C.stopPropagation(),v(k);},className:d("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsx("div",{className:d("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white",!k.avatarUrl&&ds(k.name)),children:k.avatarUrl?jsx("img",{src:k.avatarUrl,alt:k.name,className:"w-full h-full rounded-full object-cover"}):ls(k.name)}),jsxs("div",{className:"flex-1 text-left",children:[jsx("div",{className:r?"text-white":"text-gray-900",children:k.name}),k.email&&jsx("div",{className:d("text-xs",r?"text-[#6B7280]":"text-gray-400"),children:k.email})]}),b(k.name)&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},k.id))}),e.length>0&&jsx("div",{className:"p-2 border-t flex flex-wrap gap-1",style:{borderColor:r?"rgba(255,255,255,0.1)":"#E5E7EB"},children:e.map((k,C)=>jsxs("span",{className:d("inline-flex items-center gap-1 px-2 py-0.5 text-xs rounded-full",r?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:[k.name,jsx("button",{onClick:h=>{h.stopPropagation(),a(e.filter(f=>f.name!==k.name));},className:"hover:text-red-500",children:jsx(X,{className:"w-3 h-3"})})]},`${k.name}-${C}`))})]})]})}var Ih={en:["January","February","March","April","May","June","July","August","September","October","November","December"],es:["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"]},Bh={en:["Su","Mo","Tu","We","Th","Fr","Sa"],es:["Do","Lu","Ma","Mi","Ju","Vi","S\xE1"]};function cs({value:e,onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=useState(false),[m,g]=useState(()=>{if(e){let h=e instanceof Date?e:new Date(e);return new Date(h.getFullYear(),h.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),i=useRef(null),p=e?e instanceof Date?e:new Date(e):null,l=r==="es"?"es":"en";useEffect(()=>{let h=f=>{i.current&&!i.current.contains(f.target)&&n(false);};return s&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]);let b=h=>h?h.toLocaleDateString(r==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-",v=(h,f)=>new Date(h,f+1,0).getDate(),k=(h,f)=>new Date(h,f,1).getDay(),C=()=>{let h=m.getFullYear(),f=m.getMonth(),u=v(h,f),x=k(h,f),c=new Date,N=[];for(let w=0;w<x;w++)N.push(jsx("div",{className:"w-8 h-8"},`empty-${w}`));for(let w=1;w<=u;w++){let B=new Date(h,f,w),y=p&&p.getDate()===w&&p.getMonth()===f&&p.getFullYear()===h,I=c.getDate()===w&&c.getMonth()===f&&c.getFullYear()===h;N.push(jsx("button",{onClick:P=>{P.stopPropagation(),t?.(B),n(false);},className:d("w-8 h-8 rounded-full text-sm transition-colors",y?"bg-[#3B82F6] text-white":I?a?"bg-white/10 text-white":"bg-gray-100 text-gray-900":a?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-900"),children:w},w));}return N};return o||!t?jsx("span",{className:d("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:b(p)}):jsxs("div",{ref:i,className:"relative",children:[jsxs("button",{onClick:h=>{h.stopPropagation(),n(!s);},className:d("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsx(Calendar,{className:d("w-4 h-4",a?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:d("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:b(p)})]}),s&&jsxs("div",{className:d("absolute z-50 top-full left-0 mt-1 p-3 rounded-lg shadow-lg border",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("button",{onClick:h=>{h.stopPropagation(),g(new Date(m.getFullYear(),m.getMonth()-1,1));},className:d("p-1 rounded",a?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:d("w-4 h-4",a?"text-white":"text-gray-600")})}),jsxs("span",{className:d("text-sm font-medium",a?"text-white":"text-gray-900"),children:[Ih[l][m.getMonth()]," ",m.getFullYear()]}),jsx("button",{onClick:h=>{h.stopPropagation(),g(new Date(m.getFullYear(),m.getMonth()+1,1));},className:d("p-1 rounded",a?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:d("w-4 h-4",a?"text-white":"text-gray-600")})})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:Bh[l].map(h=>jsx("div",{className:d("w-8 h-6 text-xs flex items-center justify-center",a?"text-[#6B7280]":"text-gray-400"),children:h},h))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:C()}),jsxs("div",{className:"mt-3 pt-3 border-t flex gap-2",style:{borderColor:a?"rgba(255,255,255,0.1)":"#E5E7EB"},children:[jsx("button",{onClick:h=>{h.stopPropagation(),t?.(new Date),n(false);},className:d("flex-1 py-1.5 text-xs rounded",a?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:r==="es"?"Hoy":"Today"}),jsx("button",{onClick:h=>{h.stopPropagation();let f=new Date;f.setDate(f.getDate()+1),t?.(f),n(false);},className:d("flex-1 py-1.5 text-xs rounded",a?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:r==="es"?"Ma\xF1ana":"Tomorrow"})]})]})]})}function Mm({value:e=0,onChange:t,isDark:a,disabled:r=false}){return jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsx("div",{onClick:s=>{if(r||!t)return;s.stopPropagation();let n=s.currentTarget.getBoundingClientRect(),m=s.clientX-n.left,g=Math.round(m/n.width*100),i=Math.max(0,Math.min(100,g));t(i);},className:d("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/10":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsx("div",{className:d("h-full rounded-full transition-all",e===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${e}%`}})}),jsxs("span",{className:d("text-xs w-8 text-right",a?"text-[#9CA3AF]":"text-gray-500"),children:[e,"%"]})]})}function Lm({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=useState(false),[m,g]=useState(e),i=useRef(null);useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),useEffect(()=>{g(e);},[e]);let p=()=>{m!==e&&t?.(m),n(false);},l=b=>{b.key==="Enter"?p():b.key==="Escape"&&(g(e),n(false));};return o||!t?jsx("span",{className:d("text-sm truncate",a?"text-[#94A3B8]":"text-gray-500"),children:e||r}):s?jsx("input",{ref:i,type:"text",value:m,onChange:b=>g(b.target.value),onBlur:p,onKeyDown:l,onClick:b=>b.stopPropagation(),className:d("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white":"bg-white border-[#3B82F6] text-gray-900")}):jsx("button",{onClick:b=>{b.stopPropagation(),n(true);},className:d("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",a?"text-[#94A3B8] hover:bg-white/10":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-[#6B7280]":"text-gray-400")),children:e||r})}function Rm({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false}){let[m,g]=useState(false),[i,p]=useState(e?.toString()||""),l=useRef(null);useEffect(()=>{m&&l.current&&(l.current.focus(),l.current.select());},[m]),useEffect(()=>{p(e?.toString()||"");},[e]);let b=()=>{let k=parseFloat(i);if(!isNaN(k)){let C=k;o!==void 0&&(C=Math.max(o,C)),s!==void 0&&(C=Math.min(s,C)),C!==e&&t?.(C);}g(false);},v=k=>{k.key==="Enter"?b():k.key==="Escape"&&(p(e?.toString()||""),g(false));};return n||!t?jsx("span",{className:d("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:e!==void 0?e:r}):m?jsx("input",{ref:l,type:"number",value:i,onChange:k=>p(k.target.value),onBlur:b,onKeyDown:v,onClick:k=>k.stopPropagation(),min:o,max:s,className:d("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white":"bg-white border-[#3B82F6] text-gray-900")}):jsx("button",{onClick:k=>{k.stopPropagation(),g(true);},className:d("text-sm text-left w-full px-2 py-1 rounded transition-colors",a?"text-[#94A3B8] hover:bg-white/10":"text-gray-500 hover:bg-gray-100",e===void 0&&(a?"text-[#6B7280]":"text-gray-400")),children:e!==void 0?e:r})}function Om({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,m]=useState(false),g=useRef(null);return useEffect(()=>{let i=p=>{g.current&&!g.current.contains(p.target)&&m(false);};return n&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]),s||!a?jsx("span",{className:d("text-sm",r?"text-[#94A3B8]":"text-gray-500"),children:e||o}):jsxs("div",{ref:g,className:"relative",children:[jsxs("button",{onClick:i=>{i.stopPropagation(),m(!n);},className:d("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsx("span",{className:d("text-sm flex-1 text-left truncate",r?"text-[#94A3B8]":"text-gray-500",!e&&(r?"text-[#6B7280]":"text-gray-400")),children:e||o}),jsx(ChevronDown,{className:d("w-3 h-3 flex-shrink-0",r?"text-[#6B7280]":"text-gray-400")})]}),n&&jsx("div",{className:d("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",r?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:t.length===0?jsx("p",{className:d("px-3 py-2 text-sm",r?"text-[#6B7280]":"text-gray-400"),children:"No options"}):t.map(i=>jsxs("button",{onClick:p=>{p.stopPropagation(),a(i),m(false);},className:d("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100",e===i&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:r?"text-white":"text-gray-900",children:i}),e===i&&jsx(Check,{className:"w-4 h-4 text-[#3B82F6]"})]},i))})]})}function Um({value:e=false,onChange:t,isDark:a,disabled:r=false}){return jsx("button",{onClick:s=>{s.stopPropagation(),!r&&t&&t(!e);},disabled:r||!t,className:d("w-5 h-5 rounded border-2 flex items-center justify-center transition-colors",e?"bg-[#3B82F6] border-[#3B82F6]":a?"border-[#4B5563] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed"),children:e&&jsx(Check,{className:"w-3 h-3 text-white"})})}function Wm({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsx("span",{className:d("text-sm",t?"text-[#6B7280]":"text-gray-400"),children:"-"});let r=e.slice(0,a),o=e.length-a;return jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.map(s=>jsx("span",{className:"inline-flex items-center px-2 py-0.5 text-xs rounded-full",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.1)":"#F3F4F6",color:s.color||(t?"#9CA3AF":"#6B7280")},children:s.name},s.id)),o>0&&jsxs("span",{className:d("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-500"),children:["+",o]})]})}function ry(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function oy(e){let t=["blue","green","purple","pink","yellow","red","indigo","teal"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"blue"}function jm({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:m,onColumnHide:g,onColumnSort:i,availableUsers:p=[]}){let l=useRef(null),b=r==="es"?_m.es:_m.en;if(useEffect(()=>{let f=x=>{l.current&&!l.current.contains(x.target)&&t();},u=x=>{x.key==="Escape"&&t();};return document.addEventListener("mousedown",f),document.addEventListener("keydown",u),()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",u);}},[t]),!e.isOpen)return null;let v=()=>{if(!e.task)return [];let f=[];return o&&f.push({id:"edit",label:b.edit,icon:jsx(Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),f.push({id:"sep1",label:"",icon:null,separator:true}),m&&(f.push({id:"status",label:b.changeStatus,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:b.todo,icon:jsx(Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{m({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:b.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4 text-blue-500"}),onClick:()=>{m({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:b.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{m({...e.task,status:"completed",progress:100}),t();}}]}),f.push({id:"priority",label:b.changePriority,icon:jsx(Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:b.urgent,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{m({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:b.high,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{m({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:b.medium,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{m({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:b.low,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{m({...e.task,priority:"low"}),t();}}]}),p.length>0&&f.push({id:"assign",label:b.assignUser,icon:jsx(Users,{className:"w-4 h-4"}),submenu:p.slice(0,5).map(u=>({id:`assign-${u.id}`,label:u.name,icon:jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-blue-500",children:u.name.charAt(0).toUpperCase()}),onClick:()=>{let x=e.task.assignees||[],N=x.some(w=>w.name===u.name)?x.filter(w=>w.name!==u.name):[...x,{name:u.name,initials:ry(u.name),color:u.color||oy(u.name),avatar:u.avatarUrl}];m({...e.task,assignees:N}),t();}}))})),f.push({id:"sep2",label:"",icon:null,separator:true}),s&&f.push({id:"duplicate",label:b.duplicate,icon:jsx(Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),n&&f.push({id:"delete",label:b.delete,icon:jsx(Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),f},k=()=>{if(!e.columnId)return [];let f=[];return i&&(f.push({id:"sort-asc",label:b.sortAsc,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),f.push({id:"sort-desc",label:b.sortDesc,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),g&&e.columnId!=="name"&&(f.push({id:"sep-hide",label:"",icon:null,separator:true}),f.push({id:"hide",label:b.hideColumn,icon:jsx(EyeOff,{className:"w-4 h-4"}),onClick:()=>{g(e.columnId),t();}})),f},C=e.type==="task"?v():k(),h={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsx("div",{ref:l,style:h,className:d("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:C.map(f=>f.separator?jsx("div",{className:d("my-1 h-px",a?"bg-white/10":"bg-gray-200")},f.id):f.submenu?jsx(ny,{item:f,isDark:a},f.id):jsxs("button",{onClick:f.onClick,className:d("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",f.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsx("span",{className:d(f.danger?"text-red-500":a?"text-[#9CA3AF]":"text-gray-400"),children:f.icon}),f.label]},f.id))})}function ny({item:e,isDark:t}){let[a,r]=useState(false),o=useRef();return jsxs("div",{className:"relative",onMouseEnter:()=>{o.current&&clearTimeout(o.current),r(true);},onMouseLeave:()=>{o.current=setTimeout(()=>r(false),150);},children:[jsxs("button",{className:d("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-[#9CA3AF]":"text-gray-400",children:e.icon}),jsx("span",{className:"flex-1",children:e.label}),jsx(ChevronRight,{className:d("w-4 h-4",t?"text-[#6B7280]":"text-gray-400")})]}),a&&e.submenu&&jsx("div",{className:d("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:e.submenu.map(m=>jsxs("button",{onClick:m.onClick,className:d("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-[#9CA3AF]":"text-gray-400",children:m.icon}),m.label]},m.id))})]})}var _m={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",delete:"Delete",todo:"To Do",inProgress:"In Progress",completed:"Completed",urgent:"Urgent",high:"High",medium:"Medium",low:"Low",sortAsc:"Sort A \u2192 Z",sortDesc:"Sort Z \u2192 A",hideColumn:"Hide column"},es:{edit:"Editar",changeStatus:"Cambiar estado",changePriority:"Cambiar prioridad",assignUser:"Asignar usuario",duplicate:"Duplicar",delete:"Eliminar",todo:"Pendiente",inProgress:"En Progreso",completed:"Completado",urgent:"Urgente",high:"Alta",medium:"Media",low:"Baja",sortAsc:"Ordenar A \u2192 Z",sortDesc:"Ordenar Z \u2192 A",hideColumn:"Ocultar columna"}};var qm={name:jsx(Type,{className:"w-4 h-4"}),status:jsx(CircleDot,{className:"w-4 h-4"}),priority:jsx(Flag,{className:"w-4 h-4"}),assignees:jsx(Users,{className:"w-4 h-4"}),startDate:jsx(Calendar,{className:"w-4 h-4"}),endDate:jsx(CalendarCheck,{className:"w-4 h-4"}),progress:jsx(BarChart,{className:"w-4 h-4"}),tags:jsx(Tag,{className:"w-4 h-4"}),text:jsx(Type,{className:"w-4 h-4"}),number:jsx(Hash,{className:"w-4 h-4"}),date:jsx(Calendar,{className:"w-4 h-4"}),dropdown:jsx(ChevronDown,{className:"w-4 h-4"}),checkbox:jsx(CheckSquare,{className:"w-4 h-4"})},ky=["name","status","priority","assignees","startDate","endDate","progress","tags"];function Jm({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:m}){let[g,i]=useState(""),p=useRef(null),l=m==="es"?Xm.es:Xm.en;if(useEffect(()=>{if(!e)return;let f=setTimeout(()=>{let u=c=>{p.current&&!p.current.contains(c.target)&&t();},x=c=>{c.key==="Escape"&&t();};document.addEventListener("mousedown",u),document.addEventListener("keydown",x),p._cleanup=()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",x);};},100);return ()=>{clearTimeout(f),p._cleanup&&p._cleanup();}},[e,t]),!e)return null;let b=f=>l.columns[f]||f,v=f=>{if(f==="name")return;let u=a.map(x=>x.id===f?{...x,visible:!x.visible}:x);o(u);},k=(f,u)=>{let x=a.find(N=>N.type===f&&(!u||N.customFieldId===u));if(x){v(x.id);return}let c={id:u||f,type:f,label:u?r.find(N=>N.id===u)?.name||f:b(f),width:120,visible:true,sortable:true,resizable:true,customFieldId:u};o([...a,c]);},C=ky.filter(f=>b(f).toLowerCase().includes(g.toLowerCase())),h=r.filter(f=>f.name.toLowerCase().includes(g.toLowerCase()));return jsxs("div",{ref:p,className:d("absolute right-0 top-full mt-1 w-72 rounded-lg shadow-xl border z-50",n?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxs("div",{className:d("flex items-center justify-between px-4 py-3 border-b",n?"border-white/10":"border-gray-200"),children:[jsx("h3",{className:d("font-medium",n?"text-white":"text-gray-900"),children:l.title}),jsx("button",{onClick:t,className:d("p-1 rounded",n?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(X,{className:d("w-4 h-4",n?"text-[#9CA3AF]":"text-gray-400")})})]}),jsx("div",{className:"p-3",children:jsxs("div",{className:"relative",children:[jsx(Search,{className:d("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",n?"text-[#6B7280]":"text-gray-400")}),jsx("input",{type:"text",value:g,onChange:f=>i(f.target.value),placeholder:l.searchPlaceholder,className:d("w-full pl-9 pr-3 py-2 text-sm rounded-lg border outline-none",n?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")})]})}),jsxs("div",{className:"px-3 pb-2",children:[jsx("h4",{className:d("text-xs font-medium uppercase tracking-wider mb-2",n?"text-[#6B7280]":"text-gray-400"),children:l.standardFields}),jsx("div",{className:"space-y-1",children:C.map(f=>{let u=a.find(N=>N.type===f&&!N.customFieldId),x=u?.visible??false,c=f==="name";return jsxs("button",{onClick:()=>{c||(u?v(u.id):k(f));},disabled:c,className:d("w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors",n?"hover:bg-white/10":"hover:bg-gray-100",c&&"opacity-50 cursor-not-allowed"),children:[jsx("div",{className:d("w-5 h-5 rounded border flex items-center justify-center",x?"bg-[#3B82F6] border-[#3B82F6]":n?"border-[#4B5563]":"border-gray-300"),children:x&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:n?"text-[#9CA3AF]":"text-gray-400",children:qm[f]}),jsx("span",{className:n?"text-white":"text-gray-900",children:b(f)})]},f)})})]}),h.length>0&&jsxs("div",{className:"px-3 pb-2",children:[jsx("h4",{className:d("text-xs font-medium uppercase tracking-wider mb-2",n?"text-[#6B7280]":"text-gray-400"),children:l.customFields}),jsx("div",{className:"space-y-1",children:h.map(f=>{let x=a.find(c=>c.customFieldId===f.id)?.visible??false;return jsxs("button",{onClick:()=>k(f.type,f.id),className:d("w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors",n?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsx("div",{className:d("w-5 h-5 rounded border flex items-center justify-center",x?"bg-[#3B82F6] border-[#3B82F6]":n?"border-[#4B5563]":"border-gray-300"),children:x&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:n?"text-[#9CA3AF]":"text-gray-400",children:qm[f.type]||jsx(Type,{className:"w-4 h-4"})}),jsx("span",{className:n?"text-white":"text-gray-900",children:f.name})]},f.id)})})]}),s&&jsx("div",{className:d("p-3 border-t",n?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:s,className:d("w-full flex items-center justify-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-colors",n?"bg-[#3B82F6]/20 text-[#3B82F6] hover:bg-[#3B82F6]/30":"bg-blue-50 text-blue-600 hover:bg-blue-100"),children:[jsx(Plus,{className:"w-4 h-4"}),l.createField]})})]})}var Xm={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",createField:"Create custom field",columns:{name:"Name",status:"Status",priority:"Priority",assignees:"Assignees",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",createField:"Crear campo personalizado",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",assignees:"Asignados",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var My=[{type:"text",icon:jsx(Type,{className:"w-5 h-5"})},{type:"number",icon:jsx(Hash,{className:"w-5 h-5"})},{type:"date",icon:jsx(Calendar,{className:"w-5 h-5"})},{type:"dropdown",icon:jsx(ChevronDown,{className:"w-5 h-5"})},{type:"checkbox",icon:jsx(CheckSquare,{className:"w-5 h-5"})}];function ep({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=useState(""),[m,g]=useState("text"),[i,p]=useState([""]),l=o==="es"?Qm.es:Qm.en;useEffect(()=>{e&&(n(""),g("text"),p([""]));},[e]),useEffect(()=>{let h=f=>{f.key==="Escape"&&t();};return e&&document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,t]);let b=()=>{if(!s.trim())return;let h={name:s.trim(),type:m};m==="dropdown"&&(h.options=i.filter(f=>f.trim())),a(h),t();},v=()=>{p([...i,""]);},k=(h,f)=>{let u=[...i];u[h]=f,p(u);},C=h=>{i.length>1&&p(i.filter((f,u)=>u!==h));};return e?jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxs("div",{className:d("relative w-full max-w-md rounded-xl shadow-2xl border",r?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxs("div",{className:d("flex items-center justify-between px-6 py-4 border-b",r?"border-white/10":"border-gray-200"),children:[jsx("h2",{className:d("text-lg font-semibold",r?"text-white":"text-gray-900"),children:l.title}),jsx("button",{onClick:t,className:d("p-1 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(X,{className:d("w-5 h-5",r?"text-[#9CA3AF]":"text-gray-400")})})]}),jsxs("div",{className:"p-6 space-y-6",children:[jsxs("div",{children:[jsx("label",{className:d("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.fieldName}),jsx("input",{type:"text",value:s,onChange:h=>n(h.target.value),placeholder:l.fieldNamePlaceholder,className:d("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxs("div",{children:[jsx("label",{className:d("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.fieldType}),jsx("div",{className:"grid grid-cols-5 gap-2",children:My.map(h=>jsxs("button",{onClick:()=>g(h.type),className:d("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",m===h.type?"border-[#3B82F6] bg-[#3B82F6]/10":r?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsx("span",{className:m===h.type?"text-[#3B82F6]":r?"text-[#9CA3AF]":"text-gray-400",children:h.icon}),jsx("span",{className:d("text-xs",m===h.type?"text-[#3B82F6]":r?"text-[#9CA3AF]":"text-gray-500"),children:l.types[h.type]})]},h.type))})]}),m==="dropdown"&&jsxs("div",{children:[jsx("label",{className:d("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.options}),jsxs("div",{className:"space-y-2",children:[i.map((h,f)=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:h,onChange:u=>k(f,u.target.value),placeholder:`${l.option} ${f+1}`,className:d("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),i.length>1&&jsx("button",{onClick:()=>C(f),className:d("p-2 rounded-lg transition-colors",r?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-400"),children:jsx(Trash2,{className:"w-4 h-4"})})]},f)),jsxs("button",{onClick:v,className:d("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#3B82F6] hover:bg-white/10":"text-blue-600 hover:bg-gray-100"),children:[jsx(Plus,{className:"w-4 h-4"}),l.addOption]})]})]})]}),jsxs("div",{className:d("flex items-center justify-end gap-3 px-6 py-4 border-t",r?"border-white/10":"border-gray-200"),children:[jsx("button",{onClick:t,className:d("px-4 py-2 text-sm font-medium rounded-lg transition-colors",r?"text-[#9CA3AF] hover:bg-white/10":"text-gray-600 hover:bg-gray-100"),children:l.cancel}),jsx("button",{onClick:b,disabled:!s.trim(),className:d("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#3B82F6] text-white hover:bg-[#2563EB]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:l.create})]})]})]}):null}var Qm={en:{title:"Create Custom Field",fieldName:"Field Name",fieldNamePlaceholder:"Enter field name...",fieldType:"Field Type",options:"Options",option:"Option",addOption:"Add option",cancel:"Cancel",create:"Create Field",types:{text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Crear Campo Personalizado",fieldName:"Nombre del Campo",fieldNamePlaceholder:"Ingresa el nombre...",fieldType:"Tipo de Campo",options:"Opciones",option:"Opci\xF3n",addOption:"Agregar opci\xF3n",cancel:"Cancelar",create:"Crear Campo",types:{text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var Wy=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:120,visible:true,sortable:true,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true}];function rp(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(...rp(r.subtasks,t+1));return a}function Gy({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 op({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:m=[],customFields:g=[]}){let{theme:i="dark",locale:p="en",customTranslations:l,showSearch:b=true,showHierarchy:v=true,tableColumns:k,allowColumnCustomization:C=true,allowColumnResize:h=true,enableContextMenu:f=true}=t,u=ns(p,l),x=i==="dark",[c,N]=useState("startDate"),[w,B]=useState("asc"),[y,I]=useState(""),[P,T]=useState(k||Wy),[W,O]=useState(false),[q,te]=useState(false),[ne,oe]=useState({isOpen:false,x:0,y:0,type:"task"}),[ce,be]=useState(null),[Le,A]=useState(0),[R,L]=useState(0),j=useRef(null);useEffect(()=>{k&&T(k);},[k]);let X=useMemo(()=>{let G=new Set;function ae(xe){for(let Oe of xe)Oe.subtasks?.length&&(Oe.isExpanded!==false&&G.add(Oe.id),ae(Oe.subtasks));}return ae(e),G},[e]),z=useMemo(()=>P.filter(G=>G.visible),[P]),ve=useCallback(G=>{a.onTaskToggleExpand?.(G);},[a]),se=useCallback(G=>{c===G?B(ae=>ae==="asc"?"desc":"asc"):(N(G),B("asc")),a.onSortChange?.({column:G,direction:w==="asc"?"desc":"asc"});},[c,w,a]),Ie=useCallback(G=>{T(G),a.onColumnsChange?.(G);},[a]),qe=useCallback(G=>{let ae=P.map(xe=>xe.id===G?{...xe,visible:false}:xe);Ie(ae);},[P,Ie]),Qe=useCallback((G,ae)=>{N(G),B(ae);},[]),ie=useCallback((G,ae,xe)=>{f&&(G.preventDefault(),oe({isOpen:true,x:G.clientX,y:G.clientY,type:ae?"task":"header",task:ae,columnId:xe}));},[f]),Xe=useCallback(()=>{oe(G=>({...G,isOpen:false}));},[]),lt=useCallback((G,ae)=>{if(!h)return;G.preventDefault(),G.stopPropagation();let xe=P.find(Oe=>Oe.id===ae);xe&&(be(ae),A(G.clientX),L(xe.width));},[P,h]);useEffect(()=>{if(!ce)return;let G=xe=>{let Oe=xe.clientX-Le,ye=Math.max(50,R+Oe),it=P.map(Ue=>Ue.id===ce?{...Ue,width:ye}:Ue);T(it);},ae=()=>{ce&&a.onColumnsChange?.(P),be(null);};return document.addEventListener("mousemove",G),document.addEventListener("mouseup",ae),()=>{document.removeEventListener("mousemove",G),document.removeEventListener("mouseup",ae);}},[ce,Le,R,P,a]);let kt=useCallback(async G=>{if(a.onCreateCustomField){let ae={...G,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(ae);}te(false);},[a]),yt=useMemo(()=>{let G=rp(e);if(y.trim()){let ae=y.toLowerCase();G=G.filter(xe=>xe.name.toLowerCase().includes(ae));}return G.sort((ae,xe)=>{let Oe,ye;switch(c){case "name":Oe=ae.name.toLowerCase(),ye=xe.name.toLowerCase();break;case "startDate":Oe=ae.startDate?.getTime()||0,ye=xe.startDate?.getTime()||0;break;case "endDate":Oe=ae.endDate?.getTime()||0,ye=xe.endDate?.getTime()||0;break;case "progress":Oe=ae.progress||0,ye=xe.progress||0;break;case "status":Oe=ae.status||"todo",ye=xe.status||"todo";break;case "priority":let it={urgent:0,high:1,medium:2,low:3,none:4};Oe=it[ae.priority]??4,ye=it[xe.priority]??4;break;default:return 0}return Oe<ye?w==="asc"?-1:1:Oe>ye?w==="asc"?1:-1:0}),G},[e,y,c,w]),$=useCallback((G,ae)=>{let xe=it=>{a.onTaskUpdate?.({...G,...it});},Oe=it=>it?G.customFields?.find(wt=>wt.fieldId===it)?.value:void 0,ye=(it,Ue)=>{if(!it)return;let ut=[...G.customFields||[]],Bt=ut.findIndex(jt=>jt.fieldId===it);Bt>=0?ut[Bt]={fieldId:it,value:Ue}:ut.push({fieldId:it,value:Ue}),xe({customFields:ut});};switch(ae.type){case "name":return null;case "status":return jsx(wm,{value:G.status||(G.progress===100?"completed":G.progress&&G.progress>0?"in-progress":"todo"),onChange:Ue=>{xe({status:Ue,progress:Ue==="completed"?100:Ue==="in-progress"?50:0});},isDark:x,locale:p,translations:u.status});case "priority":return jsx(Tm,{value:G.priority,onChange:Ue=>xe({priority:Ue}),isDark:x,locale:p});case "assignees":return jsx(Dm,{value:G.assignees||[],availableUsers:m,onChange:Ue=>xe({assignees:Ue}),isDark:x,locale:p});case "startDate":return jsx(cs,{value:G.startDate,onChange:Ue=>xe({startDate:Ue}),isDark:x,locale:p});case "endDate":return jsx(cs,{value:G.endDate,onChange:Ue=>xe({endDate:Ue}),isDark:x,locale:p});case "progress":return jsx(Mm,{value:G.progress||0,onChange:Ue=>{let wt=Ue===100?"completed":Ue>0?"in-progress":"todo";xe({progress:Ue,status:wt});},isDark:x});case "tags":return jsx(Wm,{value:G.tags||[],isDark:x});case "text":return jsx(Lm,{value:Oe(ae.customFieldId)||"",onChange:Ue=>ye(ae.customFieldId,Ue),isDark:x});case "number":return jsx(Rm,{value:Oe(ae.customFieldId)||0,onChange:Ue=>ye(ae.customFieldId,Ue),isDark:x});case "date":let it=Oe(ae.customFieldId);return jsx(cs,{value:it?new Date(it):void 0,onChange:Ue=>ye(ae.customFieldId,Ue),isDark:x,locale:p});case "dropdown":return jsx(Om,{value:Oe(ae.customFieldId)||"",options:ae.options||[],onChange:Ue=>ye(ae.customFieldId,Ue),isDark:x});case "checkbox":return jsx(Um,{value:Oe(ae.customFieldId)||false,onChange:Ue=>ye(ae.customFieldId,Ue),isDark:x});default:return jsx("span",{className:d("text-sm",x?"text-[#94A3B8]":"text-gray-500"),children:"-"})}},[a,x,p,m,u]),fe=useCallback(G=>({name:u.columns.name,status:u.columns.status,priority:u.columns.priority,assignees:u.columns.assignees,startDate:u.columns.startDate,endDate:u.columns.endDate,progress:u.columns.progress})[G.type]||G.label,[u]),Ae=useMemo(()=>z.reduce((G,ae)=>G+ae.width,0)+(C?48:0),[z,C]);return r?jsx("div",{className:d("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxs("p",{className:d("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:[u.empty.noTasks,"..."]})]})}):o?jsx("div",{className:d("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxs("div",{children:[jsx("h3",{className:d("text-lg font-semibold mb-2",x?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:d("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsx("div",{className:d("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsx(List,{className:"w-8 h-8 text-[#3B82F6]"})}),jsx("h3",{className:d("text-lg font-semibold mb-2",x?"text-white":"text-gray-900"),children:u.empty.noTasks}),jsx("p",{className:d("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:u.empty.addFirstTask})]})}):jsxs("div",{ref:j,className:d("flex-1 flex flex-col w-full h-full overflow-hidden",x?"bg-[#0F1117]":"bg-white",ce&&"select-none",s),style:n,children:[jsx("div",{className:d("flex-shrink-0 px-6 py-4 border-b",x?"border-white/10":"border-gray-200"),children:jsxs("div",{className:"flex items-center gap-4",children:[b&&jsxs("div",{className:"relative flex-1 max-w-md",children:[jsx(Search,{className:d("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",x?"text-[#9CA3AF]":"text-gray-400")}),jsx("input",{type:"text",value:y,onChange:G=>I(G.target.value),placeholder:u.toolbar.searchPlaceholder,className:d("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",x?"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:d("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:[yt.length," ",u.pagination.tasks]})]})}),jsx("div",{className:"flex-1 overflow-auto",children:jsxs("div",{style:{minWidth:Ae},children:[jsxs("div",{className:d("flex-shrink-0 flex items-center border-b text-xs font-medium uppercase tracking-wider sticky top-0 z-10",x?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[z.map(G=>jsxs("div",{className:d("relative flex items-center gap-2 px-4 py-3",x?"text-[#9CA3AF]":"text-gray-500"),style:{width:G.width,minWidth:G.minWidth},onContextMenu:ae=>ie(ae,void 0,G.id),children:[G.sortable?jsxs("button",{onClick:()=>se(G.id),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[fe(G),jsx(ArrowUpDown,{className:d("w-3 h-3",c===G.id&&"text-[#3B82F6]")})]}):jsx("span",{children:fe(G)}),h&&G.resizable&&jsx("div",{className:d("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#3B82F6]",ce===G.id&&"bg-[#3B82F6]"),onMouseDown:ae=>lt(ae,G.id)})]},G.id)),C&&jsxs("div",{className:"relative flex items-center justify-center px-3 py-3",children:[jsx("button",{onClick:G=>{G.stopPropagation(),O(ae=>!ae);},className:d("p-1.5 rounded-lg transition-colors",x?"hover:bg-white/10 text-[#9CA3AF] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",W&&(x?"bg-white/10":"bg-gray-200")),title:p==="es"?"Agregar columna":"Add column",children:jsx(Plus,{className:"w-4 h-4"})}),jsx(Jm,{isOpen:W,onClose:()=>O(false),columns:P,customFields:g,onColumnsChange:Ie,onCreateCustomField:()=>{O(false),te(true);},isDark:x,locale:p})]})]}),jsx(AnimatePresence,{children:yt.map((G,ae)=>{let xe=X.has(G.id);return jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:ae*.02},className:d("flex items-center border-b transition-colors",x?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),onClick:()=>a.onTaskClick?.(G),onDoubleClick:()=>a.onTaskDoubleClick?.(G),onContextMenu:Oe=>ie(Oe,G),children:[z.map(Oe=>jsx("div",{className:"flex items-center px-4 py-3 min-h-[52px]",style:{width:Oe.width,minWidth:Oe.minWidth},children:Oe.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[v&&G.level>0&&jsx("div",{style:{width:`${G.level*24}px`},className:"flex-shrink-0"}),v&&G.hasChildren&&jsx("button",{onClick:ye=>{ye.stopPropagation(),ve(G.id);},className:d("p-0.5 rounded flex-shrink-0",x?"hover:bg-white/10":"hover:bg-gray-200"),children:xe?jsx(ChevronDown,{className:d("w-4 h-4",x?"text-[#9CA3AF]":"text-gray-400")}):jsx(ChevronRight,{className:d("w-4 h-4",x?"text-[#9CA3AF]":"text-gray-400")})}),v&&!G.hasChildren&&jsx("div",{className:"w-5 flex-shrink-0"}),jsx("button",{onClick:ye=>{ye.stopPropagation(),a.onTaskUpdate?.({...G,progress:G.progress===100?0:100,status:G.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsx(Gy,{status:G.status,progress:G.progress})}),jsx("span",{className:d("truncate font-medium",x?"text-white":"text-gray-900",G.progress===100&&(x?"line-through text-[#6B7280]":"line-through text-gray-400")),children:G.name})]}):$(G,Oe)},Oe.id)),C&&jsx("div",{className:"w-12 flex-shrink-0"})]},G.id)})}),yt.length===0&&y&&jsx("div",{className:"flex items-center justify-center py-12",children:jsxs("div",{className:"text-center",children:[jsx(List,{className:d("w-12 h-12 mx-auto mb-4",x?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:d(x?"text-[#9CA3AF]":"text-gray-600"),children:u.empty.noResults})]})})]})}),jsx(jm,{state:ne,onClose:Xe,isDark:x,locale:p,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:qe,onColumnSort:Qe,availableUsers:m}),jsx(ep,{isOpen:q,onClose:()=>te(false),onSave:kt,isDark:x,locale:p})]})}var np=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:120,visible:true,sortable:true,resizable:true},{id:"priority",type:"priority",label:"Priority",width:100,visible:false,sortable:true,resizable:true},{id:"assignees",type:"assignees",label:"Assignees",width:150,visible:false,sortable:false,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true},{id:"tags",type:"tags",label:"Tags",width:150,visible:false,sortable:false,resizable:true}],sp=[{type:"name",labelKey:"columns.name",icon:"Type"},{type:"status",labelKey:"columns.status",icon:"CircleDot"},{type:"priority",labelKey:"columns.priority",icon:"Flag"},{type:"assignees",labelKey:"columns.assignees",icon:"Users"},{type:"startDate",labelKey:"columns.startDate",icon:"Calendar"},{type:"endDate",labelKey:"columns.endDate",icon:"CalendarCheck"},{type:"progress",labelKey:"columns.progress",icon:"BarChart"},{type:"tags",labelKey:"columns.tags",icon:"Tag"}],ip=[{type:"text",labelKey:"customFields.text",icon:"Type"},{type:"number",labelKey:"customFields.number",icon:"Hash"},{type:"date",labelKey:"customFields.date",icon:"Calendar"},{type:"dropdown",labelKey:"customFields.dropdown",icon:"ChevronDown"},{type:"checkbox",labelKey:"customFields.checkbox",icon:"CheckSquare"}];var dl={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"},cl={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"},ml={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"},us={dark:dl,light:cl,neutral:ml};function lp(e){return us[e]||us.dark}var pl={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"}},ul={navigation:{today:"Hoy",previous:"Anterior",next:"Siguiente",month:"Mes",week:"Semana",day:"D\xEDa"},weekdays:{sun:"Dom",mon:"Lun",tue:"Mar",wed:"Mi\xE9",thu:"Jue",fri:"Vie",sat:"S\xE1b"},weekdaysFull:{sunday:"Domingo",monday:"Lunes",tuesday:"Martes",wednesday:"Mi\xE9rcoles",thursday:"Jueves",friday:"Viernes",saturday:"S\xE1bado"},months:{january:"Enero",february:"Febrero",march:"Marzo",april:"Abril",may:"Mayo",june:"Junio",july:"Julio",august:"Agosto",september:"Septiembre",october:"Octubre",november:"Noviembre",december:"Diciembre"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{allDay:"Todo el d\xEDa",moreEvents:"+{count} m\xE1s",noEvents:"Sin tareas",newTask:"Nueva Tarea",viewAll:"Ver todo",week:"Semana"},tooltips:{progress:"Progreso",status:"Estado",assignees:"Asignados",duration:"Duraci\xF3n",days:"d\xEDas"}},gs={en:pl,es:ul};function nn(e){return gs[e]||gs.en}function fs(e,t){let a=nn(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 dp(e){let t=nn(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 cp(e,t=0,a=true){let r=nn(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 lv(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 vl(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 fp({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 hp({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:m,availableTags:g=[],onCreateTag:i,attachmentsByTask:p,comments:l,onAddComment:b,currentUser:v,mentionableUsers:k,onTaskOpen:C}){let{theme:h="dark",locale:f="en",customTranslations:u}=t,x=fs(f,u),c=h==="dark",N={textTertiary:c?"#6B7280":"#9CA3AF",textSecondary:c?"#9CA3AF":"#6B7280",textPrimary:c?"#FFFFFF":"#111827",borderLight:c?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:c?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:c?"#1A1D25":"#FFFFFF",bgSecondary:c?"#0F1117":"#F9FAFB",hoverBg:c?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},[w,B]=useState(r||new Date),[y,I]=useState(null),[P,T]=useState(null),[W,O]=useState(null),[q,te]=useState(new Date),[ne,oe]=useState({}),ce=4,be=3,[Le,A]=useState(false),[R,L]=useState(false),[j,X$1]=useState(false),[z,ve]=useState(false),[se,Ie]=useState(null),[qe,Qe]=useState(""),[ie,Xe]=useState(void 0),[lt,kt]=useState(null),[yt,$]=useState(false),[fe,Ae]=useState(false),[G,ae]=useState(null),[xe,Oe]=useState(false),[ye,it]=useState(new Date),[Ue,wt]=useState(false),[ut,Bt]=useState(false),[jt,Se]=useState(false),[Ve,ua]=useState(""),[Ze,Ke]=useState(false),[F,Te]=useState(""),[Z,ke]=useState(false),Ce=useCallback(()=>{B(new Date(w.getFullYear(),w.getMonth()-1,1));},[w]),$e=useCallback(()=>{B(new Date(w.getFullYear(),w.getMonth()+1,1));},[w]),Be=useCallback(()=>{B(new Date);},[]),st=useMemo(()=>{let M=w.getFullYear(),V=w.getMonth(),Me=new Date(M,V,1),Ye=new Date(M,V+1,0),Pt=Me.getDay(),de=Ye.getDate(),We=lv(e),vt=new Date;vt.setHours(0,0,0,0);let Re=[],gt=Pt,va=new Date(M,V,0).getDate();for(let Kt=gt-1;Kt>=0;Kt--){let je=new Date(M,V-1,va-Kt);Re.push({date:je,isCurrentMonth:false,isToday:false,isWeekend:je.getDay()===0||je.getDay()===6,events:We.filter(Yt=>vl(je,Yt)).map(Yt=>({id:Yt.id,title:Yt.name,start:Yt.startDate,end:Yt.endDate,task:Yt}))});}for(let Kt=1;Kt<=de;Kt++){let je=new Date(M,V,Kt),Yt=je.getTime()===vt.getTime();Re.push({date:je,isCurrentMonth:true,isToday:Yt,isWeekend:je.getDay()===0||je.getDay()===6,events:We.filter(ga=>vl(je,ga)).map(ga=>({id:ga.id,title:ga.name,start:ga.startDate,end:ga.endDate,task:ga}))});}let wa=42-Re.length;for(let Kt=1;Kt<=wa;Kt++){let je=new Date(M,V+1,Kt);Re.push({date:je,isCurrentMonth:false,isToday:false,isWeekend:je.getDay()===0||je.getDay()===6,events:We.filter(Yt=>vl(je,Yt)).map(Yt=>({id:Yt.id,title:Yt.name,start:Yt.startDate,end:Yt.endDate,task:Yt}))});}return Re},[w,e]),U=f==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Y=w.toLocaleDateString(f==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),pe=useCallback((M,V)=>{if(!y)return;let Me={...y,[M]:V};I(Me),a.onTaskUpdate?.(Me);},[y,a]),_e=useCallback(M=>{if(!y)return;let V=y.progress||0;M==="completed"?V=100:M==="todo"&&(V=0);let Me={...y,status:M,progress:V};I(Me),a.onTaskUpdate?.(Me),A(false);},[y,a]),ze=useCallback((M,V)=>{if(!y)return;let Me={...y,startDate:M,endDate:V};I(Me),a.onTaskUpdate?.(Me);},[y,a]),H=useCallback(()=>{A(false),L(false),X$1(false),O(null),Se(false),ua(""),Ke(false);},[]),le=useCallback(async M=>{if(M.preventDefault(),M.stopPropagation(),wt(false),!y||!a.onUploadAttachments)return;let V=Array.from(M.dataTransfer.files);if(V.length!==0){Bt(true);try{await a.onUploadAttachments(y.id,V);}finally{Bt(false);}}},[y,a]),He=useCallback(async M=>{if(!y||!a.onUploadAttachments||!M.target.files)return;let V=Array.from(M.target.files);if(V.length!==0){Bt(true);try{await a.onUploadAttachments(y.id,V);}finally{Bt(false);}M.target.value="";}},[y,a]),Ft=useCallback(M=>{M.preventDefault(),M.stopPropagation(),wt(true);},[]),rt=useCallback(M=>{M.preventDefault(),M.stopPropagation(),wt(false);},[]),ya=useCallback(M=>M<1024?`${M} B`:M<1024*1024?`${(M/1024).toFixed(1)} KB`:`${(M/(1024*1024)).toFixed(1)} MB`,[]),$a=useCallback(M=>M.startsWith("image/")?Image:M.includes("pdf")||M.includes("document")?FileText:File,[]),ct=useMemo(()=>!y||!p?[]:p.get(y.id)||[],[y,p]);return o?jsx("div",{className:d("flex-1 flex items-center justify-center",c?"bg-[#0F1117]":"bg-white",n),style:m,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:d("text-sm",c?"text-[#9CA3AF]":"text-gray-600"),children:[x.labels.noEvents,"..."]})]})}):s?jsx("div",{className:d("flex-1 flex items-center justify-center",c?"bg-[#0F1117]":"bg-white",n),style:m,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:d("text-lg font-semibold mb-2",c?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:d("text-sm",c?"text-[#9CA3AF]":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsx("div",{className:d("flex-1 flex items-center justify-center",c?"bg-[#0F1117]":"bg-white",n),style:m,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:d("text-lg font-semibold mb-2",c?"text-white":"text-gray-900"),children:x.labels.noEvents}),jsx("p",{className:d("text-sm",c?"text-[#9CA3AF]":"text-gray-600"),children:x.labels.newTask})]})}):jsxs("div",{className:d("flex-1 flex flex-col w-full h-full overflow-auto",c?"bg-[#0F1117]":"bg-white",n),style:m,children:[jsx("div",{className:d("flex-shrink-0 px-6 py-4 border-b",c?"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:d("text-xl font-semibold capitalize",c?"text-white":"text-gray-900"),children:Y}),jsx("button",{onClick:Be,className:d("px-3 py-1.5 text-sm rounded-lg transition-colors",c?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:x.navigation.today})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("button",{onClick:Ce,className:d("p-2 rounded-lg transition-colors",c?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:d("w-5 h-5",c?"text-[#9CA3AF]":"text-gray-600")})}),jsx("button",{onClick:$e,className:d("p-2 rounded-lg transition-colors",c?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:d("w-5 h-5",c?"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:U.map(M=>jsx("div",{className:d("py-2 text-center text-xs font-medium uppercase",c?"text-[#9CA3AF]":"text-gray-500"),children:M},M))}),jsx("div",{className:d("grid grid-cols-7 auto-rows-min gap-px rounded-lg",c?"bg-[#2D2D2D]":"bg-gray-300"),children:st.map((M,V)=>{let Me=M.date.getDay()===0||M.date.getDay()===6;return jsxs("div",{className:d("min-h-[120px] p-2 transition-colors flex flex-col relative group",c?Me?"bg-[#1C1F26]":M.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":Me?"bg-gray-100":M.isCurrentMonth?"bg-white":"bg-gray-50",M.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let Ye=ne[V]||ce,Pt=M.events.slice(0,Ye),de=M.events.length-Ye;return jsxs("div",{className:"space-y-1 flex-1",children:[Pt.map(We=>jsx("div",{className:"relative group",children:jsxs(motion.button,{onClick:()=>{I(We.task),a.onEventClick?.(We),C?.(We.task.id);},whileHover:{scale:1.02},className:d("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",We.task.progress===100?c?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":c?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsx(fp,{task:We.task}),jsx("span",{className:"truncate",children:We.title})]})},We.id)),de>0&&jsxs("button",{onClick:We=>{We.stopPropagation(),oe(vt=>({...vt,[V]:Ye+be}));},className:d("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",c?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",de," ",f==="es"?"M\xC1S":"MORE"]}),Ye>ce&&M.events.length>ce&&jsx("button",{onClick:We=>{We.stopPropagation(),oe(vt=>({...vt,[V]:ce}));},className:d("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",c?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:f==="es"?"MENOS":"LESS"})]})})(),jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let Ye=V>=28,Pt=V%7>=5;return jsxs("div",{className:"relative",children:[jsx("button",{onClick:de=>{de.stopPropagation(),se===V?Ie(null):(Ie(V),Qe(""),Xe(void 0),kt(null),ae(null),$(false),Ae(false),Oe(false),it(M.date));},className:d("w-5 h-5 rounded flex items-center justify-center transition-all",se===V?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",c?"hover:bg-[#7C3AED] text-[#6B7280] hover:text-white":"hover:bg-[#7C3AED] text-gray-400 hover:text-white"),children:jsx(Plus,{className:d("w-3.5 h-3.5 transition-transform",se===V&&"rotate-45")})}),jsx(AnimatePresence,{children:se===V&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Ie(null),Qe(""),Xe(void 0),kt(null),ae(null),$(false),Ae(false),Oe(false);}}),jsxs(motion.div,{initial:{opacity:0,y:Ye?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:Ye?-5:5,scale:.95},transition:{duration:.12},className:d("absolute w-[320px] rounded-lg shadow-2xl z-50",Ye?"bottom-full mb-1":"top-full mt-1",Pt?"right-0":"left-0",c?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:de=>{de.stopPropagation(),$(false),Ae(false),Oe(false);},children:[jsx("div",{className:"p-2.5",children:jsx("input",{type:"text",value:qe,onChange:de=>Qe(de.target.value),placeholder:f==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:d("w-full bg-transparent text-sm outline-none placeholder:opacity-40",c?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:de=>{if(de.key==="Enter"&&qe.trim()){let We=t.availableUsers?.find(Re=>Re.id===lt),vt=G||M.date;a.onTaskCreate?.({name:qe.trim(),startDate:vt,endDate:vt,priority:ie,assignees:We?[We]:void 0}),Qe(""),Xe(void 0),kt(null),ae(null),Ie(null);}de.key==="Escape"&&(Ie(null),Qe(""),Xe(void 0),kt(null),ae(null));}})}),jsxs("div",{className:d("px-2.5 py-2 flex items-center justify-between border-t",c?"border-white/10":"border-gray-100"),children:[jsxs("div",{className:"flex items-center gap-1",children:[jsxs("div",{className:"relative",children:[jsx("button",{onClick:de=>{de.stopPropagation(),$(!yt),Ae(false);},className:d("p-1 rounded transition-colors",ie?ie==="urgent"||ie==="high"?"text-red-400 bg-red-500/20":ie==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":c?"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:yt&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:d("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",c?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:de=>de.stopPropagation(),children:[{id:"urgent",label:f==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:f==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:f==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:f==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:f==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(de=>jsxs("button",{onClick:()=>{Xe(de.id),$(false);},className:d("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",c?"hover:bg-white/5":"hover:bg-gray-50",ie===de.id&&(c?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:d("w-2 h-2 rounded-full",de.color)}),jsx("span",{className:c?"text-white":"text-gray-900",children:de.label})]},de.id||"none"))})})]}),jsxs("div",{className:"relative",children:[jsxs("button",{onClick:de=>{de.stopPropagation(),Oe(!xe),$(false),Ae(false),it(G||M.date);},className:d("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",G?"bg-[#7C3AED]/20 text-[#7C3AED]":c?"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"}),(G||M.date).toLocaleDateString(f==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsx(AnimatePresence,{children:xe&&jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:d("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",c?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:de=>de.stopPropagation(),children:[jsx("div",{className:d("w-40 py-2 border-r",c?"border-white/10":"border-gray-200"),children:(()=>{let de=new Date,We=new Date(de);We.setDate(de.getDate()+1);let vt=new Date(de);vt.setDate(de.getDate()+((6-de.getDay()+7)%7||7));let Re=new Date(de);Re.setDate(de.getDate()+((1-de.getDay()+7)%7||7));let gt=new Date(de);gt.setDate(de.getDate()+14);let va=new Date(de);return va.setDate(de.getDate()+28),[{label:f==="es"?"Hoy":"Today",date:de,display:de.toLocaleDateString(f==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:f==="es"?"Ma\xF1ana":"Tomorrow",date:We,display:We.toLocaleDateString(f==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:f==="es"?"Este fin de semana":"This weekend",date:vt,display:f==="es"?"s\xE1b.":"sat."},{label:f==="es"?"Pr\xF3xima semana":"Next week",date:Re,display:f==="es"?"lun.":"mon."},{label:f==="es"?"2 semanas":"2 weeks",date:gt,display:gt.toLocaleDateString(f==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:f==="es"?"4 semanas":"4 weeks",date:va,display:va.toLocaleDateString(f==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Kt,je)=>jsxs("button",{className:d("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",c?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{ae(Kt.date),Oe(false);},children:[jsx("span",{children:Kt.label}),jsx("span",{className:d("text-[10px]",c?"text-[#6B7280]":"text-gray-400"),children:Kt.display})]},je))})()}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("span",{className:d("text-xs font-medium",c?"text-white":"text-gray-900"),children:ye.toLocaleDateString(f==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{onClick:()=>it(new Date),className:d("px-1.5 py-0.5 rounded text-[10px] transition-colors",c?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:f==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>it(new Date(ye.getFullYear(),ye.getMonth()-1)),className:d("p-0.5 rounded",c?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-3.5 h-3.5"})}),jsx("button",{onClick:()=>it(new Date(ye.getFullYear(),ye.getMonth()+1)),className:d("p-0.5 rounded",c?"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:(f==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(de=>jsx("div",{className:d("w-6 h-6 flex items-center justify-center text-[10px]",c?"text-[#6B7280]":"text-gray-400"),children:de},de))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let de=ye.getFullYear(),We=ye.getMonth(),vt=new Date(de,We,1).getDay(),Re=new Date(de,We+1,0).getDate(),gt=new Date(de,We,0).getDate(),va=new Date,wa=[];for(let je=vt-1;je>=0;je--)wa.push({dayNum:gt-je,isCurrentMonth:false,date:new Date(de,We-1,gt-je)});for(let je=1;je<=Re;je++)wa.push({dayNum:je,isCurrentMonth:true,date:new Date(de,We,je)});let Kt=42-wa.length;for(let je=1;je<=Kt;je++)wa.push({dayNum:je,isCurrentMonth:false,date:new Date(de,We+1,je)});return wa.map((je,Yt)=>{let ga=je.date.toDateString()===va.toDateString(),Ar=(G||M.date).toDateString()===je.date.toDateString();return jsx("button",{className:d("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!je.isCurrentMonth&&(c?"text-[#4B5563]":"text-gray-300"),je.isCurrentMonth&&(c?"text-white":"text-gray-900"),ga&&"ring-1 ring-[#3B82F6]",Ar&&"bg-[#7C3AED] text-white",!Ar&&(c?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{ae(je.date),Oe(false);},children:je.dayNum},Yt)})})()})]})]})})]}),jsxs("div",{className:"relative",children:[jsx("button",{onClick:de=>{de.stopPropagation(),Ae(!fe),$(false);},className:d("p-1 rounded transition-colors",lt?"text-[#7C3AED] bg-[#7C3AED]/20":c?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:lt?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(de=>de.id===lt)?.color||"#7C3AED"},children:t.availableUsers?.find(de=>de.id===lt)?.initials||t.availableUsers?.find(de=>de.id===lt)?.name?.slice(0,2).toUpperCase()}):jsx(User,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:fe&&jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:d("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",c?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:de=>de.stopPropagation(),children:[jsxs("button",{onClick:()=>{kt(null),Ae(false);},className:d("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",c?"hover:bg-white/5":"hover:bg-gray-50",!lt&&(c?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:d("w-5 h-5 rounded-full flex items-center justify-center",c?"bg-white/10":"bg-gray-200"),children:jsx(User,{className:"w-3 h-3 text-gray-400"})}),jsx("span",{className:c?"text-[#9CA3AF]":"text-gray-500",children:f==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(de=>jsxs("button",{onClick:()=>{kt(de.id),Ae(false);},className:d("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",c?"hover:bg-white/5":"hover:bg-gray-50",lt===de.id&&(c?"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:de.color||"#7C3AED"},children:de.initials||de.name?.slice(0,2).toUpperCase()}),jsx("span",{className:c?"text-white":"text-gray-900",children:de.name})]},de.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsx("div",{className:d("px-3 py-2 text-xs",c?"text-[#6B7280]":"text-gray-400"),children:f==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsx("button",{onClick:()=>{if(qe.trim()){let de=t.availableUsers?.find(vt=>vt.id===lt),We=G||M.date;a.onTaskCreate?.({name:qe.trim(),startDate:We,endDate:We,priority:ie,assignees:de?[de]:void 0}),Qe(""),Xe(void 0),kt(null),ae(null),Ie(null);}},disabled:!qe.trim(),className:d("px-2.5 py-1 rounded text-xs font-medium transition-colors",qe.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":c?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:f==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsx("span",{className:d("text-sm font-medium",M.isToday?"text-[#3B82F6]":M.isCurrentMonth?c?"text-white":"text-gray-900":c?"text-[#6B7280]":"text-gray-400"),children:M.date.getDate()})]})]},V)})})]})}),jsx(AnimatePresence,{children:y&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>{I(null),Te("");},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:d("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",c?"bg-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxs("div",{className:d("px-6 py-3 border-b flex items-center gap-3",c?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Circle,{className:d("w-4 h-4",c?"text-[#9CA3AF]":"text-gray-500")}),jsxs("span",{className:d("text-xs px-2 py-0.5 rounded",c?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[f==="es"?"Tarea":"Task"," \u2228"]}),jsx("span",{className:d("text-xs font-mono",c?"text-[#6B7280]":"text-gray-400"),children:y.id.slice(0,8)}),jsxs("button",{className:d("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",c?"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:d("p-1.5 rounded transition-colors",c?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(Maximize2,{className:"w-4 h-4"})}),jsx("button",{className:d("p-1.5 rounded transition-colors",c?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(MoreHorizontal,{className:"w-5 h-5"})}),jsx("button",{onClick:()=>{I(null),Te("");},className:d("p-1.5 rounded transition-colors",c?"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 M=y.progress===100?0:100,Me={...y,progress:M,status:M===100?"completed":"todo"};I(Me),a.onTaskUpdate?.(Me);},className:d("mt-1 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors",y.progress===100?"bg-green-500 border-green-500":c?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:y.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("h2",{className:d("text-xl font-semibold flex-1",y.progress===100?"line-through text-[#6B7280]":c?"text-white":"text-gray-900"),children:y.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:d("w-4 h-4",c?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:d("text-sm w-24",c?"text-[#9CA3AF]":"text-gray-500"),children:f==="es"?"Estado":"Status"}),jsx("button",{onClick:()=>{H(),A(!Le);},className:d("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",y.progress===100||y.status==="completed"?"bg-green-500/20 text-green-400":y.progress&&y.progress>0||y.status==="in-progress"?"bg-blue-500/20 text-blue-400":c?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:y.progress===100||y.status==="completed"?f==="es"?"COMPLETADO":"DONE":y.progress&&y.progress>0||y.status==="in-progress"?f==="es"?"EN PROGRESO":"IN PROGRESS":f==="es"?"POR HACER":"TO DO"}),jsx(AnimatePresence,{children:Le&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>A(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:d("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",c?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:f==="es"?"Por hacer":"To Do",color:"bg-white/10 text-white"},{id:"in-progress",label:f==="es"?"En progreso":"In Progress",color:"bg-blue-500/20 text-blue-400"},{id:"completed",label:f==="es"?"Completado":"Done",color:"bg-green-500/20 text-green-400"}].map(M=>jsxs("button",{onClick:()=>_e(M.id),className:d("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",c?"hover:bg-white/5":"hover:bg-gray-50",(y.status===M.id||M.id==="completed"&&y.progress===100||M.id==="in-progress"&&y.progress&&y.progress>0&&y.progress<100||M.id==="todo"&&(!y.progress||y.progress===0)&&y.status!=="in-progress"&&y.status!=="completed")&&(c?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:d("w-2 h-2 rounded-full",M.id==="completed"?"bg-green-500":M.id==="in-progress"?"bg-blue-500":"bg-gray-400")}),jsx("span",{className:c?"text-white":"text-gray-900",children:M.label})]},M.id))})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(User,{className:d("w-4 h-4",c?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:d("text-sm w-24",c?"text-[#9CA3AF]":"text-gray-500"),children:f==="es"?"Asignados":"Assignees"}),jsxs("button",{onClick:()=>{A(false),L(false),O(null),X$1(!j);},className:d("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",c?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[y.assignees&&y.assignees.length>0?jsxs("div",{className:"flex items-center gap-1",children:[y.assignees.slice(0,3).map((M,V)=>jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:M.color||"#8B5CF6"},title:M.name,children:M.initials||M.name.slice(0,2).toUpperCase()},V)),y.assignees.length>3&&jsxs("span",{className:d("text-xs",c?"text-[#6B7280]":"text-gray-400"),children:["+",y.assignees.length-3]})]}):jsx("span",{className:d("text-sm",c?"text-[#6B7280]":"text-gray-400"),children:f==="es"?"Agregar":"Add"}),jsx(ChevronDown,{className:d("w-3 h-3",c?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:j&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>X$1(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:d("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",c?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:t.availableUsers&&t.availableUsers.length>0?t.availableUsers.map(M=>{let V=y.assignees?.some(Me=>Me.name===M.name);return jsxs("button",{onClick:()=>{let Me=y.assignees||[],Ye;V?Ye=Me.filter(Pt=>Pt.name!==M.name):Ye=[...Me,{name:M.name,avatar:M.avatar,initials:M.initials||M.name.slice(0,2).toUpperCase(),color:M.color||"#8B5CF6"}],pe("assignees",Ye);},className:d("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",c?"hover:bg-white/5":"hover:bg-gray-50",V&&(c?"bg-white/5":"bg-gray-50")),children:[M.avatar?jsx("img",{src:M.avatar,alt:M.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:M.color||"#8B5CF6"},children:M.initials||M.name.slice(0,2).toUpperCase()}),jsx("span",{className:d("flex-1 text-left",c?"text-white":"text-gray-900"),children:M.name}),V&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},M.id||M.name)}):jsx("div",{className:d("px-3 py-4 text-sm text-center",c?"text-[#6B7280]":"text-gray-400"),children:f==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CalendarDays,{className:d("w-4 h-4",c?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:d("text-sm w-24",c?"text-[#9CA3AF]":"text-gray-500"),children:f==="es"?"Fechas":"Dates"}),jsxs("button",{onClick:()=>{O(W?null:"start"),te(y.startDate||new Date);},className:d("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",c?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[y.startDate?.toLocaleDateString(f==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(f==="es"?"Inicio":"Start"),jsx("span",{className:d("mx-1",c?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),y.endDate?.toLocaleDateString(f==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(f==="es"?"Fin":"End"),(y.startDate||y.endDate)&&jsx(X,{className:"w-3.5 h-3.5 ml-1 opacity-50 hover:opacity-100",onClick:M=>{M.stopPropagation();}})]}),jsx(AnimatePresence,{children:W&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>O(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:d("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",c?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:M=>M.stopPropagation(),children:[jsxs("div",{className:d("w-44 py-2 border-r",c?"border-white/10":"border-gray-200"),children:[(()=>{let M=new Date,V=new Date(M);V.setDate(M.getDate()+1);let Me=new Date(M);Me.setDate(M.getDate()+((6-M.getDay()+7)%7||7));let Ye=new Date(M);Ye.setDate(M.getDate()+((1-M.getDay()+7)%7||7));let Pt=new Date(M);Pt.setDate(M.getDate()+(6-M.getDay()+7)%7+7);let de=new Date(M);de.setDate(M.getDate()+14);let We=new Date(M);return We.setDate(M.getDate()+28),[{label:f==="es"?"Hoy":"Today",date:M,display:M.toLocaleDateString(f==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:f==="es"?"Ma\xF1ana":"Tomorrow",date:V,display:V.toLocaleDateString(f==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:f==="es"?"Este fin de semana":"This weekend",date:Me,display:f==="es"?"s\xE1b.":"sat."},{label:f==="es"?"Pr\xF3xima semana":"Next week",date:Ye,display:f==="es"?"lun.":"mon."},{label:f==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:Pt,display:Pt.toLocaleDateString(f==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:f==="es"?"2 semanas":"2 weeks",date:de,display:de.toLocaleDateString(f==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:f==="es"?"4 semanas":"4 weeks",date:We,display:We.toLocaleDateString(f==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Re,gt)=>jsxs("button",{className:d("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",c?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(W==="start"){let va=y.endDate&&Re.date>y.endDate?Re.date:y.endDate;ze(Re.date,va),O("end");}else {let va=y.startDate&&Re.date<y.startDate?Re.date:y.startDate;ze(va,Re.date),O(null);}},children:[jsx("span",{children:Re.label}),jsx("span",{className:d("text-xs",c?"text-[#6B7280]":"text-gray-400"),children:Re.display})]},gt))})(),jsx("div",{className:d("border-t mt-2 pt-2",c?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{ze(void 0,void 0),O(null);},className:d("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",c?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:f==="es"?"Quitar fechas":"Clear dates"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[jsx("div",{className:d("text-xs mb-3 px-2 py-1 rounded",c?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:W==="start"?f==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":f==="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:d("font-medium",c?"text-white":"text-gray-900"),children:q.toLocaleDateString(f==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>te(new Date),className:d("p-1 rounded text-sm transition-colors",c?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:f==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>te(new Date(q.getFullYear(),q.getMonth()-1)),className:d("p-1 rounded",c?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-4 h-4"})}),jsx("button",{onClick:()=>te(new Date(q.getFullYear(),q.getMonth()+1)),className:d("p-1 rounded",c?"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:(f==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(M=>jsx("div",{className:d("w-8 h-8 flex items-center justify-center text-xs",c?"text-[#6B7280]":"text-gray-400"),children:M},M))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let M=q.getFullYear(),V=q.getMonth(),Me=new Date(M,V,1).getDay(),Ye=new Date(M,V+1,0).getDate(),Pt=new Date(M,V,0).getDate(),de=new Date,We=[];for(let Re=Me-1;Re>=0;Re--)We.push({day:Pt-Re,isCurrentMonth:false,date:new Date(M,V-1,Pt-Re)});for(let Re=1;Re<=Ye;Re++)We.push({day:Re,isCurrentMonth:true,date:new Date(M,V,Re)});let vt=42-We.length;for(let Re=1;Re<=vt;Re++)We.push({day:Re,isCurrentMonth:false,date:new Date(M,V+1,Re)});return We.map((Re,gt)=>{let va=Re.date.toDateString()===de.toDateString(),wa=y.startDate?.toDateString()===Re.date.toDateString(),Kt=y.endDate?.toDateString()===Re.date.toDateString(),je=wa||Kt,Yt=y.startDate&&y.endDate&&Re.date>=y.startDate&&Re.date<=y.endDate;return jsx("button",{className:d("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!Re.isCurrentMonth&&(c?"text-[#4B5563]":"text-gray-300"),Re.isCurrentMonth&&(c?"text-white":"text-gray-900"),va&&"ring-2 ring-[#3B82F6]",wa&&"bg-[#3B82F6] text-white",Kt&&!wa&&"bg-[#7C3AED] text-white",Yt&&!je&&(c?"bg-[#7C3AED]/20":"bg-purple-100"),!je&&(c?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{let ga=new Date(Re.date);if(W==="start"){let Ar=y.endDate&&ga>y.endDate?ga:y.endDate;ze(ga,Ar),O("end");}else {let Ar=y.startDate&&ga<y.startDate?ga:y.startDate;ze(Ar,ga),O(null);}},children:Re.day},gt)})})()})]})]})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Flag,{className:d("w-4 h-4",c?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:d("text-sm w-24",c?"text-[#9CA3AF]":"text-gray-500"),children:f==="es"?"Prioridad":"Priority"}),jsx("button",{onClick:()=>{H(),L(!R);},className:d("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",y.priority==="high"||y.priority==="urgent"?"bg-red-500/20 text-red-400":y.priority==="medium"?"bg-yellow-500/20 text-yellow-400":y.priority==="low"?"bg-green-500/20 text-green-400":c?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:y.priority?y.priority==="high"||y.priority==="urgent"?f==="es"?"Urgente":"Urgent":y.priority==="medium"?f==="es"?"Media":"Medium":f==="es"?"Baja":"Low":f==="es"?"Sin prioridad":"No priority"}),jsx(AnimatePresence,{children:R&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>L(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:d("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",c?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:f==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:f==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:f==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:f==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:f==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(M=>jsxs("button",{onClick:()=>{pe("priority",M.id),L(false);},className:d("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",c?"hover:bg-white/5":"hover:bg-gray-50",y.priority===M.id&&(c?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:d("w-2 h-2 rounded-full",M.color)}),jsx("span",{className:c?"text-white":"text-gray-900",children:M.label})]},M.id||"none"))})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:d("w-4 h-4",c?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:d("text-sm w-24",c?"text-[#9CA3AF]":"text-gray-500"),children:f==="es"?"Duraci\xF3n":"Duration"}),jsx("span",{className:d("text-sm",c?"text-white":"text-gray-900"),children:y.startDate&&y.endDate?`${Math.ceil((y.endDate.getTime()-y.startDate.getTime())/(1e3*60*60*24))} ${f==="es"?"d\xEDas":"days"}`:f==="es"?"Sin definir":"Not set"})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:d("w-4 h-4 rounded-full border-2",c?"border-[#6B7280]":"border-gray-400")}),jsx("span",{className:d("text-sm w-24",c?"text-[#9CA3AF]":"text-gray-500"),children:f==="es"?"Progreso":"Progress"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[z?jsx("input",{type:"range",min:"0",max:"100",step:"5",value:y.progress||0,onChange:M=>{let V=parseInt(M.target.value),Me=y.status;V===100?Me="completed":V>0?Me="in-progress":Me="todo";let Ye={...y,progress:V,status:Me};I(Ye),a.onTaskUpdate?.(Ye);},onBlur:()=>ve(false),className:d("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",c?"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:()=>ve(true),className:d("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",c?"bg-white/10":"bg-gray-200"),children:jsx("div",{className:d("h-full rounded-full transition-all",y.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${y.progress||0}%`}})}),jsxs("span",{className:d("text-sm font-medium min-w-[40px]",c?"text-white":"text-gray-900"),children:[y.progress||0,"%"]})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Tag,{className:d("w-4 h-4",c?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:d("text-sm w-24",c?"text-[#9CA3AF]":"text-gray-500"),children:f==="es"?"Etiquetas":"Tags"}),jsx(br,{selectedTags:y.tags||[],availableTags:g,onChange:M=>{pe("tags",M);},onCreateTag:i,theme:N})]}),jsxs("div",{className:"flex items-start gap-3 relative",children:[jsx(Link2,{className:d("w-4 h-4 mt-1.5",c?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:d("text-sm w-24 mt-1",c?"text-[#9CA3AF]":"text-gray-500"),children:f==="es"?"Relaciones":"Relations"}),jsxs("div",{className:"flex-1",children:[y.dependencies&&y.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:y.dependencies.map(M=>{let V=e.find(Me=>Me.id===M);return jsxs("span",{className:d("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",c?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[V?.name||M.slice(0,8),jsx("button",{onClick:()=>{let Me=(y.dependencies||[]).filter(Ye=>Ye!==M);pe("dependencies",Me);},className:d("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsx(X,{className:"w-3 h-3"})})]},M)})}),jsxs("button",{onClick:()=>{H(),Se(!jt);},className:d("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",c?"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:d("text-sm",c?"text-[#9CA3AF]":"text-gray-500"),children:f==="es"?"Agregar dependencia":"Add dependency"})]}),jsx(AnimatePresence,{children:jt&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Se(false),ua("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:d("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",c?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsx("div",{className:d("p-2 border-b",c?"border-white/10":"border-gray-200"),children:jsx("input",{type:"text",value:Ve,onChange:M=>ua(M.target.value),placeholder:f==="es"?"Buscar tarea...":"Search task...",className:d("w-full px-3 py-2 rounded-md text-sm outline-none",c?"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(M=>M.id!==y.id).filter(M=>Ve===""||M.name.toLowerCase().includes(Ve.toLowerCase())).map(M=>{let V=y.dependencies?.includes(M.id);return jsxs("button",{onClick:()=>{let Me=y.dependencies||[],Ye;V?Ye=Me.filter(Pt=>Pt!==M.id):Ye=[...Me,M.id],pe("dependencies",Ye);},className:d("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",c?"hover:bg-white/5":"hover:bg-gray-50",V&&(c?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:d("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",V?"bg-blue-500 border-blue-500":c?"border-white/30":"border-gray-300"),children:V&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:d("block truncate",c?"text-white":"text-gray-900"),children:M.name}),jsx("span",{className:d("text-xs",c?"text-[#6B7280]":"text-gray-400"),children:M.id.slice(0,8)})]})]},M.id)}):jsx("div",{className:d("px-3 py-4 text-sm text-center",c?"text-[#6B7280]":"text-gray-500"),children:f==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Palette,{className:d("w-4 h-4",c?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:d("text-sm w-24",c?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxs("button",{onClick:()=>{H(),Ke(!Ze);},className:d("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",c?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:y.color||"#6366F1"}}),jsx("span",{className:d("text-sm",c?"text-white":"text-gray-900"),children:hr.find(M=>M.value===y.color)?.name||(f==="es"?"Azul":"Blue")}),jsx(ChevronDown,{className:d("w-3 h-3",c?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:Ze&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ke(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:d("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",c?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-6 gap-1.5",children:hr.map(M=>{let V=y.color===M.value;return jsx("button",{onClick:()=>{pe("color",M.value),Ke(false);},className:d("w-7 h-7 rounded-full flex items-center justify-center transition-all",V&&"ring-2 ring-offset-2",c?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:M.value,outlineColor:V?M.value:void 0},title:M.name,children:V&&jsx(Check,{className:"w-3.5 h-3.5 text-white"})},M.value)})})})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Diamond,{className:d("w-4 h-4",c?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:d("text-sm w-24",c?"text-[#9CA3AF]":"text-gray-500"),children:f==="es"?"Hito":"Milestone"}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",checked:y.isMilestone||false,onChange:M=>pe("isMilestone",M.target.checked),className:d("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",y.isMilestone?"bg-purple-500 border-purple-500":c?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsx("span",{className:d("text-sm",c?"text-white":"text-gray-900"),children:f==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxs("div",{className:d("mt-6 pt-4 border-t",c?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsx(FileText,{className:d("w-4 h-4",c?"text-[#6B7280]":"text-gray-400")}),jsx("h3",{className:d("text-sm font-semibold",c?"text-white":"text-gray-900"),children:f==="es"?"Descripci\xF3n":"Description"})]}),jsx("textarea",{value:y.description||"",onChange:M=>pe("description",M.target.value),placeholder:f==="es"?"Agregar descripci\xF3n...":"Add description...",className:d("w-full min-h-[100px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors",c?"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:d("flex items-center gap-2 text-sm mt-2 transition-colors",c?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsx(Sparkles,{className:"w-4 h-4"}),f==="es"?"Escribe con IA":"Write with AI"]})]}),jsxs("div",{className:d("mt-6 pt-4 border-t",c?"border-white/10":"border-gray-200"),children:[jsx("h3",{className:d("text-sm font-semibold mb-3",c?"text-white":"text-gray-900"),children:f==="es"?"Campos personalizados":"Custom fields"}),jsxs("button",{className:d("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",c?"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"}),f==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxs("div",{className:d("mt-6 pt-4 border-t",c?"border-white/10":"border-gray-200"),children:[jsx("h3",{className:d("text-sm font-semibold mb-3",c?"text-white":"text-gray-900"),children:f==="es"?"Agregar subtarea":"Add subtask"}),y.subtasks&&y.subtasks.length>0&&jsx("div",{className:"space-y-2 mb-3",children:y.subtasks.map(M=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:d("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",M.progress===100?"bg-green-500 border-green-500":c?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:M.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("span",{className:d("text-sm",M.progress===100?"line-through text-[#6B7280]":c?"text-white":"text-gray-900"),children:M.name})]},M.id))}),jsxs("button",{className:d("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",c?"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"}),f==="es"?"Add Tarea":"Add Task"]})]}),jsxs("div",{className:d("mt-6 pt-4 border-t",c?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("h3",{className:d("text-sm font-semibold",c?"text-white":"text-gray-900"),children:f==="es"?"Listas de control":"Checklists"}),jsx("button",{className:d("p-1 rounded transition-colors",c?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsx(Plus,{className:"w-4 h-4"})})]}),jsxs("button",{className:d("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",c?"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"}),f==="es"?"Crear lista de control":"Create checklist"]})]}),jsxs("div",{className:d("mt-6 pt-4 border-t",c?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:d("text-sm font-semibold mb-3",c?"text-white":"text-gray-900"),children:[f==="es"?"Adjuntos":"Attachments",ct.length>0&&jsxs("span",{className:d("ml-2 text-xs font-normal",c?"text-[#6B7280]":"text-gray-400"),children:["(",ct.length,")"]})]}),ct.length>0&&jsx("div",{className:"space-y-2 mb-4",children:ct.map(M=>{let V=$a(M.type),Me=M.type.startsWith("image/");return jsxs("div",{className:d("flex items-center gap-3 p-2 rounded-lg group transition-colors",c?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[Me&&M.thumbnailUrl?jsx("img",{src:M.thumbnailUrl,alt:M.name,className:"w-10 h-10 rounded object-cover"}):jsx("div",{className:d("w-10 h-10 rounded flex items-center justify-center",c?"bg-white/10":"bg-gray-200"),children:jsx(V,{className:d("w-5 h-5",c?"text-[#9CA3AF]":"text-gray-500")})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("a",{href:M.url,target:"_blank",rel:"noopener noreferrer",className:d("text-sm font-medium truncate block hover:underline",c?"text-white":"text-gray-900"),children:M.name}),jsx("p",{className:d("text-xs",c?"text-[#6B7280]":"text-gray-400"),children:ya(M.size)})]}),a.onDeleteAttachment&&jsx("button",{onClick:()=>a.onDeleteAttachment?.(M.id),className:d("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",c?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:f==="es"?"Eliminar":"Delete",children:jsx(Trash2,{className:"w-4 h-4"})})]},M.id)})}),jsxs("div",{onDragOver:Ft,onDragLeave:rt,onDrop:le,className:d("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",Ue?c?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":c?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",ut&&"pointer-events-none opacity-50"),children:[jsx("input",{type:"file",multiple:true,onChange:He,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!a.onUploadAttachments||ut}),ut?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:d("text-sm",c?"text-[#9CA3AF]":"text-gray-500"),children:f==="es"?"Subiendo...":"Uploading..."})]}):jsxs(Fragment,{children:[jsx(Upload,{className:d("w-6 h-6 mx-auto mb-2",Ue?"text-blue-500":c?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:d("text-sm",c?"text-[#9CA3AF]":"text-gray-500"),children:Ue?f==="es"?"Suelta los archivos aqu\xED":"Drop files here":f==="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:d("text-xs mt-1",c?"text-[#6B7280]":"text-gray-400"),children:f==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxs("div",{className:d("w-80 border-l flex flex-col",c?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsx("div",{className:d("px-4 py-3 border-b",c?"border-white/10":"border-gray-200"),children:jsxs("h3",{className:d("text-sm font-semibold",c?"text-white":"text-gray-900"),children:[f==="es"?"Actividad":"Activity",l&&l.length>0&&jsxs("span",{className:d("ml-2 text-xs font-normal",c?"text-[#6B7280]":"text-gray-400"),children:["(",l.length,")"]})]})}),jsx("div",{className:"flex-1 overflow-y-auto p-4",children:l&&l.length>0?jsx("div",{className:"space-y-4",children:l.map(M=>{let V=(()=>{let Me=new Date,Ye=new Date(M.createdAt),Pt=Me.getTime()-Ye.getTime(),de=Math.floor(Pt/6e4),We=Math.floor(de/60),vt=Math.floor(We/24);return de<1?f==="es"?"ahora":"now":de<60?f==="es"?`hace ${de}m`:`${de}m ago`:We<24?f==="es"?`hace ${We}h`:`${We}h ago`:f==="es"?`hace ${vt}d`:`${vt}d ago`})();return jsxs("div",{className:"flex gap-3",children:[jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:"#8B5CF6"},children:M.user?.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsx("span",{className:d("text-sm font-medium",c?"text-white":"text-gray-900"),children:M.user?.name||(f==="es"?"Usuario":"User")}),jsx("span",{className:d("text-xs",c?"text-[#6B7280]":"text-gray-400"),children:V})]}),jsx("p",{className:d("text-sm break-words",c?"text-[#9CA3AF]":"text-gray-600"),children:M.content})]})]},M.id)})}):jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsx(MessageSquare,{className:d("w-10 h-10 mb-3",c?"text-[#3B4252]":"text-gray-300")}),jsx("p",{className:d("text-sm",c?"text-[#6B7280]":"text-gray-500"),children:f==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsx("div",{className:d("p-4 border-t",c?"border-white/10":"border-gray-200"),children:jsxs("div",{className:"flex items-start gap-2",children:[v&&jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:v.color||"#8B5CF6"},children:v.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:d("flex-1 flex items-center gap-2 px-3 py-2 rounded-lg",c?"bg-white/5":"bg-white border border-gray-200"),children:[jsx("input",{type:"text",value:F,onChange:M=>Te(M.target.value),onKeyDown:async M=>{if(M.key==="Enter"&&!M.shiftKey&&y&&F.trim()&&b){M.preventDefault(),ke(true);try{await b(y.id,F.trim()),Te("");}finally{ke(false);}}},placeholder:f==="es"?"Escribe un comentario...":"Write a comment...",disabled:Z||!b,className:d("flex-1 bg-transparent text-sm outline-none",c?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400",(Z||!b)&&"opacity-50")}),jsx("button",{onClick:async()=>{if(y&&F.trim()&&b){ke(true);try{await b(y.id,F.trim()),Te("");}finally{ke(false);}}},disabled:Z||!F.trim()||!b,className:d("p-1.5 rounded transition-colors",F.trim()&&b?"bg-blue-500 text-white hover:bg-blue-600":c?"text-[#6B7280]":"text-gray-400",Z&&"opacity-50 cursor-not-allowed"),children:Z?jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsx(Send,{className:"w-4 h-4"})})]})]})})]})]})]})}),jsx(AnimatePresence,{children:P&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>T(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:d("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",c?"bg-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:d("px-4 py-3 border-b flex items-center justify-between",c?"border-white/10":"border-gray-200"),children:[jsx("span",{className:d("font-medium",c?"text-white":"text-gray-900"),children:P.date.toLocaleDateString(f==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsx("button",{onClick:()=>T(null),className:d("p-1 rounded",c?"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:P.events.map(M=>jsxs("button",{onClick:()=>{T(null),I(M.task),C?.(M.task.id);},className:d("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",c?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx(fp,{task:M.task}),jsx("span",{className:d("text-sm truncate flex-1",c?"text-white":"text-gray-900"),children:M.title}),M.task.priority==="high"||M.task.priority==="urgent"?jsx(Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},M.id))})]})]})})]})}var xl={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"},kl={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"},wl={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"},hs={dark:xl,light:kl,neutral:wl};function yp(e){return hs[e]||hs.dark}function cv({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:m}){let[g,i]=useState(false),p=useMemo(()=>t.filter(v=>e.cardIds.includes(v.id)),[t,e.cardIds]),l=useMemo(()=>{let v=p.length,k=new Set(p.flatMap(f=>f.assignedUserIds||[])).size,C=p.map(f=>f.priority).filter(Boolean),h=new Set(p.flatMap(f=>f.labels||[])).size;return {totalCards:v,uniqueAssignees:k,priorities:C,labels:h}},[p]),b=()=>{o?.(e.id);};return jsxs("div",{className:d("card-stack",!e.isExpanded&&"card-stack-collapsed",m),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxs("div",{className:"card-stack-header",onClick:b,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:d("card-stack-chevron",e.isExpanded&&"expanded"),children:jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsx("h3",{className:"card-stack-title",children:e.title}),jsx("div",{className:"card-stack-badge",children:l.totalCards}),jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),g&&jsx("div",{className:"card-stack-actions",children:jsx("button",{className:"card-stack-action",onClick:v=>{v.stopPropagation(),n?.(e.id);},"aria-label":"Delete stack",children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxs("div",{className:"card-stack-summary",children:[jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxs("span",{children:[l.uniqueAssignees," assignees"]})]}),l.labels>0&&jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxs("span",{children:[l.labels," labels"]})]}),e.confidence&&jsx("div",{className:"card-stack-summary-item",children:jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsx("div",{className:"card-stack-content",children:p.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:p.map(v=>jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsx("div",{onClick:()=>r?.(v),children:a(v)}):jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(v),children:[jsx("h4",{children:v.title}),v.description&&jsxs("p",{children:[v.description.substring(0,100),"..."]})]}),jsx("button",{className:"card-stack-unstack-btn",onClick:k=>{k.stopPropagation(),s?.(e.id,v.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"})]})})]},v.id))})})]})}var xp={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function dn(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 cn(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 kp(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 wp({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:m}){let g=useMemo(()=>({...xp,...n}),[n]),[i,p]=useState(new Set),l=useRef(null),b=useMemo(()=>{if(!g.groupByDay)return [{date:null,events:e}];let u=new Map;return e.forEach(x=>{let c=x.timestamp.toISOString().split("T")[0],N=u.get(c);N?N.push(x):u.set(c,[x]);}),Array.from(u.entries()).sort((x,c)=>c[0].localeCompare(x[0])).map(([x,c])=>({date:new Date(x),events:c.sort((N,w)=>w.timestamp.getTime()-N.timestamp.getTime())}))},[e,g.groupByDay]),{uniqueUsers:v,uniqueTypes:k}=useMemo(()=>{let u=new Set,x=new Set;return e.forEach(c=>{u.add(c.userId),x.add(c.type);}),{uniqueUsers:Array.from(u),uniqueTypes:Array.from(x)}},[e]),C=u=>{p(x=>{let c=new Set(x);return c.has(u)?c.delete(u):c.add(u),c});},h=u=>{let c=new Date().getTime()-u.getTime(),N=Math.floor(c/6e4),w=Math.floor(c/36e5),B=Math.floor(c/864e5);return N<1?"just now":N<60?`${N}m ago`:w<24?`${w}h ago`:B<7?`${B}d ago`:u.toLocaleDateString()},f=useMemo(()=>{let u=0;return t.types&&t.types.length>0&&u++,t.users&&t.users.length>0&&u++,t.dateRange&&u++,t.searchTerm&&u++,u},[t]);return useEffect(()=>{if(s&&l.current){let u=l.current.querySelector(`[data-event-id="${s}"]`);u&&u.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxs("div",{className:d("history-timeline-empty",m),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:d("history-timeline",g.compact&&"compact",m),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:u=>{let x=u.target.value;a({...t,types:x?[x]:void 0});},children:[jsx("option",{value:"",children:"All Events"}),k.map(u=>jsxs("option",{value:u,children:[cn(u)," ",u.replace("_"," ")]},u))]}),v.length>1&&jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:u=>{let x=u.target.value;a({...t,users:x?[x]:void 0});},children:[jsx("option",{value:"",children:"All Users"}),v.map(u=>jsx("option",{value:u,children:u},u))]}),jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:u=>a({...t,searchTerm:u.target.value})})]}),f>0&&jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",f,")"]})]}),jsx("div",{className:"history-timeline-container",ref:l,children:b.map(u=>jsxs("div",{className:"history-timeline-group",children:[g.groupByDay&&u.date&&jsxs("div",{className:"history-timeline-day-header",children:[jsx("span",{className:"history-timeline-day-date",children:u.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxs("span",{className:"history-timeline-day-count",children:[u.events.length," events"]})]}),jsx("div",{className:"history-timeline-events",children:u.events.map((x,c)=>{let N=i.has(x.id),w=s===x.id,B=kp(x.type);return jsxs("div",{"data-event-id":x.id,className:d("history-timeline-event",N&&"expanded",w&&"selected"),onClick:()=>o?.(x),children:[jsxs("div",{className:"history-timeline-line",children:[jsx("div",{className:"history-timeline-dot",style:{backgroundColor:B},children:g.showIcons&&jsx("span",{className:"history-timeline-dot-icon",children:cn(x.type)})}),c<u.events.length-1&&jsx("div",{className:"history-timeline-connector",style:{borderColor:B}})]}),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:[g.showAvatars&&x.userAvatar&&jsx("img",{src:x.userAvatar,alt:x.userName||x.userId,className:"history-timeline-event-avatar"}),jsxs("div",{className:"history-timeline-event-description",children:[jsx("span",{className:"history-timeline-event-user",children:x.userName||x.userId}),jsx("span",{className:"history-timeline-event-action",children:dn(x)})]})]}),jsx("div",{className:"history-timeline-event-time",children:g.useRelativeTime?h(x.timestamp):x.timestamp.toLocaleString()})]}),Object.keys(x.changes).length>0&&jsxs("button",{className:"history-timeline-event-toggle",onClick:y=>{y.stopPropagation(),C(x.id);},children:[N?"\u25BC":"\u25B6"," Show changes"]}),N&&jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(x.changes).map(([y,I])=>jsxs("div",{className:"history-timeline-event-change",children:[jsxs("span",{className:"history-timeline-event-change-key",children:[y,":"]}),jsxs("div",{className:"history-timeline-event-change-values",children:[jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(I.from)}),jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(I.to)})]})]},y)),x.metadata&&Object.keys(x.metadata).length>0&&jsxs("div",{className:"history-timeline-event-metadata",children:[jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(x.metadata).map(([y,I])=>jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxs("span",{className:"history-timeline-event-metadata-key",children:[y,":"]}),jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(I)})]},y))]})]})]})]},x.id)})})]},u.date?.toISOString()||"all"))})]})}function Tp({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:m,onSpeedChange:g,className:i}){let p=[.5,1,1.5,2,3],l=useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),b=useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxs("div",{className:d("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:d("history-replay",i),children:[jsxs("div",{className:"history-replay-current-event",children:[jsx("div",{className:"history-replay-event-icon",children:l&&cn(l.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:l&&dn(l)}),jsxs("div",{className:"history-replay-event-meta",children:[jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsx("span",{className:"history-replay-event-time",children:l&&l.timestamp.toLocaleString()})]})]})]}),jsxs("div",{className:"history-replay-progress-container",children:[jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:v=>m(parseInt(v.target.value))}),jsx("div",{className:"history-replay-progress-fill",style:{width:`${b}%`}}),jsx("div",{className:"history-replay-progress-markers",children:t.map((v,k)=>jsx("div",{className:d("history-replay-progress-marker",k===e.currentIndex&&"active"),style:{left:`${k/(e.totalEvents-1)*100}%`},onClick:()=>m(k),title:dn(v)},v.id))})]}),jsxs("div",{className:"history-replay-controls",children:[jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:o,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsx("button",{className:"history-replay-control-btn",onClick:n,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxs("div",{className:"history-replay-speed",children:[jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsx("div",{className:"history-replay-speed-buttons",children:p.map(v=>jsxs("button",{className:d("history-replay-speed-btn",e.speed===v&&"active"),onClick:()=>g(v),children:[v,"x"]},v))})]}),jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxs("div",{className:"history-replay-shortcuts",children:[jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2190"})," Previous"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2192"})," Next"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxs("div",{className:"history-replay-card-preview",children:[jsxs("div",{className:"history-replay-card-preview-header",children:[jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsx("span",{className:"history-replay-card-preview-time",children:l&&l.timestamp.toLocaleDateString()})]}),jsxs("div",{className:"history-replay-card-preview-content",children:[jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(v=>jsx("span",{className:"history-replay-card-preview-label-tag",children:v},v))})]})]})]})]}):jsxs("div",{className:d("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 Cl(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 Tl(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 Np(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 Dp(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function bv(e,t,a,r,o,s=100){let n=e.map(g=>({...g,x:g.x??a/2+Math.random()*100-50,y:g.y??r/2+Math.random()*100-50,vx:0,vy:0})),m=new Map(n.map(g=>[g.id,g]));for(let g=0;g<s;g++){let i=1-g/s;n.forEach(p=>{let l=a/2,b=r/2;p.vx+=(l-p.x)*o.centerForce*i,p.vy+=(b-p.y)*o.centerForce*i,n.forEach(v=>{if(p.id===v.id)return;let k=p.x-v.x,C=p.y-v.y,h=Math.sqrt(k*k+C*C)||1,f=o.chargeStrength*i/(h*h);p.vx+=k/h*f,p.vy+=C/h*f;});}),t.forEach(p=>{let l=m.get(typeof p.source=="string"?p.source:p.source.id),b=m.get(typeof p.target=="string"?p.target:p.target.id);if(!l||!b)return;let v=b.x-l.x,k=b.y-l.y,C=Math.sqrt(v*v+k*k)||1,h=(C-o.linkDistance)/C*o.forceStrength*i;l.vx+=v*h,l.vy+=k*h,b.vx-=v*h,b.vy-=k*h;}),n.forEach(p=>{p.fx!==null&&p.fx!==void 0?(p.x=p.fx,p.vx=0):p.x+=p.vx,p.fy!==null&&p.fy!==void 0?(p.y=p.fy,p.vy=0):p.y+=p.vy,p.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,p.x)),p.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,p.y)),p.vx*=.9,p.vy*=.9;});}return n}function Sp({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:m,className:g}){let i=useRef(null),[p,l]=useState([]),[b,v]=useState(null),[k,C]=useState(null),[h,f]=useState(null),[u,x]=useState(1),[c,N]=useState({x:0,y:0});useEffect(()=>{if(e.length===0)return;let O=bv(e,t,a.width,a.height,a,150);l(O);},[e,t,a]);let w=useCallback((O,q)=>{a.enableDragging&&(q.stopPropagation(),v(O));},[a.enableDragging]),B=useCallback(O=>{if(!b||!i.current)return;let te=i.current.getBoundingClientRect(),ne=(O.clientX-te.left-c.x)/u,oe=(O.clientY-te.top-c.y)/u;l(ce=>ce.map(be=>be.id===b?{...be,x:ne,y:oe,fx:ne,fy:oe}:be));},[b,u,c]),y=useCallback(()=>{v(null);},[]),I=useCallback((O,q)=>{q.stopPropagation(),m?.({type:"node-click",node:O,position:{x:q.clientX,y:q.clientY}});},[m]),P=useCallback((O,q)=>{q.stopPropagation(),m?.({type:"edge-click",edge:O,position:{x:q.clientX,y:q.clientY}});},[m]),T=useCallback(O=>{let q=p.find(te=>te.id===O);return q?{x:q.x,y:q.y}:{x:0,y:0}},[p]),W=useCallback(O=>{if(O.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return O.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let q=O.card.priority;return q==="URGENT"?"#ef4444":q==="HIGH"?"#f59e0b":q==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return O.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxs("div",{className:d("relationships-graph-empty",g),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:d("relationships-graph",g),children:[jsxs("div",{className:"relationships-graph-controls",children:[jsxs("div",{className:"relationships-graph-stats",children:[jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:n.totalNodes}),jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:n.totalEdges}),jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>x(O=>Math.min(O+.2,3)),children:"+"}),jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(u*100),"%"]}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>x(O=>Math.max(O-.2,.5)),children:"\u2212"}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{x(1),N({x:0,y:0});},children:"Reset"})]})]}),jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(O=>O.type))).map(O=>jsxs("div",{className:"relationships-graph-legend-item",children:[jsx("div",{className:"relationships-graph-legend-color",style:{background:Cl(O)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[Np(O)," ",Tl(O)]})]},O))}),jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:B,onMouseUp:y,onMouseLeave:y,children:[jsxs("g",{transform:`translate(${c.x}, ${c.y}) scale(${u})`,children:[jsx("g",{className:"relationships-graph-edges",children:t.map(O=>{let q=T(typeof O.source=="string"?O.source:O.source.id),te=T(typeof O.target=="string"?O.target:O.target.id),ne=Dp(O.type),oe=h===O.id,ce=O.onCriticalPath;return jsxs("g",{className:d("relationships-graph-edge",oe&&"hovered",ce&&"critical"),onMouseEnter:()=>f(O.id),onMouseLeave:()=>f(null),onClick:be=>P(O,be),children:[jsx("line",{x1:q.x,y1:q.y,x2:te.x,y2:te.y,stroke:Cl(O.type),strokeWidth:ce?a.edgeWidth*2:a.edgeWidth,strokeOpacity:oe?1:.6,markerEnd:ne?"url(#arrowhead)":void 0}),a.showEdgeLabels&&oe&&jsx("text",{x:(q.x+te.x)/2,y:(q.y+te.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Tl(O.type)})]},O.id)})}),jsx("g",{className:"relationships-graph-nodes",children:p.map(O=>{let q=k===O.id,te=O.onCriticalPath;return jsxs("g",{className:d("relationships-graph-node",q&&"hovered",te&&"critical"),transform:`translate(${O.x}, ${O.y})`,onMouseDown:ne=>w(O.id,ne),onMouseEnter:()=>C(O.id),onMouseLeave:()=>C(null),onClick:ne=>I(O,ne),children:[jsx("circle",{r:te?a.nodeSize*1.2:a.nodeSize,fill:W(O),stroke:te?"#fbbf24":"#ffffff",strokeWidth:te?3:2,opacity:q?1:.9}),a.showLabels&&jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:O.card.title.length>20?O.card.title.substring(0,20)+"...":O.card.title})]},O.id)})})]}),jsx("defs",{children:jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function Mp({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=useState(""),[m,g]=useState(false),[i,p]=useState(null),[l,b]=useState(null),v=useRef(null),k=m||o;useEffect(()=>{e&&v.current&&v.current.focus();},[e]),useEffect(()=>{let u=x=>{x.key==="Escape"&&!k&&C();};if(e)return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[e,k]);let C=()=>{k||(n(""),p(null),b(null),t());},h=async()=>{if(!(!s.trim()||k)){g(true),p(null),b(null);try{let u=await r(s.trim());b(u);}catch(u){p(u instanceof Error?u.message:"Failed to generate plan");}finally{g(false);}}},f=()=>{l&&(a(l),C());};return e?jsxs(ft,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:C}),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:u=>u.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:C,disabled:k,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:l?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),l.explanation&&jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsx("p",{className:"text-sm text-white/90",children:l.explanation})}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",l.columns.length,")"]}),jsx("div",{className:"flex gap-2 flex-wrap",children:l.columns.map((u,x)=>jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:u.title},x))})]}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",l.cards.length,")"]}),jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[l.cards.slice(0,10).map((u,x)=>jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsx("p",{className:"text-sm font-medium text-white/90",children:u.title}),u.description&&jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:u.description})]}),u.priority&&jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${u.priority==="URGENT"?"bg-red-500/20 text-red-400":u.priority==="HIGH"?"bg-orange-500/20 text-orange-400":u.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:u.priority})]})},x)),l.cards.length>10&&jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",l.cards.length-10," more tasks..."]})]})]})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsx("textarea",{ref:v,value:s,onChange:u=>n(u.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:k}),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((u,x)=>jsx("button",{onClick:()=>n(u),disabled:k,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:u},x))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:k&&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:C,disabled:k,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),l?jsx("button",{onClick:f,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsx("button",{onClick:h,disabled:!s.trim()||k,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:k?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Nl={"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 yv={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},vv={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 xv(e,t,a){let r=Nl[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function mn(e){return `$${e.toFixed(4)}`}var Dl=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=xv(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(l=>l.timestamp>=t.start&&l.timestamp<=t.end));let r=a.length,o=a.reduce((l,b)=>l+b.cost,0),s=a.reduce((l,b)=>l+b.inputTokens,0),n=a.reduce((l,b)=>l+b.outputTokens,0),m=a.filter(l=>l.success),g=a.reduce((l,b)=>l+b.duration,0),i={},p={};return a.forEach(l=>{i[l.feature]=(i[l.feature]||0)+1,p[l.feature]=(p[l.feature]||0)+l.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:p,averageDuration:r>0?g/r:0,successRate:r>0?m.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,n=new Date;a==="month"?n.setMonth(s.getMonth()-1):n.setDate(s.getDate()-1);let m=this.operations.filter(p=>p.timestamp>=n).length,g=Math.max(0,o-m),i=m/o*100;return {used:m,limit:o,remaining:g,percentUsed:i,isExceeded:m>=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)}},fo=new Dl;function Lp({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=useState(fo.getStats()),[s,n]=useState(fo.checkLimit(a));if(useEffect(()=>{if(!e)return;let g=setInterval(()=>{o(fo.getStats()),n(fo.checkLimit(a));},1e3);return ()=>clearInterval(g)},[e,a]),useEffect(()=>{let g=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[e,t]),!e)return null;let m=fo.getRecentOperations(5);return jsxs(ft,{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: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:[jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-blue-500/10 to-purple-500/10 border border-blue-500/30",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:mn(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(([g,i])=>{let p=r.costsByFeature[g]||0,l=r.totalOperations>0?i/r.totalOperations*100:0;return jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:g.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:mn(p)})]})]}),jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full bg-blue-500",style:{width:`${l}%`}})})]},g)})})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),m.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:m.map(g=>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:g.feature.replace(/([A-Z])/g," $1").trim()}),jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(g.timestamp).toLocaleTimeString()," \u2022"," ",g.duration,"ms"]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[g.inputTokens+g.outputTokens," tokens"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:mn(g.cost)}),jsx("div",{className:`w-2 h-2 rounded-full ${g.success?"bg-green-400":"bg-red-400"}`})]})]},g.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:s}){let[n,m]=useState(""),[g,i]=useState(""),[p,l]=useState(""),[b,v]=useState(false),[k,C]=useState(null),[h,f]=useState(null),[u,x]=useState(null),c=useRef(null),N=b||o;useEffect(()=>{e&&c.current&&c.current.focus();},[e]),useEffect(()=>{let P=T=>{T.key==="Escape"&&!N&&w();};if(e)return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[e,N]);let w=()=>{N||(m(""),i(""),l(""),C(null),f(null),x(null),t());},B=async()=>{if(!(!n.trim()||N)){v(true),C(null),f(null),x(null);try{let P=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:g||void 0,endDate:p||void 0});f(P.tasks.tasks),x({from_cache:P.from_cache,tokens_used:P.tokens_used,mock_mode:P.mock_mode,similarity:P.similarity,tokens_saved:P.tokens_saved});}catch(P){C(P instanceof Error?P.message:"Failed to generate tasks");}finally{v(false);}}},y=()=>{h&&(a(h),w());};if(!e)return null;let I=u?.similarity?((u.similarity||0)*100).toFixed(0):"0";return jsxs(ft,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:w}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:P=>P.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-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:w,disabled:N,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:h?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxs("div",{className:"flex flex-wrap gap-2",children:[u?.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"}),u?.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 (",I,"% 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:[u?.tokens_used||0," tokens"]}),u?.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:[u.tokens_saved," tokens saved"]}),jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[h.length," tasks"]})]}),jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:h.map((P,T)=>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:["#",T+1]}),jsx("p",{className:"text-sm font-medium text-white/90",children:P.name})]}),jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[jsxs("span",{className:"flex items-center gap-1",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-white/40",children:[jsx("rect",{x:"1",y:"2",width:"10",height:"8",rx:"1",stroke:"currentColor"}),jsx("path",{d:"M1 4h10",stroke:"currentColor"})]}),P.start," \u2192 ",P.end]}),jsxs("span",{children:[P.duration," days"]}),P.dependencies.length>0&&jsxs("span",{className:"text-blue-400",children:["Depends: ",P.dependencies.join(", ")]})]})]}),jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${P.priority==="high"?"bg-red-500/20 text-red-400":P.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:P.priority})]})},P.id))})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsx("textarea",{ref:c,value:n,onChange:P=>m(P.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-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:g,onChange:P=>i(P.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-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:p,onChange:P=>l(P.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:N})]})]}),k&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:k}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((P,T)=>jsx("button",{onClick:()=>m(P),disabled:N,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:P},T))})]})]})}),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:w,disabled:N,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),h?jsx("button",{onClick:y,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsx("button",{onClick:B,disabled:!n.trim()||N,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:N?"Generating...":"Generate Tasks"})]})]})]})})]})}function xs({initialBoard:e,onPersist:t}){let[a,r]=useState(e),o=useCallback(h=>{t&&kn(()=>Promise.resolve(t(h)),{maxAttempts:3,initialDelay:1e3,onRetry:(f,u,x)=>{console.warn(`Retry attempt ${u} after ${x}ms: ${f.message}`);}}).then(f=>{f.success||console.error(`Failed to persist board after ${f.attempts} attempts:`,f.error);});},[t]),s=useCallback(async(h,f,u)=>{r(x=>{let c=x.cards.find(P=>P.id===h);if(!c)return x;let N=c.columnId,w={...c,columnId:f,position:u},B=x.cards.map(P=>P.id===h?w:P),y=x.columns.map(P=>{if(P.id===N)return {...P,cardIds:P.cardIds.filter(T=>T!==h)};if(P.id===f){let T=B.filter(W=>W.columnId===f).sort((W,O)=>W.position-O.position);return {...P,cardIds:T.map(W=>W.id)}}return P}),I={...x,cards:B,columns:y};return o(I),I});},[o]),n=useCallback(async(h,f)=>{r(u=>{let x=u.cards.map(N=>N.id===h?{...N,...f}:N),c={...u,cards:x};return o(c),c});},[o]),m=useCallback(async h=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(u=>{let x={...h,id:f},c=u.columns.map(w=>w.id===h.columnId?{...w,cardIds:[...w.cardIds,f]}:w),N={...u,cards:[...u.cards,x],columns:c};return o(N),N});},[o]),g=useCallback(async h=>{r(f=>{let u=f.cards.find(w=>w.id===h);if(!u)return f;let x=f.cards.filter(w=>w.id!==h),c=f.columns.map(w=>w.id===u.columnId?{...w,cardIds:w.cardIds.filter(B=>B!==h)}:w),N={...f,cards:x,columns:c};return o(N),N});},[o]),i=useCallback(async h=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(u=>{let x={...h,id:f,cardIds:[]},c={...u,columns:[...u.columns,x]};return o(c),c});},[o]),p=useCallback(async(h,f)=>{r(u=>{let x=u.columns.map(N=>N.id===h?{...N,...f}:N),c={...u,columns:x};return o(c),c});},[o]),l=useCallback(async h=>{r(f=>{let u=f.cards.filter(N=>N.columnId!==h),x=f.columns.filter(N=>N.id!==h),c={...f,cards:u,columns:x};return o(c),c});},[o]),b=useCallback(h=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return m(h),f},[m]),v=useCallback(h=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(h),f},[i]),k=useCallback(()=>{r(h=>{let f={...h,cards:[],columns:[]};return o(f),f});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:m,onCardDelete:g,onColumnCreate:i,onColumnUpdate:p,onColumnDelete:l},setBoard:r,helpers:{addCard:b,addColumn:v,deleteCard:g,deleteColumn:l,clearBoard:k}}}function $p({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=xs({initialBoard:e,onPersist:a}),n=useMemo(()=>({addCard:(g,i,p={})=>{s.addCard({title:i,columnId:g,position:r.cards.filter(l=>l.columnId===g).length,...p});},addColumn:(g,i)=>{let p=r.columns.length>0?Math.max(...r.columns.map(l=>l.position)):0;s.addColumn({title:g,position:i??p+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:n}}var pn={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},zp={by:"none",order:"asc"};function Hp({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=useState({...pn,...e}),[s,n]=useState({...zp,...t}),m=useCallback(C=>{o(h=>({...h,...C}));},[]),g=useCallback(C=>{n(h=>({...h,...C}));},[]),i=useCallback(()=>{o(pn),n(zp);},[]),p=useCallback(()=>{a&&o({...pn,assignees:[a]});},[a]),l=useCallback(()=>{o({...pn,dateFilter:"overdue"});},[]),b=useCallback(()=>{o({...pn,priorities:["HIGH","URGENT"]});},[]),v=useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),k=useCallback(C=>{let h=[...C];if(r.search){let f=r.search.toLowerCase();h=h.filter(u=>u.title.toLowerCase().includes(f)||u.description?.toLowerCase().includes(f));}if(r.dateFilter!=="all"){let f=new Date,u=f.getFullYear(),x=String(f.getMonth()+1).padStart(2,"0"),c=String(f.getDate()).padStart(2,"0"),N=`${u}-${x}-${c}`;h=h.filter(w=>{if(!w.endDate&&!w.dueDate)return false;let B=w.endDate||w.dueDate;if(!B)return false;let y;if(typeof B=="string")y=B.split("T")[0]||B;else {let I=B.getUTCFullYear(),P=String(B.getUTCMonth()+1).padStart(2,"0"),T=String(B.getUTCDate()).padStart(2,"0");y=`${I}-${P}-${T}`;}switch(r.dateFilter){case "overdue":return y<N;case "today":return y===N;case "this-week":let I=new Date(N+"T00:00:00"),P=new Date(y+"T00:00:00"),T=new Date(I);return T.setDate(T.getDate()+7),P>=I&&P<=T;case "custom":if(r.dateRange){let W=typeof B=="string"?new Date(B):B;return W>=r.dateRange.start&&W<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(h=h.filter(f=>f.priority&&r.priorities.includes(f.priority))),r.assignees.length>0&&(h=h.filter(f=>(f.assignedUserIds||(f.assigneeId?[f.assigneeId]:[])).some(x=>r.assignees.includes(x)))),r.labels.length>0&&(h=h.filter(f=>f.labels&&f.labels.some(u=>r.labels.includes(u)))),r.columns.length>0&&(h=h.filter(f=>r.columns.includes(f.columnId))),s.by!=="none"&&h.sort((f,u)=>{let x=0;switch(s.by){case "created":let c=f.createdAt?new Date(f.createdAt).getTime():0,N=u.createdAt?new Date(u.createdAt).getTime():0;x=c-N;break;case "priority":let w={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},B=w[f.priority||"LOW"],y=w[u.priority||"LOW"];x=B-y;break;case "dueDate":let I=f.endDate||f.dueDate,P=u.endDate||u.dueDate;if(!I)return 1;if(!P)return -1;let T=typeof I=="string"?new Date(I).getTime():I.getTime(),W=typeof P=="string"?new Date(P).getTime():P.getTime();x=T-W;break;case "title":x=f.title.localeCompare(u.title);break;case "estimate":let O=f.estimatedTime||0,q=u.estimatedTime||0;x=O-q;break;default:x=0;}return s.order==="asc"?x:-x}),h},[r,s]);return {filters:r,sort:s,setFilters:m,setSort:g,resetFilters:i,filterMyTasks:p,filterOverdue:l,filterHighPriority:b,applyFilters:k,hasActiveFilters:v}}var Gp,_p;if(typeof window<"u")try{let e=yn("ai");Gp=e.generateObject,_p=e.generateText;}catch{}function Vp(e={}){let[t,a]=useState(false),[r,o]=useState(null),s=!!(Gp&&_p&&e.apiKey),n=useCallback(async l=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",l),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${l}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(b){let v=b instanceof Error?b:new Error("Failed to generate plan");throw o(v),v}finally{a(false);}},[s]),m=useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",l.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(b){let v=b instanceof Error?b:new Error("Failed to suggest assignee");throw o(v),v}finally{a(false);}},[s]),g=useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(b){let v=b instanceof Error?b:new Error("Failed to predict risks");throw o(v),v}finally{a(false);}},[s]),i=useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",l.title),[{title:`Subtask 1 for: ${l.title}`,position:l.position+.1,columnId:l.columnId},{title:`Subtask 2 for: ${l.title}`,position:l.position+.2,columnId:l.columnId}]}catch(b){let v=b instanceof Error?b:new Error("Failed to generate subtasks");throw o(v),v}finally{a(false);}},[s]),p=useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",l.title),{hours:8,confidence:.75}}catch(b){let v=b instanceof Error?b:new Error("Failed to estimate effort");throw o(v),v}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:m,onPredictRisks:g,onGenerateSubtasks:i,onEstimateEffort:p,isAvailable:s,isLoading:t,error:r}}function El(){let[e,t]=useState(()=>selectionStore.getState());useEffect(()=>selectionStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{selectionStore.setState(r);},[]);return [e,a]}function jp(e){let{cards:t}=e,[a,r]=El(),o=useCallback(l=>a.selectedCardIds.includes(l),[a.selectedCardIds]),s=useCallback((l,b)=>{if(!b){r({selectedCardIds:[l],lastSelectedCardId:l});return}let v=b.ctrlKey||b.metaKey,k=b.shiftKey;if(v)a.selectedCardIds.includes(l)?r({selectedCardIds:a.selectedCardIds.filter(C=>C!==l),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,l],lastSelectedCardId:l});else if(k&&a.lastSelectedCardId){let C=t.find(f=>f.id===l),h=t.find(f=>f.id===a.lastSelectedCardId);if(C&&h&&C.columnId===h.columnId){let f=t.filter(y=>y.columnId===C.columnId).sort((y,I)=>y.position-I.position),u=f.findIndex(y=>y.id===a.lastSelectedCardId),x=f.findIndex(y=>y.id===l),[c,N]=u<x?[u,x]:[x,u],w=f.slice(c,N+1).map(y=>y.id),B=Array.from(new Set([...a.selectedCardIds,...w]));r({selectedCardIds:B,lastSelectedCardId:l});}else r({selectedCardIds:[l],lastSelectedCardId:l});}else r({selectedCardIds:[l],lastSelectedCardId:l});},[t,a,r]),n=useCallback(l=>{r({selectedCardIds:a.selectedCardIds.filter(b=>b!==l),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),m=useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),g=useCallback(()=>{r({selectedCardIds:t.map(l=>l.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=useCallback(l=>{a.selectedCardIds.includes(l)?n(l):r({selectedCardIds:[...a.selectedCardIds,l],lastSelectedCardId:l});},[a,n,r]),p=useCallback(()=>t.filter(l=>a.selectedCardIds.includes(l.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:m,selectAll:g,toggleCard:i,getSelectedCards:p}}var Kp={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function Yp(e){let{cards:t,config:a,aiService:r}=e,o=useMemo(()=>({...Kp,...a}),[a]),[s,n]=useState([]),m=useCallback((C,h,f,u,x)=>{if(h.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let c={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:C,cardIds:h,columnId:f,strategy:u,color:x,isExpanded:true,position:s.filter(N=>N.columnId===f).length,createdAt:new Date};n(N=>[...N,c]);},[o.minCardsPerStack,s]),g=useCallback(C=>{n(h=>h.filter(f=>f.id!==C));},[]),i=useCallback(C=>{n(h=>h.map(f=>f.id===C?{...f,isExpanded:!f.isExpanded}:f));},[]),p=useCallback((C,h)=>{n(f=>f.map(u=>u.id===C&&!u.cardIds.includes(h)?{...u,cardIds:[...u.cardIds,h]}:u));},[]),l=useCallback((C,h)=>{n(f=>f.map(u=>{if(u.id===C){let x=u.cardIds.filter(c=>c!==h);return x.length<o.minCardsPerStack?null:{...u,cardIds:x}}return u}).filter(u=>u!==null));},[o.minCardsPerStack]),b=useCallback(C=>s.filter(h=>h.columnId===C).sort((h,f)=>h.position-f.position),[s]),v=useCallback(async C=>{let h=t.filter(N=>N.columnId===C);if(h.length<o.minCardsPerStack*2)return [];let f=[],u=new Map;h.forEach(N=>{N.labels&&N.labels.length>0&&N.labels.forEach(w=>{u.has(w)||u.set(w,[]),u.get(w).push(N);});}),u.forEach((N,w)=>{N.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F4CC} ${w}`,cardIds:N.map(B=>B.id),columnId:C,strategy:"labels",color:"#3b82f6"},reason:`${N.length} cards with label "${w}"`,confidence:.85});});let x=new Map;h.forEach(N=>{N.assignedUserIds&&N.assignedUserIds.length>0&&N.assignedUserIds.forEach(w=>{x.has(w)||x.set(w,[]),x.get(w).push(N);});}),x.forEach((N,w)=>{N.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F464} Assigned to user-${w.slice(-4)}`,cardIds:N.map(B=>B.id),columnId:C,strategy:"assignee",color:"#8b5cf6"},reason:`${N.length} cards assigned to the same user`,confidence:.8});});let c=new Map;if(h.forEach(N=>{N.priority&&(c.has(N.priority)||c.set(N.priority,[]),c.get(N.priority).push(N));}),c.forEach((N,w)=>{if(N.length>=o.minCardsPerStack){let B={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[w.toLowerCase()]||"\u26AA";f.push({stack:{title:`${B} ${w} Priority`,cardIds:N.map(y=>y.id),columnId:C,strategy:"priority",color:w==="high"||w==="urgent"?"#ef4444":"#10b981"},reason:`${N.length} cards with ${w} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let N of h){let B=(await r.findSimilar(N,h)).filter(y=>y.similarity>=o.autoStackConfidenceThreshold);if(B.length>=o.minCardsPerStack-1){let y=[N.id,...B.map(P=>P.card.id)],I=B.reduce((P,T)=>P+T.similarity,0)/B.length;f.push({stack:{title:`\u2728 Similar to "${N.title.substring(0,30)}${N.title.length>30?"...":""}"`,cardIds:y,columnId:C,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${B.length+1} similar tasks`,confidence:I});}}return f.filter(N=>N.confidence>=o.autoStackConfidenceThreshold).sort((N,w)=>w.confidence-N.confidence).slice(0,5)},[t,o,r]),k=useCallback(C=>{m(C.stack.title,C.stack.cardIds,C.stack.columnId,C.stack.strategy,C.stack.color);},[m]);return useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(h=>h.columnId)).forEach(async h=>{let f=await v(h),u=f[0];f.length>0&&u&&u.confidence>=.9&&k(u);});},[]),{stacks:s,createStack:m,deleteStack:g,toggleStack:i,addToStack:p,removeFromStack:l,getStacksForColumn:b,getSuggestions:v,applySuggestion:k,config:o}}var qp=createContext(null);function Xp({children:e,initialData:t,onStateChange:a}){let r=useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(g=>{let{Column:i}=yn("@libxai/core");s.set(g.id,new i(g));}),t?.cards?.forEach(g=>{let{Card:i}=yn("@libxai/core");n.set(g.id,new i(g));});let m=null;if(t?.board){let{Board:g}=yn("@libxai/core");m=new g(t.board);}r.current=new BoardStore({board:m,columns:s,cards:n});}let o=r.current;return useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsx(qp.Provider,{value:{store:o},children:e})}function ks(){let e=useContext(qp);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function gn(){let e=ks(),[t,a]=useState(e.getBoard()),[r,o]=useState(e.getAllColumns()),[s,n]=useState(e.getAllCards());useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),n(e.getAllCards());}),[e]);let m=useCallback(u=>{e.updateBoard(u);},[e]),g=useCallback(u=>{e.addColumn(u);},[e]),i=useCallback((u,x)=>{e.updateColumn(u,x);},[e]),p=useCallback(u=>{e.deleteColumn(u);},[e]),l=useCallback(u=>e.getColumn(u),[e]),b=useCallback(u=>{e.addCard(u);},[e]),v=useCallback((u,x)=>{e.updateCard(u,x);},[e]),k=useCallback(u=>{e.deleteCard(u);},[e]),C=useCallback((u,x,c)=>{e.moveCard(u,x,c);},[e]),h=useCallback(u=>e.getCard(u),[e]),f=useCallback(u=>e.getCardsByColumn(u),[e]);return {board:t,columns:r,cards:s,updateBoard:m,addColumn:g,updateColumn:i,deleteColumn:p,getColumn:l,addCard:b,updateCard:v,deleteCard:k,moveCard:C,getCard:h,getCardsByColumn:f}}function Zp(e){let{cards:t}=gn();return useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let r=e.searchQuery.toLowerCase(),o=a.title.toLowerCase().includes(r),s=a.description?.toLowerCase().includes(r);if(!o&&!s)return false}return !(e.priorities&&e.priorities.length>0&&(!a.priority||!e.priorities.includes(a.priority))||e.statuses&&e.statuses.length>0&&(!a.status||!e.statuses.includes(a.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(o=>a.isAssignedTo(o))||e.labels&&e.labels.length>0&&!e.labels.some(o=>a.hasLabel(o))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(a.columnId)||e.isOverdue!==void 0&&e.isOverdue!==a.isOverdue())}):t,[t,e])}function Qp(e="position",t="asc"){let{cards:a}=gn();return useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let m={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},g=o.priority?m[o.priority]:0,i=s.priority?m[s.priority]:0;n=g-i;break}case "createdAt":n=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":n=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":n=o.position-s.position;break}return t==="asc"?n:-n}),[a,e,t])}var ws=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=id.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let o=this.config.get(t);o[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let o=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let n=s[t];if(typeof n=="function")try{let m=await Promise.resolve(n.apply(s,a));m!==void 0&&(o=m,a[0]=m);}catch(m){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,m,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(n=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,n,{plugin:o.id,hook:t});}));}await Promise.all(r);}},Ov=new ws;function tu({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:m=0,getItemKey:g}){let i=useRef(null),p=useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:m}),l=p.getVirtualItems(),b={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},v=n?{width:`${p.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${p.getTotalSize()}px`,width:"100%",position:"relative"};return jsx("div",{ref:i,style:b,className:o,children:jsx("div",{style:v,children:l.map(k=>{let C=e[k.index];if(!C)return null;let h=g?g(C,k.index):k.index,f={position:"absolute",top:n?0:k.start,left:n?k.start:0,width:n?k.size:"100%",height:n?"100%":k.size};return jsx("div",{style:f,"data-index":k.index,children:r(C,k.index)},h)})})})}function au(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 ou({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:m=16,getItemKey:g,horizontal:i=true}){let p=useRef(null),l=useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>p.current,estimateSize:()=>r,overscan:n,gap:m}),b=l.getVirtualItems(),v={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},k={width:`${l.getTotalSize()}px`,height:"100%",position:"relative"};return jsx("div",{ref:p,style:v,className:s,children:jsx("div",{style:k,children:b.map(C=>{let h=e[C.index];if(!h)return null;let f=g?g(h,C.index):C.index,u={position:"absolute",top:0,left:C.start,width:C.size,height:"100%"};return jsx("div",{style:u,"data-index":C.index,children:o(h,C.index)},f)})})})}function nu(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 su(e,t=10){return e>t}var Fl={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Ll={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},Il={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Bl={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Rl={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Ol={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},$l={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Ul={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)"},zl={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)"},Hl={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Wl={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}},Gl={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}},Cs={spacing:Fl,borderRadius:Ll,fontSize:Il,fontWeight:Bl,lineHeight:Rl,zIndex:Ol,duration:$l,easing:Ul,shadows:zl,opacity:Hl,kanban:Wl,gantt:Gl};function iu(e,t,a){return e[t]??a}function _l(e,t="",a={}){for(let[r,o]of Object.entries(e)){let s=t?`${t}-${r}`:r;typeof o=="object"&&o!==null&&!Array.isArray(o)?_l(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function zv(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Vl(e="asakaa"){let t=_l(Cs),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=zv(o);a.push(` ${s}: ${n};`);}return `:root {
|
|
389
|
+
Today's date: ${new Date().toISOString().split("T")[0]}`}function ym(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function Ar(e,t){let a=ym(e),r=t.toLowerCase().trim(),o=a.find(c=>c.name.toLowerCase()===r);if(o)return o;let s=a.find(c=>c.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(c=>{let g=c.name.toLowerCase();return n.every(i=>g.includes(i))})}function Zi(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 f=new Date(r);return f.setDate(f.getDate()+1),f}if(a==="yesterday"||a==="ayer"){let f=new Date(r);return f.setDate(f.getDate()-1),f}if(a==="next week"||a==="la pr\xF3xima semana"){let f=new Date(r);return f.setDate(f.getDate()+7),f}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 y={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(y!==void 0){let k=new Date(r),C=k.getDay(),h=y-C;return h<=0&&(h+=7),k.setDate(k.getDate()+h),k}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let f=parseInt(s[1],10),y=s[2].toLowerCase(),k=new Date(r);return y==="day"||y==="d\xEDa"||y==="dias"?k.setDate(k.getDate()+f):y==="week"||y==="semana"||y==="semanas"?k.setDate(k.getDate()+f*7):(y==="month"||y==="mes"||y==="meses")&&k.setMonth(k.getMonth()+f),k}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 f=parseInt(c[1],10),y=parseInt(c[2],10)-1,k=parseInt(c[3],10);return new Date(k,y,f)}let g={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 f=parseInt(i[1],10),y=g[i[2].toLowerCase()],k=i[3]?parseInt(i[3],10):r.getFullYear();if(y!==void 0)return new Date(k,y,f)}let p={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 f=p[d[1].toLowerCase()],y=parseInt(d[2],10),k=d[3]?parseInt(d[3],10):r.getFullYear();if(f!==void 0)return new Date(k,f,y)}return null}function Qi(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 el(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 vm(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 xm(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(),p=r[2].trim(),d=Ar(t,i),f=Zi(p);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(!f)return {type:"move_task",taskId:d.id,taskName:d.name,message:`Could not parse the date "${p}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let y=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,k=new Date(f);return k.setDate(k.getDate()+y),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:f,endDate:k},message:`Moved "${d.name}" to ${f.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(),p=o[2].trim(),d=Ar(t,i),f=Qi(p);if(!d)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!f||!d.endDate)return {type:"resize_task",taskId:d.id,taskName:d.name,message:`Could not parse the duration "${p}".`,success:false,error:"Invalid duration"};let y=new Date(d.endDate);return y.setDate(y.getDate()+f),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:y},message:`Extended "${d.name}" by ${f} days. New end date: ${y.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let i=s[1].trim(),p=s[2].trim(),d=Ar(t,i),f=el(p);return d?f===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${p}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:d.id,taskName:d.name,updates:{progress:f},message:`Set "${d.name}" progress to ${f}%.`,success:true}:{type:"set_progress",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let n=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),p=n[2].trim(),d=Ar(t,i);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:p},message:`Renamed "${d.name}" to "${p}".`,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(),p=c[2].trim(),d=Ar(t,i),f=Ar(t,p);return d?f?{type:"link_tasks",taskId:f.id,taskName:f.name,dependencyFrom:d.id,dependencyTo:f.id,message:`Linked "${d.name}" \u2192 "${f.name}".`,success:true}:{type:"link_tasks",taskName:p,message:`Could not find a task named "${p}".`,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 g=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(g&&g[1]){let i=g[1].trim(),p=Ar(t,i);return p?{type:"delete_task",taskId:p.id,taskName:p.name,message:`Deleted "${p.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 km(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 uh(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 gh(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function ns(e,t=[],a=[]){let r=e.assignedUserIds?.map(p=>{let d=a.find(f=>f.id===p);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(p=>p!==null),o=t.filter(p=>p.metadata?.parentCardId===e.id).map(p=>ns(p,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(p=>p.type==="finish-to-start").map(p=>p.taskId));let n=p=>{if(p)return typeof p=="string"?new Date(p):p},c=n(e.startDate),g=n(e.endDate),i=e.metadata?.isMilestone===true||c&&g&&Math.abs(g.getTime()-c.getTime())<=864e5;return {id:e.id,name:e.title,startDate:c,endDate:g,progress:e.progress||0,status:uh(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:i,isCriticalPath:e.metadata?.isCriticalPath===true}}function wm(e,t=[]){let a;return e.assignees&&e.assignees.length>0&&(a=e.assignees.map(r=>t.find(s=>s.name===r.name||s.initials===r.initials)?.id).filter(r=>r!==void 0)),{id:e.id,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,assignedUserIds:a?.length?a:void 0,metadata:{status:gh(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function Cm(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>ns(r,e,t))}var tl={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"}},al={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"}},ss={en:tl,es:al};function rl(e){return ss[e]||ss.en}function is(e,t){let a=rl(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},filters:{...a.filters,...t.filters},status:{...a.status,...t.status},actions:{...a.actions,...t.actions},empty:{...a.empty,...t.empty},pagination:{...a.pagination,...t.pagination},bulk:{...a.bulk,...t.bulk}}:a}var ol=[{value:"todo",icon:Circle,color:"text-gray-400"},{value:"in-progress",icon:PlayCircle,color:"text-blue-500"},{value:"completed",icon:CheckCircle2,color:"text-green-500"}];function Tm({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=useState(false),c=useRef(null);useEffect(()=>{let f=y=>{c.current&&!c.current.contains(y.target)&&n(false);};return s&&document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[s]);let g=ol[0],i=ol.find(f=>f.value===e)??g,p=i.icon,d=f=>{switch(f){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return o||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(p,{className:l("w-4 h-4",i.color)}),jsx("span",{className:l("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:d(e)})]}):jsxs("div",{ref:c,className:"relative",children:[jsxs("button",{onClick:f=>{f.stopPropagation(),n(!s);},className:l("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsx(p,{className:l("w-4 h-4",i.color)}),jsx("span",{className:l("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:d(e)}),jsx(ChevronDown,{className:l("w-3 h-3",a?"text-[#6B7280]":"text-gray-400")})]}),s&&jsx("div",{className:l("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:ol.map(f=>{let y=f.icon;return jsxs("button",{onClick:k=>{k.stopPropagation(),t(f.value),n(false);},className:l("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",e===f.value&&(a?"bg-white/5":"bg-gray-50")),children:[jsx(y,{className:l("w-4 h-4",f.color)}),jsx("span",{className:a?"text-white":"text-gray-900",children:d(f.value)})]},f.value)})})]})}var nl=[{value:"urgent",label:{en:"Urgent",es:"Urgente"},color:"text-red-500",bg:"bg-red-500"},{value:"high",label:{en:"High",es:"Alta"},color:"text-orange-500",bg:"bg-orange-500"},{value:"medium",label:{en:"Medium",es:"Media"},color:"text-yellow-500",bg:"bg-yellow-500"},{value:"low",label:{en:"Low",es:"Baja"},color:"text-blue-500",bg:"bg-blue-500"},{value:"none",label:{en:"None",es:"Ninguna"},color:"text-gray-400",bg:"bg-gray-400"}];function Dm({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=useState(false),c=useRef(null);useEffect(()=>{let p=d=>{c.current&&!c.current.contains(d.target)&&n(false);};return s&&document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]);let g=nl.find(p=>p.value===e)??nl[4],i=r==="es"?"es":"en";return o||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(Flag,{className:l("w-4 h-4",g.color)}),jsx("span",{className:l("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:g.label[i]})]}):jsxs("div",{ref:c,className:"relative",children:[jsxs("button",{onClick:p=>{p.stopPropagation(),n(!s);},className:l("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsx(Flag,{className:l("w-4 h-4",g.color)}),jsx("span",{className:l("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:g.label[i]}),jsx(ChevronDown,{className:l("w-3 h-3",a?"text-[#6B7280]":"text-gray-400")})]}),s&&jsx("div",{className:l("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:nl.map(p=>jsxs("button",{onClick:d=>{d.stopPropagation(),t(p.value),n(false);},className:l("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",e===p.value&&(a?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:l("w-2 h-2 rounded-full",p.bg)}),jsx("span",{className:a?"text-white":"text-gray-900",children:p.label[i]})]},p.value))})]})}function cs(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function ms(e){let t=["bg-blue-500","bg-green-500","bg-purple-500","bg-pink-500","bg-yellow-500","bg-red-500","bg-indigo-500","bg-teal-500"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"bg-blue-500"}function Em({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false}){let[n,c]=useState(false),[g,i]=useState(""),p=useRef(null);useEffect(()=>{let k=C=>{p.current&&!p.current.contains(C.target)&&(c(false),i(""));};return n&&document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[n]);let d=t.filter(k=>k.name.toLowerCase().includes(g.toLowerCase())||k.email?.toLowerCase().includes(g.toLowerCase())),f=k=>e.some(C=>C.name===k),y=k=>{if(a)if(f(k.name))a(e.filter(C=>C.name!==k.name));else {let C={name:k.name,initials:cs(k.name),color:k.color||ms(k.name).replace("bg-","").replace("-500",""),avatar:k.avatarUrl};a([...e,C]);}};return s||!a?e.length===0?jsx("span",{className:l("text-sm",r?"text-[#6B7280]":"text-gray-400"),children:"-"}):jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((k,C)=>jsx("div",{className:l("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0F1117]":"border-white",!k.avatar&&ms(k.name)),style:k.color&&!k.avatar?{backgroundColor:k.color}:void 0,title:k.name,children:k.avatar?jsx("img",{src:k.avatar,alt:k.name,className:"w-full h-full rounded-full object-cover"}):k.initials||cs(k.name)},`${k.name}-${C}`)),e.length>3&&jsxs("div",{className:l("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#374151] border-[#0F1117] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxs("div",{ref:p,className:"relative",children:[jsx("button",{onClick:k=>{k.stopPropagation(),c(!n);},className:l("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100"),children:e.length===0?jsxs(Fragment,{children:[jsx(User,{className:l("w-4 h-4",r?"text-[#6B7280]":"text-gray-400")}),jsx(Plus,{className:l("w-3 h-3",r?"text-[#6B7280]":"text-gray-400")})]}):jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((k,C)=>jsx("div",{className:l("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0F1117]":"border-white",!k.avatar&&ms(k.name)),style:k.color&&!k.avatar?{backgroundColor:k.color}:void 0,children:k.avatar?jsx("img",{src:k.avatar,alt:k.name,className:"w-full h-full rounded-full object-cover"}):k.initials||cs(k.name)},`${k.name}-${C}`)),e.length>2&&jsxs("span",{className:l("text-xs ml-1",r?"text-[#9CA3AF]":"text-gray-500"),children:["+",e.length-2]})]})}),n&&jsxs("div",{className:l("absolute z-50 top-full left-0 mt-1 rounded-lg shadow-lg border w-64",r?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:[jsx("div",{className:"p-2 border-b",style:{borderColor:r?"rgba(255,255,255,0.1)":"#E5E7EB"},children:jsx("input",{type:"text",value:g,onChange:k=>i(k.target.value),placeholder:o==="es"?"Buscar usuario...":"Search user...",className:l("w-full px-3 py-1.5 text-sm rounded border outline-none",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),onClick:k=>k.stopPropagation()})}),jsx("div",{className:"max-h-48 overflow-y-auto py-1",children:d.length===0?jsx("p",{className:l("px-3 py-2 text-sm",r?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"No se encontraron usuarios":"No users found"}):d.map(k=>jsxs("button",{onClick:C=>{C.stopPropagation(),y(k);},className:l("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsx("div",{className:l("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white",!k.avatarUrl&&ms(k.name)),children:k.avatarUrl?jsx("img",{src:k.avatarUrl,alt:k.name,className:"w-full h-full rounded-full object-cover"}):cs(k.name)}),jsxs("div",{className:"flex-1 text-left",children:[jsx("div",{className:r?"text-white":"text-gray-900",children:k.name}),k.email&&jsx("div",{className:l("text-xs",r?"text-[#6B7280]":"text-gray-400"),children:k.email})]}),f(k.name)&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},k.id))}),e.length>0&&jsx("div",{className:"p-2 border-t flex flex-wrap gap-1",style:{borderColor:r?"rgba(255,255,255,0.1)":"#E5E7EB"},children:e.map((k,C)=>jsxs("span",{className:l("inline-flex items-center gap-1 px-2 py-0.5 text-xs rounded-full",r?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:[k.name,jsx("button",{onClick:h=>{h.stopPropagation(),a(e.filter(b=>b.name!==k.name));},className:"hover:text-red-500",children:jsx(X,{className:"w-3 h-3"})})]},`${k.name}-${C}`))})]})]})}var $h={en:["January","February","March","April","May","June","July","August","September","October","November","December"],es:["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"]},Uh={en:["Su","Mo","Tu","We","Th","Fr","Sa"],es:["Do","Lu","Ma","Mi","Ju","Vi","S\xE1"]};function ps({value:e,onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=useState(false),[c,g]=useState(()=>{if(e){let h=e instanceof Date?e:new Date(e);return new Date(h.getFullYear(),h.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),i=useRef(null),p=e?e instanceof Date?e:new Date(e):null,d=r==="es"?"es":"en";useEffect(()=>{let h=b=>{i.current&&!i.current.contains(b.target)&&n(false);};return s&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]);let f=h=>h?h.toLocaleDateString(r==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-",y=(h,b)=>new Date(h,b+1,0).getDate(),k=(h,b)=>new Date(h,b,1).getDay(),C=()=>{let h=c.getFullYear(),b=c.getMonth(),u=y(h,b),x=k(h,b),m=new Date,N=[];for(let w=0;w<x;w++)N.push(jsx("div",{className:"w-8 h-8"},`empty-${w}`));for(let w=1;w<=u;w++){let B=new Date(h,b,w),v=p&&p.getDate()===w&&p.getMonth()===b&&p.getFullYear()===h,I=m.getDate()===w&&m.getMonth()===b&&m.getFullYear()===h;N.push(jsx("button",{onClick:A=>{A.stopPropagation(),t?.(B),n(false);},className:l("w-8 h-8 rounded-full text-sm transition-colors",v?"bg-[#3B82F6] text-white":I?a?"bg-white/10 text-white":"bg-gray-100 text-gray-900":a?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-900"),children:w},w));}return N};return o||!t?jsx("span",{className:l("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:f(p)}):jsxs("div",{ref:i,className:"relative",children:[jsxs("button",{onClick:h=>{h.stopPropagation(),n(!s);},className:l("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsx(Calendar,{className:l("w-4 h-4",a?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:l("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:f(p)})]}),s&&jsxs("div",{className:l("absolute z-50 top-full left-0 mt-1 p-3 rounded-lg shadow-lg border",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("button",{onClick:h=>{h.stopPropagation(),g(new Date(c.getFullYear(),c.getMonth()-1,1));},className:l("p-1 rounded",a?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:l("w-4 h-4",a?"text-white":"text-gray-600")})}),jsxs("span",{className:l("text-sm font-medium",a?"text-white":"text-gray-900"),children:[$h[d][c.getMonth()]," ",c.getFullYear()]}),jsx("button",{onClick:h=>{h.stopPropagation(),g(new Date(c.getFullYear(),c.getMonth()+1,1));},className:l("p-1 rounded",a?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:l("w-4 h-4",a?"text-white":"text-gray-600")})})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:Uh[d].map(h=>jsx("div",{className:l("w-8 h-6 text-xs flex items-center justify-center",a?"text-[#6B7280]":"text-gray-400"),children:h},h))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:C()}),jsxs("div",{className:"mt-3 pt-3 border-t flex gap-2",style:{borderColor:a?"rgba(255,255,255,0.1)":"#E5E7EB"},children:[jsx("button",{onClick:h=>{h.stopPropagation(),t?.(new Date),n(false);},className:l("flex-1 py-1.5 text-xs rounded",a?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:r==="es"?"Hoy":"Today"}),jsx("button",{onClick:h=>{h.stopPropagation();let b=new Date;b.setDate(b.getDate()+1),t?.(b),n(false);},className:l("flex-1 py-1.5 text-xs rounded",a?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:r==="es"?"Ma\xF1ana":"Tomorrow"})]})]})]})}function Fm({value:e=0,onChange:t,isDark:a,disabled:r=false}){return jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsx("div",{onClick:s=>{if(r||!t)return;s.stopPropagation();let n=s.currentTarget.getBoundingClientRect(),c=s.clientX-n.left,g=Math.round(c/n.width*100),i=Math.max(0,Math.min(100,g));t(i);},className:l("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/10":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsx("div",{className:l("h-full rounded-full transition-all",e===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${e}%`}})}),jsxs("span",{className:l("text-xs w-8 text-right",a?"text-[#9CA3AF]":"text-gray-500"),children:[e,"%"]})]})}function Bm({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=useState(false),[c,g]=useState(e),i=useRef(null);useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),useEffect(()=>{g(e);},[e]);let p=()=>{c!==e&&t?.(c),n(false);},d=f=>{f.key==="Enter"?p():f.key==="Escape"&&(g(e),n(false));};return o||!t?jsx("span",{className:l("text-sm truncate",a?"text-[#94A3B8]":"text-gray-500"),children:e||r}):s?jsx("input",{ref:i,type:"text",value:c,onChange:f=>g(f.target.value),onBlur:p,onKeyDown:d,onClick:f=>f.stopPropagation(),className:l("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white":"bg-white border-[#3B82F6] text-gray-900")}):jsx("button",{onClick:f=>{f.stopPropagation(),n(true);},className:l("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",a?"text-[#94A3B8] hover:bg-white/10":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-[#6B7280]":"text-gray-400")),children:e||r})}function $m({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false}){let[c,g]=useState(false),[i,p]=useState(e?.toString()||""),d=useRef(null);useEffect(()=>{c&&d.current&&(d.current.focus(),d.current.select());},[c]),useEffect(()=>{p(e?.toString()||"");},[e]);let f=()=>{let k=parseFloat(i);if(!isNaN(k)){let C=k;o!==void 0&&(C=Math.max(o,C)),s!==void 0&&(C=Math.min(s,C)),C!==e&&t?.(C);}g(false);},y=k=>{k.key==="Enter"?f():k.key==="Escape"&&(p(e?.toString()||""),g(false));};return n||!t?jsx("span",{className:l("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:e!==void 0?e:r}):c?jsx("input",{ref:d,type:"number",value:i,onChange:k=>p(k.target.value),onBlur:f,onKeyDown:y,onClick:k=>k.stopPropagation(),min:o,max:s,className:l("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white":"bg-white border-[#3B82F6] text-gray-900")}):jsx("button",{onClick:k=>{k.stopPropagation(),g(true);},className:l("text-sm text-left w-full px-2 py-1 rounded transition-colors",a?"text-[#94A3B8] hover:bg-white/10":"text-gray-500 hover:bg-gray-100",e===void 0&&(a?"text-[#6B7280]":"text-gray-400")),children:e!==void 0?e:r})}function Um({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,c]=useState(false),g=useRef(null);return useEffect(()=>{let i=p=>{g.current&&!g.current.contains(p.target)&&c(false);};return n&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]),s||!a?jsx("span",{className:l("text-sm",r?"text-[#94A3B8]":"text-gray-500"),children:e||o}):jsxs("div",{ref:g,className:"relative",children:[jsxs("button",{onClick:i=>{i.stopPropagation(),c(!n);},className:l("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsx("span",{className:l("text-sm flex-1 text-left truncate",r?"text-[#94A3B8]":"text-gray-500",!e&&(r?"text-[#6B7280]":"text-gray-400")),children:e||o}),jsx(ChevronDown,{className:l("w-3 h-3 flex-shrink-0",r?"text-[#6B7280]":"text-gray-400")})]}),n&&jsx("div",{className:l("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",r?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:t.length===0?jsx("p",{className:l("px-3 py-2 text-sm",r?"text-[#6B7280]":"text-gray-400"),children:"No options"}):t.map(i=>jsxs("button",{onClick:p=>{p.stopPropagation(),a(i),c(false);},className:l("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100",e===i&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:r?"text-white":"text-gray-900",children:i}),e===i&&jsx(Check,{className:"w-4 h-4 text-[#3B82F6]"})]},i))})]})}function Hm({value:e=false,onChange:t,isDark:a,disabled:r=false}){return jsx("button",{onClick:s=>{s.stopPropagation(),!r&&t&&t(!e);},disabled:r||!t,className:l("w-5 h-5 rounded border-2 flex items-center justify-center transition-colors",e?"bg-[#3B82F6] border-[#3B82F6]":a?"border-[#4B5563] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed"),children:e&&jsx(Check,{className:"w-3 h-3 text-white"})})}function _m({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsx("span",{className:l("text-sm",t?"text-[#6B7280]":"text-gray-400"),children:"-"});let r=e.slice(0,a),o=e.length-a;return jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.map(s=>jsx("span",{className:"inline-flex items-center px-2 py-0.5 text-xs rounded-full",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.1)":"#F3F4F6",color:s.color||(t?"#9CA3AF":"#6B7280")},children:s.name},s.id)),o>0&&jsxs("span",{className:l("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-500"),children:["+",o]})]})}function iy(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function ly(e){let t=["blue","green","purple","pink","yellow","red","indigo","teal"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"blue"}function Ym({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:c,onColumnHide:g,onColumnSort:i,availableUsers:p=[]}){let d=useRef(null),f=r==="es"?jm.es:jm.en;if(useEffect(()=>{let b=x=>{d.current&&!d.current.contains(x.target)&&t();},u=x=>{x.key==="Escape"&&t();};return document.addEventListener("mousedown",b),document.addEventListener("keydown",u),()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",u);}},[t]),!e.isOpen)return null;let y=()=>{if(!e.task)return [];let b=[];return o&&b.push({id:"edit",label:f.edit,icon:jsx(Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),b.push({id:"sep1",label:"",icon:null,separator:true}),c&&(b.push({id:"status",label:f.changeStatus,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:f.todo,icon:jsx(Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{c({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:f.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4 text-blue-500"}),onClick:()=>{c({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:f.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{c({...e.task,status:"completed",progress:100}),t();}}]}),b.push({id:"priority",label:f.changePriority,icon:jsx(Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:f.urgent,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{c({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:f.high,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{c({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:f.medium,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{c({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:f.low,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{c({...e.task,priority:"low"}),t();}}]}),p.length>0&&b.push({id:"assign",label:f.assignUser,icon:jsx(Users,{className:"w-4 h-4"}),submenu:p.slice(0,5).map(u=>({id:`assign-${u.id}`,label:u.name,icon:jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-blue-500",children:u.name.charAt(0).toUpperCase()}),onClick:()=>{let x=e.task.assignees||[],N=x.some(w=>w.name===u.name)?x.filter(w=>w.name!==u.name):[...x,{name:u.name,initials:iy(u.name),color:u.color||ly(u.name),avatar:u.avatarUrl}];c({...e.task,assignees:N}),t();}}))})),b.push({id:"sep2",label:"",icon:null,separator:true}),s&&b.push({id:"duplicate",label:f.duplicate,icon:jsx(Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),n&&b.push({id:"delete",label:f.delete,icon:jsx(Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),b},k=()=>{if(!e.columnId)return [];let b=[];return i&&(b.push({id:"sort-asc",label:f.sortAsc,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),b.push({id:"sort-desc",label:f.sortDesc,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),g&&e.columnId!=="name"&&(b.push({id:"sep-hide",label:"",icon:null,separator:true}),b.push({id:"hide",label:f.hideColumn,icon:jsx(EyeOff,{className:"w-4 h-4"}),onClick:()=>{g(e.columnId),t();}})),b},C=e.type==="task"?y():k(),h={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsx("div",{ref:d,style:h,className:l("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:C.map(b=>b.separator?jsx("div",{className:l("my-1 h-px",a?"bg-white/10":"bg-gray-200")},b.id):b.submenu?jsx(dy,{item:b,isDark:a},b.id):jsxs("button",{onClick:b.onClick,className:l("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",b.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsx("span",{className:l(b.danger?"text-red-500":a?"text-[#9CA3AF]":"text-gray-400"),children:b.icon}),b.label]},b.id))})}function dy({item:e,isDark:t}){let[a,r]=useState(false),o=useRef();return jsxs("div",{className:"relative",onMouseEnter:()=>{o.current&&clearTimeout(o.current),r(true);},onMouseLeave:()=>{o.current=setTimeout(()=>r(false),150);},children:[jsxs("button",{className:l("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-[#9CA3AF]":"text-gray-400",children:e.icon}),jsx("span",{className:"flex-1",children:e.label}),jsx(ChevronRight,{className:l("w-4 h-4",t?"text-[#6B7280]":"text-gray-400")})]}),a&&e.submenu&&jsx("div",{className:l("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:e.submenu.map(c=>jsxs("button",{onClick:c.onClick,className:l("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-[#9CA3AF]":"text-gray-400",children:c.icon}),c.label]},c.id))})]})}var jm={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",delete:"Delete",todo:"To Do",inProgress:"In Progress",completed:"Completed",urgent:"Urgent",high:"High",medium:"Medium",low:"Low",sortAsc:"Sort A \u2192 Z",sortDesc:"Sort Z \u2192 A",hideColumn:"Hide column"},es:{edit:"Editar",changeStatus:"Cambiar estado",changePriority:"Cambiar prioridad",assignUser:"Asignar usuario",duplicate:"Duplicar",delete:"Eliminar",todo:"Pendiente",inProgress:"En Progreso",completed:"Completado",urgent:"Urgente",high:"Alta",medium:"Media",low:"Baja",sortAsc:"Ordenar A \u2192 Z",sortDesc:"Ordenar Z \u2192 A",hideColumn:"Ocultar columna"}};var Jm={name:jsx(Type,{className:"w-4 h-4"}),status:jsx(CircleDot,{className:"w-4 h-4"}),priority:jsx(Flag,{className:"w-4 h-4"}),assignees:jsx(Users,{className:"w-4 h-4"}),startDate:jsx(Calendar,{className:"w-4 h-4"}),endDate:jsx(CalendarCheck,{className:"w-4 h-4"}),progress:jsx(BarChart,{className:"w-4 h-4"}),tags:jsx(Tag,{className:"w-4 h-4"}),text:jsx(Type,{className:"w-4 h-4"}),number:jsx(Hash,{className:"w-4 h-4"}),date:jsx(Calendar,{className:"w-4 h-4"}),dropdown:jsx(ChevronDown,{className:"w-4 h-4"}),checkbox:jsx(CheckSquare,{className:"w-4 h-4"})},Ny=["name","status","priority","assignees","startDate","endDate","progress","tags"];function Qm({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:c}){let[g,i]=useState(""),p=useRef(null),d=c==="es"?Zm.es:Zm.en;if(useEffect(()=>{if(!e)return;let b=setTimeout(()=>{let u=m=>{p.current&&!p.current.contains(m.target)&&t();},x=m=>{m.key==="Escape"&&t();};document.addEventListener("mousedown",u),document.addEventListener("keydown",x),p._cleanup=()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",x);};},100);return ()=>{clearTimeout(b),p._cleanup&&p._cleanup();}},[e,t]),!e)return null;let f=b=>d.columns[b]||b,y=b=>{if(b==="name")return;let u=a.map(x=>x.id===b?{...x,visible:!x.visible}:x);o(u);},k=(b,u)=>{let x=a.find(N=>N.type===b&&(!u||N.customFieldId===u));if(x){y(x.id);return}let m={id:u||b,type:b,label:u?r.find(N=>N.id===u)?.name||b:f(b),width:120,visible:true,sortable:true,resizable:true,customFieldId:u};o([...a,m]);},C=Ny.filter(b=>f(b).toLowerCase().includes(g.toLowerCase())),h=r.filter(b=>b.name.toLowerCase().includes(g.toLowerCase()));return jsxs("div",{ref:p,className:l("absolute right-0 top-full mt-1 w-72 rounded-lg shadow-xl border z-50",n?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxs("div",{className:l("flex items-center justify-between px-4 py-3 border-b",n?"border-white/10":"border-gray-200"),children:[jsx("h3",{className:l("font-medium",n?"text-white":"text-gray-900"),children:d.title}),jsx("button",{onClick:t,className:l("p-1 rounded",n?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(X,{className:l("w-4 h-4",n?"text-[#9CA3AF]":"text-gray-400")})})]}),jsx("div",{className:"p-3",children:jsxs("div",{className:"relative",children:[jsx(Search,{className:l("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",n?"text-[#6B7280]":"text-gray-400")}),jsx("input",{type:"text",value:g,onChange:b=>i(b.target.value),placeholder:d.searchPlaceholder,className:l("w-full pl-9 pr-3 py-2 text-sm rounded-lg border outline-none",n?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")})]})}),jsxs("div",{className:"px-3 pb-2",children:[jsx("h4",{className:l("text-xs font-medium uppercase tracking-wider mb-2",n?"text-[#6B7280]":"text-gray-400"),children:d.standardFields}),jsx("div",{className:"space-y-1",children:C.map(b=>{let u=a.find(N=>N.type===b&&!N.customFieldId),x=u?.visible??false,m=b==="name";return jsxs("button",{onClick:()=>{m||(u?y(u.id):k(b));},disabled:m,className:l("w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors",n?"hover:bg-white/10":"hover:bg-gray-100",m&&"opacity-50 cursor-not-allowed"),children:[jsx("div",{className:l("w-5 h-5 rounded border flex items-center justify-center",x?"bg-[#3B82F6] border-[#3B82F6]":n?"border-[#4B5563]":"border-gray-300"),children:x&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:n?"text-[#9CA3AF]":"text-gray-400",children:Jm[b]}),jsx("span",{className:n?"text-white":"text-gray-900",children:f(b)})]},b)})})]}),h.length>0&&jsxs("div",{className:"px-3 pb-2",children:[jsx("h4",{className:l("text-xs font-medium uppercase tracking-wider mb-2",n?"text-[#6B7280]":"text-gray-400"),children:d.customFields}),jsx("div",{className:"space-y-1",children:h.map(b=>{let x=a.find(m=>m.customFieldId===b.id)?.visible??false;return jsxs("button",{onClick:()=>k(b.type,b.id),className:l("w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors",n?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsx("div",{className:l("w-5 h-5 rounded border flex items-center justify-center",x?"bg-[#3B82F6] border-[#3B82F6]":n?"border-[#4B5563]":"border-gray-300"),children:x&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:n?"text-[#9CA3AF]":"text-gray-400",children:Jm[b.type]||jsx(Type,{className:"w-4 h-4"})}),jsx("span",{className:n?"text-white":"text-gray-900",children:b.name})]},b.id)})})]}),s&&jsx("div",{className:l("p-3 border-t",n?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:s,className:l("w-full flex items-center justify-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-colors",n?"bg-[#3B82F6]/20 text-[#3B82F6] hover:bg-[#3B82F6]/30":"bg-blue-50 text-blue-600 hover:bg-blue-100"),children:[jsx(Plus,{className:"w-4 h-4"}),d.createField]})})]})}var Zm={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",createField:"Create custom field",columns:{name:"Name",status:"Status",priority:"Priority",assignees:"Assignees",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",createField:"Crear campo personalizado",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",assignees:"Asignados",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var Iy=[{type:"text",icon:jsx(Type,{className:"w-5 h-5"})},{type:"number",icon:jsx(Hash,{className:"w-5 h-5"})},{type:"date",icon:jsx(Calendar,{className:"w-5 h-5"})},{type:"dropdown",icon:jsx(ChevronDown,{className:"w-5 h-5"})},{type:"checkbox",icon:jsx(CheckSquare,{className:"w-5 h-5"})}];function ap({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=useState(""),[c,g]=useState("text"),[i,p]=useState([""]),d=o==="es"?tp.es:tp.en;useEffect(()=>{e&&(n(""),g("text"),p([""]));},[e]),useEffect(()=>{let h=b=>{b.key==="Escape"&&t();};return e&&document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,t]);let f=()=>{if(!s.trim())return;let h={name:s.trim(),type:c};c==="dropdown"&&(h.options=i.filter(b=>b.trim())),a(h),t();},y=()=>{p([...i,""]);},k=(h,b)=>{let u=[...i];u[h]=b,p(u);},C=h=>{i.length>1&&p(i.filter((b,u)=>u!==h));};return e?jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxs("div",{className:l("relative w-full max-w-md rounded-xl shadow-2xl border",r?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxs("div",{className:l("flex items-center justify-between px-6 py-4 border-b",r?"border-white/10":"border-gray-200"),children:[jsx("h2",{className:l("text-lg font-semibold",r?"text-white":"text-gray-900"),children:d.title}),jsx("button",{onClick:t,className:l("p-1 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(X,{className:l("w-5 h-5",r?"text-[#9CA3AF]":"text-gray-400")})})]}),jsxs("div",{className:"p-6 space-y-6",children:[jsxs("div",{children:[jsx("label",{className:l("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldName}),jsx("input",{type:"text",value:s,onChange:h=>n(h.target.value),placeholder:d.fieldNamePlaceholder,className:l("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxs("div",{children:[jsx("label",{className:l("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldType}),jsx("div",{className:"grid grid-cols-5 gap-2",children:Iy.map(h=>jsxs("button",{onClick:()=>g(h.type),className:l("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",c===h.type?"border-[#3B82F6] bg-[#3B82F6]/10":r?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsx("span",{className:c===h.type?"text-[#3B82F6]":r?"text-[#9CA3AF]":"text-gray-400",children:h.icon}),jsx("span",{className:l("text-xs",c===h.type?"text-[#3B82F6]":r?"text-[#9CA3AF]":"text-gray-500"),children:d.types[h.type]})]},h.type))})]}),c==="dropdown"&&jsxs("div",{children:[jsx("label",{className:l("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.options}),jsxs("div",{className:"space-y-2",children:[i.map((h,b)=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:h,onChange:u=>k(b,u.target.value),placeholder:`${d.option} ${b+1}`,className:l("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),i.length>1&&jsx("button",{onClick:()=>C(b),className:l("p-2 rounded-lg transition-colors",r?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-400"),children:jsx(Trash2,{className:"w-4 h-4"})})]},b)),jsxs("button",{onClick:y,className:l("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#3B82F6] hover:bg-white/10":"text-blue-600 hover:bg-gray-100"),children:[jsx(Plus,{className:"w-4 h-4"}),d.addOption]})]})]})]}),jsxs("div",{className:l("flex items-center justify-end gap-3 px-6 py-4 border-t",r?"border-white/10":"border-gray-200"),children:[jsx("button",{onClick:t,className:l("px-4 py-2 text-sm font-medium rounded-lg transition-colors",r?"text-[#9CA3AF] hover:bg-white/10":"text-gray-600 hover:bg-gray-100"),children:d.cancel}),jsx("button",{onClick:f,disabled:!s.trim(),className:l("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#3B82F6] text-white hover:bg-[#2563EB]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:d.create})]})]})]}):null}var tp={en:{title:"Create Custom Field",fieldName:"Field Name",fieldNamePlaceholder:"Enter field name...",fieldType:"Field Type",options:"Options",option:"Option",addOption:"Add option",cancel:"Cancel",create:"Create Field",types:{text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Crear Campo Personalizado",fieldName:"Nombre del Campo",fieldNamePlaceholder:"Ingresa el nombre...",fieldType:"Tipo de Campo",options:"Opciones",option:"Opci\xF3n",addOption:"Agregar opci\xF3n",cancel:"Cancelar",create:"Crear Campo",types:{text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var rp={en:{filters:"Filters",filterByStatus:"FILTER BY STATUS",showAll:"Show All",completed:"Completed",inProgress:"In Progress",toDo:"To Do / Pending",hideCompleted:"Hide Completed Tasks"},es:{filters:"Filtros",filterByStatus:"FILTRAR POR ESTADO",showAll:"Mostrar Todo",completed:"Completadas",inProgress:"En Progreso",toDo:"Por Hacer / Pendiente",hideCompleted:"Ocultar Tareas Completadas"}};function op({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,c]=useState(false),g=useRef(null),i=s==="es"?rp.es:rp.en;useEffect(()=>{if(!n)return;let f=setTimeout(()=>{let y=C=>{g.current&&!g.current.contains(C.target)&&c(false);},k=C=>{C.key==="Escape"&&c(false);};document.addEventListener("mousedown",y),document.addEventListener("keydown",k),g._cleanup=()=>{document.removeEventListener("mousedown",y),document.removeEventListener("keydown",k);};},100);return ()=>{clearTimeout(f),g._cleanup&&g._cleanup();}},[n]);let p=[{value:"all",label:i.showAll,icon:jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}),color:"text-[#3B82F6]"},{value:"completed",label:i.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:i.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"todo",label:i.toDo,icon:jsx(Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],d=e!=="all"||t;return jsxs("div",{ref:g,className:"relative",children:[jsxs("button",{onClick:f=>{f.stopPropagation(),c(y=>!y);},className:l("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm font-medium transition-colors border",o?"border-white/10 hover:bg-white/10 text-white":"border-gray-200 hover:bg-gray-100 text-gray-700",d&&(o?"bg-[#3B82F6]/20 border-[#3B82F6]/50 text-[#3B82F6]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/10":"bg-gray-100")),children:[jsx(Filter,{className:"w-4 h-4"}),i.filters,d&&jsx("span",{className:l("w-2 h-2 rounded-full",o?"bg-[#3B82F6]":"bg-blue-500")})]}),n&&jsxs("div",{className:l("absolute left-0 top-full mt-2 w-64 rounded-lg shadow-xl border z-50",o?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsx("div",{className:l("px-4 py-3 border-b",o?"border-white/10":"border-gray-200"),children:jsx("span",{className:l("text-xs font-medium uppercase tracking-wider",o?"text-[#6B7280]":"text-gray-400"),children:i.filterByStatus})}),jsx("div",{className:"py-2",children:p.map(f=>jsxs("button",{onClick:()=>{a(f.value),f.value!=="all"&&r(false);},className:l("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/10":"hover:bg-gray-100",e===f.value&&(o?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:f.color,children:f.icon}),jsx("span",{className:l("flex-1 text-left",o?"text-white":"text-gray-900"),children:f.label}),e===f.value&&jsx(Check,{className:l("w-4 h-4",o?"text-[#3B82F6]":"text-blue-500")})]},f.value))}),jsx("div",{className:l("px-4 py-3 border-t",o?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{r(!t),t||a("all");},className:l("w-full flex items-center gap-3 py-2 text-sm transition-colors rounded-lg px-2",o?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsx(EyeOff,{className:l("w-4 h-4",t?o?"text-[#3B82F6]":"text-blue-500":o?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:l("flex-1 text-left",o?"text-white":"text-gray-900"),children:i.hideCompleted}),jsx("div",{className:l("w-10 h-5 rounded-full transition-colors relative",t?o?"bg-[#3B82F6]":"bg-blue-500":o?"bg-[#374151]":"bg-gray-300"),children:jsx("div",{className:l("absolute top-0.5 w-4 h-4 rounded-full bg-white transition-transform shadow",t?"translate-x-5":"translate-x-0.5")})})]})})]})]})}var tv=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:120,visible:true,sortable:true,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true}];function ip(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(...ip(r.subtasks,t+1));return a}function av({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 lp({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:c=[],customFields:g=[]}){let{theme:i="dark",locale:p="en",customTranslations:d,showSearch:f=true,showHierarchy:y=true,tableColumns:k,allowColumnCustomization:C=true,allowColumnResize:h=true,enableContextMenu:b=true}=t,u=is(p,d),x=i==="dark",[m,N]=useState("startDate"),[w,B]=useState("asc"),[v,I]=useState(""),[A,T]=useState("all"),[H,O]=useState(false),[j,ae]=useState(k||tv),[ne,re]=useState(false),[ge,fe]=useState(false),[Ie,M]=useState({isOpen:false,x:0,y:0,type:"task"}),[R,L]=useState(null),[V,q]=useState(0),[z,ye]=useState(0),se=useRef(null);useEffect(()=>{k&&ae(k);},[k]);let Be=useMemo(()=>{let J=new Set;function ve(Ue){for(let Fe of Ue)Fe.subtasks?.length&&(Fe.isExpanded!==false&&J.add(Fe.id),ve(Fe.subtasks));}return ve(e),J},[e]),Ye=useMemo(()=>j.filter(J=>J.visible),[j]),tt=useCallback(J=>{a.onTaskToggleExpand?.(J);},[a]),ie=useCallback(J=>{m===J?B(ve=>ve==="asc"?"desc":"asc"):(N(J),B("asc")),a.onSortChange?.({column:J,direction:w==="asc"?"desc":"asc"});},[m,w,a]),Je=useCallback(J=>{ae(J),a.onColumnsChange?.(J);},[a]),mt=useCallback(J=>{let ve=j.map(Ue=>Ue.id===J?{...Ue,visible:false}:Ue);Je(ve);},[j,Je]),Ct=useCallback((J,ve)=>{N(J),B(ve);},[]),xt=useCallback((J,ve,Ue)=>{b&&(J.preventDefault(),M({isOpen:true,x:J.clientX,y:J.clientY,type:ve?"task":"header",task:ve,columnId:Ue}));},[b]),$=useCallback(()=>{M(J=>({...J,isOpen:false}));},[]),be=useCallback((J,ve)=>{if(!h)return;J.preventDefault(),J.stopPropagation();let Ue=j.find(Fe=>Fe.id===ve);Ue&&(L(ve),q(J.clientX),ye(Ue.width));},[j,h]);useEffect(()=>{if(!R)return;let J=Ue=>{let Fe=Ue.clientX-V,at=Math.max(50,z+Fe),ct=j.map(te=>te.id===R?{...te,width:at}:te);ae(ct);},ve=()=>{R&&a.onColumnsChange?.(j),L(null);};return document.addEventListener("mousemove",J),document.addEventListener("mouseup",ve),()=>{document.removeEventListener("mousemove",J),document.removeEventListener("mouseup",ve);}},[R,V,z,j,a]);let Pe=useCallback(async J=>{if(a.onCreateCustomField){let ve={...J,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(ve);}fe(false);},[a]),Me=useCallback(J=>J.progress===100||J.status==="completed"?"completed":J.progress&&J.progress>0||J.status==="in-progress"?"in-progress":"todo",[]),je=useMemo(()=>{let J=ip(e);if(v.trim()){let ve=v.toLowerCase();J=J.filter(Ue=>Ue.name.toLowerCase().includes(ve));}return A!=="all"&&(J=J.filter(ve=>Me(ve)===A)),H&&(J=J.filter(ve=>Me(ve)!=="completed")),J.sort((ve,Ue)=>{let Fe,at;switch(m){case "name":Fe=ve.name.toLowerCase(),at=Ue.name.toLowerCase();break;case "startDate":Fe=ve.startDate?.getTime()||0,at=Ue.startDate?.getTime()||0;break;case "endDate":Fe=ve.endDate?.getTime()||0,at=Ue.endDate?.getTime()||0;break;case "progress":Fe=ve.progress||0,at=Ue.progress||0;break;case "status":Fe=ve.status||"todo",at=Ue.status||"todo";break;case "priority":let ct={urgent:0,high:1,medium:2,low:3,none:4};Fe=ct[ve.priority]??4,at=ct[Ue.priority]??4;break;default:return 0}return Fe<at?w==="asc"?-1:1:Fe>at?w==="asc"?1:-1:0}),J},[e,v,A,H,m,w,Me]),Ze=useCallback((J,ve)=>{let Ue=ct=>{a.onTaskUpdate?.({...J,...ct});},Fe=ct=>ct?J.customFields?.find($e=>$e.fieldId===ct)?.value:void 0,at=(ct,te)=>{if(!ct)return;let Kt=[...J.customFields||[]],Qe=Kt.findIndex(Ke=>Ke.fieldId===ct);Qe>=0?Kt[Qe]={fieldId:ct,value:te}:Kt.push({fieldId:ct,value:te}),Ue({customFields:Kt});};switch(ve.type){case "name":return null;case "status":return jsx(Tm,{value:J.status||(J.progress===100?"completed":J.progress&&J.progress>0?"in-progress":"todo"),onChange:te=>{Ue({status:te,progress:te==="completed"?100:te==="in-progress"?50:0});},isDark:x,locale:p,translations:u.status});case "priority":return jsx(Dm,{value:J.priority,onChange:te=>Ue({priority:te}),isDark:x,locale:p});case "assignees":return jsx(Em,{value:J.assignees||[],availableUsers:c,onChange:te=>Ue({assignees:te}),isDark:x,locale:p});case "startDate":return jsx(ps,{value:J.startDate,onChange:te=>Ue({startDate:te}),isDark:x,locale:p});case "endDate":return jsx(ps,{value:J.endDate,onChange:te=>Ue({endDate:te}),isDark:x,locale:p});case "progress":return jsx(Fm,{value:J.progress||0,onChange:te=>{let $e=te===100?"completed":te>0?"in-progress":"todo";Ue({progress:te,status:$e});},isDark:x});case "tags":return jsx(_m,{value:J.tags||[],isDark:x});case "text":return jsx(Bm,{value:Fe(ve.customFieldId)||"",onChange:te=>at(ve.customFieldId,te),isDark:x});case "number":return jsx($m,{value:Fe(ve.customFieldId)||0,onChange:te=>at(ve.customFieldId,te),isDark:x});case "date":let ct=Fe(ve.customFieldId);return jsx(ps,{value:ct?new Date(ct):void 0,onChange:te=>at(ve.customFieldId,te),isDark:x,locale:p});case "dropdown":return jsx(Um,{value:Fe(ve.customFieldId)||"",options:ve.options||[],onChange:te=>at(ve.customFieldId,te),isDark:x});case "checkbox":return jsx(Hm,{value:Fe(ve.customFieldId)||false,onChange:te=>at(ve.customFieldId,te),isDark:x});default:return jsx("span",{className:l("text-sm",x?"text-[#94A3B8]":"text-gray-500"),children:"-"})}},[a,x,p,c,u]),Pt=useCallback(J=>({name:u.columns.name,status:u.columns.status,priority:u.columns.priority,assignees:u.columns.assignees,startDate:u.columns.startDate,endDate:u.columns.endDate,progress:u.columns.progress})[J.type]||J.label,[u]),Le=useMemo(()=>Ye.reduce((J,ve)=>J+ve.width,0)+(C?48:0),[Ye,C]);return r?jsx("div",{className:l("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxs("p",{className:l("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:[u.empty.noTasks,"..."]})]})}):o?jsx("div",{className:l("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxs("div",{children:[jsx("h3",{className:l("text-lg font-semibold mb-2",x?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:l("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsx("div",{className:l("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsx(List,{className:"w-8 h-8 text-[#3B82F6]"})}),jsx("h3",{className:l("text-lg font-semibold mb-2",x?"text-white":"text-gray-900"),children:u.empty.noTasks}),jsx("p",{className:l("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:u.empty.addFirstTask})]})}):jsxs("div",{ref:se,className:l("flex-1 flex flex-col w-full h-full overflow-hidden",x?"bg-[#0F1117]":"bg-white",R&&"select-none",s),style:n,children:[jsx("div",{className:l("flex-shrink-0 px-6 py-4 border-b",x?"border-white/10":"border-gray-200"),children:jsxs("div",{className:"flex items-center gap-4",children:[jsx(op,{value:A,hideCompleted:H,onChange:T,onHideCompletedChange:O,isDark:x,locale:p}),f&&jsxs("div",{className:"relative flex-1 max-w-md",children:[jsx(Search,{className:l("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",x?"text-[#9CA3AF]":"text-gray-400")}),jsx("input",{type:"text",value:v,onChange:J=>I(J.target.value),placeholder:u.toolbar.searchPlaceholder,className:l("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",x?"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:l("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:[je.length," ",u.pagination.tasks]})]})}),jsx("div",{className:"flex-1 overflow-auto",children:jsxs("div",{style:{minWidth:Le},children:[jsxs("div",{className:l("flex-shrink-0 flex items-center border-b text-xs font-medium uppercase tracking-wider sticky top-0 z-10",x?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[Ye.map(J=>jsxs("div",{className:l("relative flex items-center gap-2 px-4 py-3",x?"text-[#9CA3AF]":"text-gray-500"),style:{width:J.width,minWidth:J.minWidth},onContextMenu:ve=>xt(ve,void 0,J.id),children:[J.sortable?jsxs("button",{onClick:()=>ie(J.id),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[Pt(J),jsx(ArrowUpDown,{className:l("w-3 h-3",m===J.id&&"text-[#3B82F6]")})]}):jsx("span",{children:Pt(J)}),h&&J.resizable&&jsx("div",{className:l("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#3B82F6]",R===J.id&&"bg-[#3B82F6]"),onMouseDown:ve=>be(ve,J.id)})]},J.id)),C&&jsxs("div",{className:"relative flex items-center justify-center px-3 py-3",children:[jsx("button",{onClick:J=>{J.stopPropagation(),re(ve=>!ve);},className:l("p-1.5 rounded-lg transition-colors",x?"hover:bg-white/10 text-[#9CA3AF] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",ne&&(x?"bg-white/10":"bg-gray-200")),title:p==="es"?"Agregar columna":"Add column",children:jsx(Plus,{className:"w-4 h-4"})}),jsx(Qm,{isOpen:ne,onClose:()=>re(false),columns:j,customFields:g,onColumnsChange:Je,onCreateCustomField:()=>{re(false),fe(true);},isDark:x,locale:p})]})]}),jsx(AnimatePresence,{children:je.map((J,ve)=>{let Ue=Be.has(J.id);return jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:ve*.02},className:l("flex items-center border-b transition-colors",x?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),onClick:()=>a.onTaskClick?.(J),onDoubleClick:()=>a.onTaskDoubleClick?.(J),onContextMenu:Fe=>xt(Fe,J),children:[Ye.map(Fe=>jsx("div",{className:"flex items-center px-4 py-3 min-h-[52px]",style:{width:Fe.width,minWidth:Fe.minWidth},children:Fe.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[y&&J.level>0&&jsx("div",{style:{width:`${J.level*24}px`},className:"flex-shrink-0"}),y&&J.hasChildren&&jsx("button",{onClick:at=>{at.stopPropagation(),tt(J.id);},className:l("p-0.5 rounded flex-shrink-0",x?"hover:bg-white/10":"hover:bg-gray-200"),children:Ue?jsx(ChevronDown,{className:l("w-4 h-4",x?"text-[#9CA3AF]":"text-gray-400")}):jsx(ChevronRight,{className:l("w-4 h-4",x?"text-[#9CA3AF]":"text-gray-400")})}),y&&!J.hasChildren&&jsx("div",{className:"w-5 flex-shrink-0"}),jsx("button",{onClick:at=>{at.stopPropagation(),a.onTaskUpdate?.({...J,progress:J.progress===100?0:100,status:J.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsx(av,{status:J.status,progress:J.progress})}),jsx("span",{className:l("truncate font-medium",x?"text-white":"text-gray-900",J.progress===100&&(x?"line-through text-[#6B7280]":"line-through text-gray-400")),children:J.name})]}):Ze(J,Fe)},Fe.id)),C&&jsx("div",{className:"w-12 flex-shrink-0"})]},J.id)})}),je.length===0&&v&&jsx("div",{className:"flex items-center justify-center py-12",children:jsxs("div",{className:"text-center",children:[jsx(List,{className:l("w-12 h-12 mx-auto mb-4",x?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:l(x?"text-[#9CA3AF]":"text-gray-600"),children:u.empty.noResults})]})})]})}),jsx(Ym,{state:Ie,onClose:$,isDark:x,locale:p,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:mt,onColumnSort:Ct,availableUsers:c}),jsx(ap,{isOpen:ge,onClose:()=>fe(false),onSave:Pe,isDark:x,locale:p})]})}var dp=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:120,visible:true,sortable:true,resizable:true},{id:"priority",type:"priority",label:"Priority",width:100,visible:false,sortable:true,resizable:true},{id:"assignees",type:"assignees",label:"Assignees",width:150,visible:false,sortable:false,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true},{id:"tags",type:"tags",label:"Tags",width:150,visible:false,sortable:false,resizable:true}],cp=[{type:"name",labelKey:"columns.name",icon:"Type"},{type:"status",labelKey:"columns.status",icon:"CircleDot"},{type:"priority",labelKey:"columns.priority",icon:"Flag"},{type:"assignees",labelKey:"columns.assignees",icon:"Users"},{type:"startDate",labelKey:"columns.startDate",icon:"Calendar"},{type:"endDate",labelKey:"columns.endDate",icon:"CalendarCheck"},{type:"progress",labelKey:"columns.progress",icon:"BarChart"},{type:"tags",labelKey:"columns.tags",icon:"Tag"}],mp=[{type:"text",labelKey:"customFields.text",icon:"Type"},{type:"number",labelKey:"customFields.number",icon:"Hash"},{type:"date",labelKey:"customFields.date",icon:"Calendar"},{type:"dropdown",labelKey:"customFields.dropdown",icon:"ChevronDown"},{type:"checkbox",labelKey:"customFields.checkbox",icon:"CheckSquare"}];var ml={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"},pl={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"},ul={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"},fs={dark:ml,light:pl,neutral:ul};function pp(e){return fs[e]||fs.dark}var gl={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"}},fl={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"}},bs={en:gl,es:fl};function ln(e){return bs[e]||bs.en}function hs(e,t){let a=ln(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 up(e){let t=ln(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 gp(e,t=0,a=true){let r=ln(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 kv(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 kl(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 vp({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 kp({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:c,availableTags:g=[],onCreateTag:i,attachmentsByTask:p,comments:d,onAddComment:f,currentUser:y,mentionableUsers:k,onTaskOpen:C}){let{theme:h="dark",locale:b="en",customTranslations:u}=t,x=hs(b,u),m=h==="dark",N={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,B]=useState(r||new Date),[v,I]=useState(null),[A,T]=useState(null),[H,O]=useState(null),[j,ae]=useState(new Date),[ne,re]=useState({}),ge=4,fe=3,[Ie,M]=useState(false),[R,L]=useState(false),[V,q]=useState(false),[z,ye]=useState(false),[se,Be]=useState(null),[Ye,tt]=useState(""),[ie,Je]=useState(void 0),[mt,Ct]=useState(null),[xt,$]=useState(false),[be,Pe]=useState(false),[Me,je]=useState(null),[Ze,Pt]=useState(false),[Le,J]=useState(new Date),[ve,Ue]=useState(false),[Fe,at]=useState(false),[ct,te]=useState(false),[$e,Kt]=useState(""),[Qe,Ke]=useState(false),[F,Ce]=useState(""),[Z,xe]=useState(false),we=useCallback(()=>{B(new Date(w.getFullYear(),w.getMonth()-1,1));},[w]),ze=useCallback(()=>{B(new Date(w.getFullYear(),w.getMonth()+1,1));},[w]),Re=useCallback(()=>{B(new Date);},[]),dt=useMemo(()=>{let P=w.getFullYear(),_=w.getMonth(),Ee=new Date(P,_,1),Xe=new Date(P,_+1,0),At=Ee.getDay(),de=Xe.getDate(),_e=kv(e),kt=new Date;kt.setHours(0,0,0,0);let Oe=[],bt=At,va=new Date(P,_,0).getDate();for(let Yt=bt-1;Yt>=0;Yt--){let qe=new Date(P,_-1,va-Yt);Oe.push({date:qe,isCurrentMonth:false,isToday:false,isWeekend:qe.getDay()===0||qe.getDay()===6,events:_e.filter(qt=>kl(qe,qt)).map(qt=>({id:qt.id,title:qt.name,start:qt.startDate,end:qt.endDate,task:qt}))});}for(let Yt=1;Yt<=de;Yt++){let qe=new Date(P,_,Yt),qt=qe.getTime()===kt.getTime();Oe.push({date:qe,isCurrentMonth:true,isToday:qt,isWeekend:qe.getDay()===0||qe.getDay()===6,events:_e.filter(ga=>kl(qe,ga)).map(ga=>({id:ga.id,title:ga.name,start:ga.startDate,end:ga.endDate,task:ga}))});}let Ca=42-Oe.length;for(let Yt=1;Yt<=Ca;Yt++){let qe=new Date(P,_+1,Yt);Oe.push({date:qe,isCurrentMonth:false,isToday:false,isWeekend:qe.getDay()===0||qe.getDay()===6,events:_e.filter(qt=>kl(qe,qt)).map(qt=>({id:qt.id,title:qt.name,start:qt.startDate,end:qt.endDate,task:qt}))});}return Oe},[w,e]),U=b==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Y=w.toLocaleDateString(b==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),me=useCallback((P,_)=>{if(!v)return;let Ee={...v,[P]:_};I(Ee),a.onTaskUpdate?.(Ee);},[v,a]),Ve=useCallback(P=>{if(!v)return;let _=v.progress||0;P==="completed"?_=100:P==="todo"&&(_=0);let Ee={...v,status:P,progress:_};I(Ee),a.onTaskUpdate?.(Ee),M(false);},[v,a]),He=useCallback((P,_)=>{if(!v)return;let Ee={...v,startDate:P,endDate:_};I(Ee),a.onTaskUpdate?.(Ee);},[v,a]),W=useCallback(()=>{M(false),L(false),q(false),O(null),te(false),Kt(""),Ke(false);},[]),le=useCallback(async P=>{if(P.preventDefault(),P.stopPropagation(),Ue(false),!v||!a.onUploadAttachments)return;let _=Array.from(P.dataTransfer.files);if(_.length!==0){at(true);try{await a.onUploadAttachments(v.id,_);}finally{at(false);}}},[v,a]),We=useCallback(async P=>{if(!v||!a.onUploadAttachments||!P.target.files)return;let _=Array.from(P.target.files);if(_.length!==0){at(true);try{await a.onUploadAttachments(v.id,_);}finally{at(false);}P.target.value="";}},[v,a]),It=useCallback(P=>{P.preventDefault(),P.stopPropagation(),Ue(true);},[]),st=useCallback(P=>{P.preventDefault(),P.stopPropagation(),Ue(false);},[]),ya=useCallback(P=>P<1024?`${P} B`:P<1024*1024?`${(P/1024).toFixed(1)} KB`:`${(P/(1024*1024)).toFixed(1)} MB`,[]),Ua=useCallback(P=>P.startsWith("image/")?Image:P.includes("pdf")||P.includes("document")?FileText:File,[]),ut=useMemo(()=>!v||!p?[]:p.get(v.id)||[],[v,p]);return o?jsx("div",{className:l("flex-1 flex items-center justify-center",m?"bg-[#0F1117]":"bg-white",n),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:l("text-sm",m?"text-[#9CA3AF]":"text-gray-600"),children:[x.labels.noEvents,"..."]})]})}):s?jsx("div",{className:l("flex-1 flex items-center justify-center",m?"bg-[#0F1117]":"bg-white",n),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:l("text-lg font-semibold mb-2",m?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:l("text-sm",m?"text-[#9CA3AF]":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsx("div",{className:l("flex-1 flex items-center justify-center",m?"bg-[#0F1117]":"bg-white",n),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:l("text-lg font-semibold mb-2",m?"text-white":"text-gray-900"),children:x.labels.noEvents}),jsx("p",{className:l("text-sm",m?"text-[#9CA3AF]":"text-gray-600"),children:x.labels.newTask})]})}):jsxs("div",{className:l("flex-1 flex flex-col w-full h-full overflow-auto",m?"bg-[#0F1117]":"bg-white",n),style:c,children:[jsx("div",{className:l("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:l("text-xl font-semibold capitalize",m?"text-white":"text-gray-900"),children:Y}),jsx("button",{onClick:Re,className:l("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:x.navigation.today})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("button",{onClick:we,className:l("p-2 rounded-lg transition-colors",m?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:l("w-5 h-5",m?"text-[#9CA3AF]":"text-gray-600")})}),jsx("button",{onClick:ze,className:l("p-2 rounded-lg transition-colors",m?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:l("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:U.map(P=>jsx("div",{className:l("py-2 text-center text-xs font-medium uppercase",m?"text-[#9CA3AF]":"text-gray-500"),children:P},P))}),jsx("div",{className:l("grid grid-cols-7 auto-rows-min gap-px rounded-lg",m?"bg-[#2D2D2D]":"bg-gray-300"),children:dt.map((P,_)=>{let Ee=P.date.getDay()===0||P.date.getDay()===6;return jsxs("div",{className:l("min-h-[120px] p-2 transition-colors flex flex-col relative group",m?Ee?"bg-[#1C1F26]":P.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":Ee?"bg-gray-100":P.isCurrentMonth?"bg-white":"bg-gray-50",P.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let Xe=ne[_]||ge,At=P.events.slice(0,Xe),de=P.events.length-Xe;return jsxs("div",{className:"space-y-1 flex-1",children:[At.map(_e=>jsx("div",{className:"relative group",children:jsxs(motion.button,{onClick:()=>{I(_e.task),a.onEventClick?.(_e),C?.(_e.task.id);},whileHover:{scale:1.02},className:l("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",_e.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(vp,{task:_e.task}),jsx("span",{className:"truncate",children:_e.title})]})},_e.id)),de>0&&jsxs("button",{onClick:_e=>{_e.stopPropagation(),re(kt=>({...kt,[_]:Xe+fe}));},className:l("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:["+",de," ",b==="es"?"M\xC1S":"MORE"]}),Xe>ge&&P.events.length>ge&&jsx("button",{onClick:_e=>{_e.stopPropagation(),re(kt=>({...kt,[_]:ge}));},className:l("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:b==="es"?"MENOS":"LESS"})]})})(),jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let Xe=_>=28,At=_%7>=5;return jsxs("div",{className:"relative",children:[jsx("button",{onClick:de=>{de.stopPropagation(),se===_?Be(null):(Be(_),tt(""),Je(void 0),Ct(null),je(null),$(false),Pe(false),Pt(false),J(P.date));},className:l("w-5 h-5 rounded flex items-center justify-center transition-all",se===_?"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:l("w-3.5 h-3.5 transition-transform",se===_&&"rotate-45")})}),jsx(AnimatePresence,{children:se===_&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Be(null),tt(""),Je(void 0),Ct(null),je(null),$(false),Pe(false),Pt(false);}}),jsxs(motion.div,{initial:{opacity:0,y:Xe?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:Xe?-5:5,scale:.95},transition:{duration:.12},className:l("absolute w-[320px] rounded-lg shadow-2xl z-50",Xe?"bottom-full mb-1":"top-full mt-1",At?"right-0":"left-0",m?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:de=>{de.stopPropagation(),$(false),Pe(false),Pt(false);},children:[jsx("div",{className:"p-2.5",children:jsx("input",{type:"text",value:Ye,onChange:de=>tt(de.target.value),placeholder:b==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:l("w-full bg-transparent text-sm outline-none placeholder:opacity-40",m?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:de=>{if(de.key==="Enter"&&Ye.trim()){let _e=t.availableUsers?.find(Oe=>Oe.id===mt),kt=Me||P.date;a.onTaskCreate?.({name:Ye.trim(),startDate:kt,endDate:kt,priority:ie,assignees:_e?[_e]:void 0}),tt(""),Je(void 0),Ct(null),je(null),Be(null);}de.key==="Escape"&&(Be(null),tt(""),Je(void 0),Ct(null),je(null));}})}),jsxs("div",{className:l("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:de=>{de.stopPropagation(),$(!xt),Pe(false);},className:l("p-1 rounded transition-colors",ie?ie==="urgent"||ie==="high"?"text-red-400 bg-red-500/20":ie==="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:xt&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:l("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:de=>de.stopPropagation(),children:[{id:"urgent",label:b==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:b==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:b==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:b==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:b==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(de=>jsxs("button",{onClick:()=>{Je(de.id),$(false);},className:l("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",ie===de.id&&(m?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:l("w-2 h-2 rounded-full",de.color)}),jsx("span",{className:m?"text-white":"text-gray-900",children:de.label})]},de.id||"none"))})})]}),jsxs("div",{className:"relative",children:[jsxs("button",{onClick:de=>{de.stopPropagation(),Pt(!Ze),$(false),Pe(false),J(Me||P.date);},className:l("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",Me?"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"}),(Me||P.date).toLocaleDateString(b==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsx(AnimatePresence,{children:Ze&&jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:l("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:de=>de.stopPropagation(),children:[jsx("div",{className:l("w-40 py-2 border-r",m?"border-white/10":"border-gray-200"),children:(()=>{let de=new Date,_e=new Date(de);_e.setDate(de.getDate()+1);let kt=new Date(de);kt.setDate(de.getDate()+((6-de.getDay()+7)%7||7));let Oe=new Date(de);Oe.setDate(de.getDate()+((1-de.getDay()+7)%7||7));let bt=new Date(de);bt.setDate(de.getDate()+14);let va=new Date(de);return va.setDate(de.getDate()+28),[{label:b==="es"?"Hoy":"Today",date:de,display:de.toLocaleDateString(b==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:b==="es"?"Ma\xF1ana":"Tomorrow",date:_e,display:_e.toLocaleDateString(b==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:b==="es"?"Este fin de semana":"This weekend",date:kt,display:b==="es"?"s\xE1b.":"sat."},{label:b==="es"?"Pr\xF3xima semana":"Next week",date:Oe,display:b==="es"?"lun.":"mon."},{label:b==="es"?"2 semanas":"2 weeks",date:bt,display:bt.toLocaleDateString(b==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:b==="es"?"4 semanas":"4 weeks",date:va,display:va.toLocaleDateString(b==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Yt,qe)=>jsxs("button",{className:l("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:()=>{je(Yt.date),Pt(false);},children:[jsx("span",{children:Yt.label}),jsx("span",{className:l("text-[10px]",m?"text-[#6B7280]":"text-gray-400"),children:Yt.display})]},qe))})()}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("span",{className:l("text-xs font-medium",m?"text-white":"text-gray-900"),children:Le.toLocaleDateString(b==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{onClick:()=>J(new Date),className:l("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:b==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>J(new Date(Le.getFullYear(),Le.getMonth()-1)),className:l("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:()=>J(new Date(Le.getFullYear(),Le.getMonth()+1)),className:l("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:(b==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(de=>jsx("div",{className:l("w-6 h-6 flex items-center justify-center text-[10px]",m?"text-[#6B7280]":"text-gray-400"),children:de},de))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let de=Le.getFullYear(),_e=Le.getMonth(),kt=new Date(de,_e,1).getDay(),Oe=new Date(de,_e+1,0).getDate(),bt=new Date(de,_e,0).getDate(),va=new Date,Ca=[];for(let qe=kt-1;qe>=0;qe--)Ca.push({dayNum:bt-qe,isCurrentMonth:false,date:new Date(de,_e-1,bt-qe)});for(let qe=1;qe<=Oe;qe++)Ca.push({dayNum:qe,isCurrentMonth:true,date:new Date(de,_e,qe)});let Yt=42-Ca.length;for(let qe=1;qe<=Yt;qe++)Ca.push({dayNum:qe,isCurrentMonth:false,date:new Date(de,_e+1,qe)});return Ca.map((qe,qt)=>{let ga=qe.date.toDateString()===va.toDateString(),Fr=(Me||P.date).toDateString()===qe.date.toDateString();return jsx("button",{className:l("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!qe.isCurrentMonth&&(m?"text-[#4B5563]":"text-gray-300"),qe.isCurrentMonth&&(m?"text-white":"text-gray-900"),ga&&"ring-1 ring-[#3B82F6]",Fr&&"bg-[#7C3AED] text-white",!Fr&&(m?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{je(qe.date),Pt(false);},children:qe.dayNum},qt)})})()})]})]})})]}),jsxs("div",{className:"relative",children:[jsx("button",{onClick:de=>{de.stopPropagation(),Pe(!be),$(false);},className:l("p-1 rounded transition-colors",mt?"text-[#7C3AED] bg-[#7C3AED]/20":m?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:mt?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(de=>de.id===mt)?.color||"#7C3AED"},children:t.availableUsers?.find(de=>de.id===mt)?.initials||t.availableUsers?.find(de=>de.id===mt)?.name?.slice(0,2).toUpperCase()}):jsx(User,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:be&&jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:l("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:de=>de.stopPropagation(),children:[jsxs("button",{onClick:()=>{Ct(null),Pe(false);},className:l("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",!mt&&(m?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:l("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:b==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(de=>jsxs("button",{onClick:()=>{Ct(de.id),Pe(false);},className:l("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",mt===de.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:de.color||"#7C3AED"},children:de.initials||de.name?.slice(0,2).toUpperCase()}),jsx("span",{className:m?"text-white":"text-gray-900",children:de.name})]},de.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsx("div",{className:l("px-3 py-2 text-xs",m?"text-[#6B7280]":"text-gray-400"),children:b==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsx("button",{onClick:()=>{if(Ye.trim()){let de=t.availableUsers?.find(kt=>kt.id===mt),_e=Me||P.date;a.onTaskCreate?.({name:Ye.trim(),startDate:_e,endDate:_e,priority:ie,assignees:de?[de]:void 0}),tt(""),Je(void 0),Ct(null),je(null),Be(null);}},disabled:!Ye.trim(),className:l("px-2.5 py-1 rounded text-xs font-medium transition-colors",Ye.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":m?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:b==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsx("span",{className:l("text-sm font-medium",P.isToday?"text-[#3B82F6]":P.isCurrentMonth?m?"text-white":"text-gray-900":m?"text-[#6B7280]":"text-gray-400"),children:P.date.getDate()})]})]},_)})})]})}),jsx(AnimatePresence,{children:v&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>{I(null),Ce("");},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:l("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:l("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:l("w-4 h-4",m?"text-[#9CA3AF]":"text-gray-500")}),jsxs("span",{className:l("text-xs px-2 py-0.5 rounded",m?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[b==="es"?"Tarea":"Task"," \u2228"]}),jsx("span",{className:l("text-xs font-mono",m?"text-[#6B7280]":"text-gray-400"),children:v.id.slice(0,8)}),jsxs("button",{className:l("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:l("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:l("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:()=>{I(null),Ce("");},className:l("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 P=v.progress===100?0:100,Ee={...v,progress:P,status:P===100?"completed":"todo"};I(Ee),a.onTaskUpdate?.(Ee);},className:l("mt-1 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors",v.progress===100?"bg-green-500 border-green-500":m?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:v.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("h2",{className:l("text-xl font-semibold flex-1",v.progress===100?"line-through text-[#6B7280]":m?"text-white":"text-gray-900"),children:v.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:l("w-4 h-4",m?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:l("text-sm w-24",m?"text-[#9CA3AF]":"text-gray-500"),children:b==="es"?"Estado":"Status"}),jsx("button",{onClick:()=>{W(),M(!Ie);},className:l("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",v.progress===100||v.status==="completed"?"bg-green-500/20 text-green-400":v.progress&&v.progress>0||v.status==="in-progress"?"bg-blue-500/20 text-blue-400":m?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:v.progress===100||v.status==="completed"?b==="es"?"COMPLETADO":"DONE":v.progress&&v.progress>0||v.status==="in-progress"?b==="es"?"EN PROGRESO":"IN PROGRESS":b==="es"?"POR HACER":"TO DO"}),jsx(AnimatePresence,{children:Ie&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>M(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:l("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:b==="es"?"Por hacer":"To Do",color:"bg-white/10 text-white"},{id:"in-progress",label:b==="es"?"En progreso":"In Progress",color:"bg-blue-500/20 text-blue-400"},{id:"completed",label:b==="es"?"Completado":"Done",color:"bg-green-500/20 text-green-400"}].map(P=>jsxs("button",{onClick:()=>Ve(P.id),className:l("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",(v.status===P.id||P.id==="completed"&&v.progress===100||P.id==="in-progress"&&v.progress&&v.progress>0&&v.progress<100||P.id==="todo"&&(!v.progress||v.progress===0)&&v.status!=="in-progress"&&v.status!=="completed")&&(m?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:l("w-2 h-2 rounded-full",P.id==="completed"?"bg-green-500":P.id==="in-progress"?"bg-blue-500":"bg-gray-400")}),jsx("span",{className:m?"text-white":"text-gray-900",children:P.label})]},P.id))})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(User,{className:l("w-4 h-4",m?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:l("text-sm w-24",m?"text-[#9CA3AF]":"text-gray-500"),children:b==="es"?"Asignados":"Assignees"}),jsxs("button",{onClick:()=>{M(false),L(false),O(null),q(!V);},className:l("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:[v.assignees&&v.assignees.length>0?jsxs("div",{className:"flex items-center gap-1",children:[v.assignees.slice(0,3).map((P,_)=>jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:P.color||"#8B5CF6"},title:P.name,children:P.initials||P.name.slice(0,2).toUpperCase()},_)),v.assignees.length>3&&jsxs("span",{className:l("text-xs",m?"text-[#6B7280]":"text-gray-400"),children:["+",v.assignees.length-3]})]}):jsx("span",{className:l("text-sm",m?"text-[#6B7280]":"text-gray-400"),children:b==="es"?"Agregar":"Add"}),jsx(ChevronDown,{className:l("w-3 h-3",m?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:V&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>q(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:l("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(P=>{let _=v.assignees?.some(Ee=>Ee.name===P.name);return jsxs("button",{onClick:()=>{let Ee=v.assignees||[],Xe;_?Xe=Ee.filter(At=>At.name!==P.name):Xe=[...Ee,{name:P.name,avatar:P.avatar,initials:P.initials||P.name.slice(0,2).toUpperCase(),color:P.color||"#8B5CF6"}],me("assignees",Xe);},className:l("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",m?"hover:bg-white/5":"hover:bg-gray-50",_&&(m?"bg-white/5":"bg-gray-50")),children:[P.avatar?jsx("img",{src:P.avatar,alt:P.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:P.color||"#8B5CF6"},children:P.initials||P.name.slice(0,2).toUpperCase()}),jsx("span",{className:l("flex-1 text-left",m?"text-white":"text-gray-900"),children:P.name}),_&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},P.id||P.name)}):jsx("div",{className:l("px-3 py-4 text-sm text-center",m?"text-[#6B7280]":"text-gray-400"),children:b==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CalendarDays,{className:l("w-4 h-4",m?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:l("text-sm w-24",m?"text-[#9CA3AF]":"text-gray-500"),children:b==="es"?"Fechas":"Dates"}),jsxs("button",{onClick:()=>{O(H?null:"start"),ae(v.startDate||new Date);},className:l("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:[v.startDate?.toLocaleDateString(b==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(b==="es"?"Inicio":"Start"),jsx("span",{className:l("mx-1",m?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),v.endDate?.toLocaleDateString(b==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(b==="es"?"Fin":"End"),(v.startDate||v.endDate)&&jsx(X,{className:"w-3.5 h-3.5 ml-1 opacity-50 hover:opacity-100",onClick:P=>{P.stopPropagation();}})]}),jsx(AnimatePresence,{children:H&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>O(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:l("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:P=>P.stopPropagation(),children:[jsxs("div",{className:l("w-44 py-2 border-r",m?"border-white/10":"border-gray-200"),children:[(()=>{let P=new Date,_=new Date(P);_.setDate(P.getDate()+1);let Ee=new Date(P);Ee.setDate(P.getDate()+((6-P.getDay()+7)%7||7));let Xe=new Date(P);Xe.setDate(P.getDate()+((1-P.getDay()+7)%7||7));let At=new Date(P);At.setDate(P.getDate()+(6-P.getDay()+7)%7+7);let de=new Date(P);de.setDate(P.getDate()+14);let _e=new Date(P);return _e.setDate(P.getDate()+28),[{label:b==="es"?"Hoy":"Today",date:P,display:P.toLocaleDateString(b==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:b==="es"?"Ma\xF1ana":"Tomorrow",date:_,display:_.toLocaleDateString(b==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:b==="es"?"Este fin de semana":"This weekend",date:Ee,display:b==="es"?"s\xE1b.":"sat."},{label:b==="es"?"Pr\xF3xima semana":"Next week",date:Xe,display:b==="es"?"lun.":"mon."},{label:b==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:At,display:At.toLocaleDateString(b==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:b==="es"?"2 semanas":"2 weeks",date:de,display:de.toLocaleDateString(b==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:b==="es"?"4 semanas":"4 weeks",date:_e,display:_e.toLocaleDateString(b==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Oe,bt)=>jsxs("button",{className:l("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(H==="start"){let va=v.endDate&&Oe.date>v.endDate?Oe.date:v.endDate;He(Oe.date,va),O("end");}else {let va=v.startDate&&Oe.date<v.startDate?Oe.date:v.startDate;He(va,Oe.date),O(null);}},children:[jsx("span",{children:Oe.label}),jsx("span",{className:l("text-xs",m?"text-[#6B7280]":"text-gray-400"),children:Oe.display})]},bt))})(),jsx("div",{className:l("border-t mt-2 pt-2",m?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{He(void 0,void 0),O(null);},className:l("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:b==="es"?"Quitar fechas":"Clear dates"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[jsx("div",{className:l("text-xs mb-3 px-2 py-1 rounded",m?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:H==="start"?b==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":b==="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:l("font-medium",m?"text-white":"text-gray-900"),children:j.toLocaleDateString(b==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>ae(new Date),className:l("p-1 rounded text-sm transition-colors",m?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:b==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>ae(new Date(j.getFullYear(),j.getMonth()-1)),className:l("p-1 rounded",m?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-4 h-4"})}),jsx("button",{onClick:()=>ae(new Date(j.getFullYear(),j.getMonth()+1)),className:l("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:(b==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(P=>jsx("div",{className:l("w-8 h-8 flex items-center justify-center text-xs",m?"text-[#6B7280]":"text-gray-400"),children:P},P))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let P=j.getFullYear(),_=j.getMonth(),Ee=new Date(P,_,1).getDay(),Xe=new Date(P,_+1,0).getDate(),At=new Date(P,_,0).getDate(),de=new Date,_e=[];for(let Oe=Ee-1;Oe>=0;Oe--)_e.push({day:At-Oe,isCurrentMonth:false,date:new Date(P,_-1,At-Oe)});for(let Oe=1;Oe<=Xe;Oe++)_e.push({day:Oe,isCurrentMonth:true,date:new Date(P,_,Oe)});let kt=42-_e.length;for(let Oe=1;Oe<=kt;Oe++)_e.push({day:Oe,isCurrentMonth:false,date:new Date(P,_+1,Oe)});return _e.map((Oe,bt)=>{let va=Oe.date.toDateString()===de.toDateString(),Ca=v.startDate?.toDateString()===Oe.date.toDateString(),Yt=v.endDate?.toDateString()===Oe.date.toDateString(),qe=Ca||Yt,qt=v.startDate&&v.endDate&&Oe.date>=v.startDate&&Oe.date<=v.endDate;return jsx("button",{className:l("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!Oe.isCurrentMonth&&(m?"text-[#4B5563]":"text-gray-300"),Oe.isCurrentMonth&&(m?"text-white":"text-gray-900"),va&&"ring-2 ring-[#3B82F6]",Ca&&"bg-[#3B82F6] text-white",Yt&&!Ca&&"bg-[#7C3AED] text-white",qt&&!qe&&(m?"bg-[#7C3AED]/20":"bg-purple-100"),!qe&&(m?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{let ga=new Date(Oe.date);if(H==="start"){let Fr=v.endDate&&ga>v.endDate?ga:v.endDate;He(ga,Fr),O("end");}else {let Fr=v.startDate&&ga<v.startDate?ga:v.startDate;He(Fr,ga),O(null);}},children:Oe.day},bt)})})()})]})]})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Flag,{className:l("w-4 h-4",m?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:l("text-sm w-24",m?"text-[#9CA3AF]":"text-gray-500"),children:b==="es"?"Prioridad":"Priority"}),jsx("button",{onClick:()=>{W(),L(!R);},className:l("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",v.priority==="high"||v.priority==="urgent"?"bg-red-500/20 text-red-400":v.priority==="medium"?"bg-yellow-500/20 text-yellow-400":v.priority==="low"?"bg-green-500/20 text-green-400":m?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:v.priority?v.priority==="high"||v.priority==="urgent"?b==="es"?"Urgente":"Urgent":v.priority==="medium"?b==="es"?"Media":"Medium":b==="es"?"Baja":"Low":b==="es"?"Sin prioridad":"No priority"}),jsx(AnimatePresence,{children:R&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>L(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:l("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:b==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:b==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:b==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:b==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:b==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(P=>jsxs("button",{onClick:()=>{me("priority",P.id),L(false);},className:l("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",v.priority===P.id&&(m?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:l("w-2 h-2 rounded-full",P.color)}),jsx("span",{className:m?"text-white":"text-gray-900",children:P.label})]},P.id||"none"))})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:l("w-4 h-4",m?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:l("text-sm w-24",m?"text-[#9CA3AF]":"text-gray-500"),children:b==="es"?"Duraci\xF3n":"Duration"}),jsx("span",{className:l("text-sm",m?"text-white":"text-gray-900"),children:v.startDate&&v.endDate?`${Math.ceil((v.endDate.getTime()-v.startDate.getTime())/(1e3*60*60*24))} ${b==="es"?"d\xEDas":"days"}`:b==="es"?"Sin definir":"Not set"})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:l("w-4 h-4 rounded-full border-2",m?"border-[#6B7280]":"border-gray-400")}),jsx("span",{className:l("text-sm w-24",m?"text-[#9CA3AF]":"text-gray-500"),children:b==="es"?"Progreso":"Progress"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[z?jsx("input",{type:"range",min:"0",max:"100",step:"5",value:v.progress||0,onChange:P=>{let _=parseInt(P.target.value),Ee=v.status;_===100?Ee="completed":_>0?Ee="in-progress":Ee="todo";let Xe={...v,progress:_,status:Ee};I(Xe),a.onTaskUpdate?.(Xe);},onBlur:()=>ye(false),className:l("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:()=>ye(true),className:l("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:l("h-full rounded-full transition-all",v.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${v.progress||0}%`}})}),jsxs("span",{className:l("text-sm font-medium min-w-[40px]",m?"text-white":"text-gray-900"),children:[v.progress||0,"%"]})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Tag,{className:l("w-4 h-4",m?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:l("text-sm w-24",m?"text-[#9CA3AF]":"text-gray-500"),children:b==="es"?"Etiquetas":"Tags"}),jsx(yr,{selectedTags:v.tags||[],availableTags:g,onChange:P=>{me("tags",P);},onCreateTag:i,theme:N})]}),jsxs("div",{className:"flex items-start gap-3 relative",children:[jsx(Link2,{className:l("w-4 h-4 mt-1.5",m?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:l("text-sm w-24 mt-1",m?"text-[#9CA3AF]":"text-gray-500"),children:b==="es"?"Relaciones":"Relations"}),jsxs("div",{className:"flex-1",children:[v.dependencies&&v.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:v.dependencies.map(P=>{let _=e.find(Ee=>Ee.id===P);return jsxs("span",{className:l("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:[_?.name||P.slice(0,8),jsx("button",{onClick:()=>{let Ee=(v.dependencies||[]).filter(Xe=>Xe!==P);me("dependencies",Ee);},className:l("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsx(X,{className:"w-3 h-3"})})]},P)})}),jsxs("button",{onClick:()=>{W(),te(!ct);},className:l("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:l("text-sm",m?"text-[#9CA3AF]":"text-gray-500"),children:b==="es"?"Agregar dependencia":"Add dependency"})]}),jsx(AnimatePresence,{children:ct&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{te(false),Kt("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:l("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:l("p-2 border-b",m?"border-white/10":"border-gray-200"),children:jsx("input",{type:"text",value:$e,onChange:P=>Kt(P.target.value),placeholder:b==="es"?"Buscar tarea...":"Search task...",className:l("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(P=>P.id!==v.id).filter(P=>$e===""||P.name.toLowerCase().includes($e.toLowerCase())).map(P=>{let _=v.dependencies?.includes(P.id);return jsxs("button",{onClick:()=>{let Ee=v.dependencies||[],Xe;_?Xe=Ee.filter(At=>At!==P.id):Xe=[...Ee,P.id],me("dependencies",Xe);},className:l("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",_&&(m?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:l("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",_?"bg-blue-500 border-blue-500":m?"border-white/30":"border-gray-300"),children:_&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:l("block truncate",m?"text-white":"text-gray-900"),children:P.name}),jsx("span",{className:l("text-xs",m?"text-[#6B7280]":"text-gray-400"),children:P.id.slice(0,8)})]})]},P.id)}):jsx("div",{className:l("px-3 py-4 text-sm text-center",m?"text-[#6B7280]":"text-gray-500"),children:b==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Palette,{className:l("w-4 h-4",m?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:l("text-sm w-24",m?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxs("button",{onClick:()=>{W(),Ke(!Qe);},className:l("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("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:v.color||"#6366F1"}}),jsx("span",{className:l("text-sm",m?"text-white":"text-gray-900"),children:vr.find(P=>P.value===v.color)?.name||(b==="es"?"Azul":"Blue")}),jsx(ChevronDown,{className:l("w-3 h-3",m?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:Qe&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ke(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:l("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",m?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-6 gap-1.5",children:vr.map(P=>{let _=v.color===P.value;return jsx("button",{onClick:()=>{me("color",P.value),Ke(false);},className:l("w-7 h-7 rounded-full flex items-center justify-center transition-all",_&&"ring-2 ring-offset-2",m?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:P.value,outlineColor:_?P.value:void 0},title:P.name,children:_&&jsx(Check,{className:"w-3.5 h-3.5 text-white"})},P.value)})})})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Diamond,{className:l("w-4 h-4",m?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:l("text-sm w-24",m?"text-[#9CA3AF]":"text-gray-500"),children:b==="es"?"Hito":"Milestone"}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",checked:v.isMilestone||false,onChange:P=>me("isMilestone",P.target.checked),className:l("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",v.isMilestone?"bg-purple-500 border-purple-500":m?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsx("span",{className:l("text-sm",m?"text-white":"text-gray-900"),children:b==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxs("div",{className:l("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:l("w-4 h-4",m?"text-[#6B7280]":"text-gray-400")}),jsx("h3",{className:l("text-sm font-semibold",m?"text-white":"text-gray-900"),children:b==="es"?"Descripci\xF3n":"Description"})]}),jsx("textarea",{value:v.description||"",onChange:P=>me("description",P.target.value),placeholder:b==="es"?"Agregar descripci\xF3n...":"Add description...",className:l("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:l("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"}),b==="es"?"Escribe con IA":"Write with AI"]})]}),jsxs("div",{className:l("mt-6 pt-4 border-t",m?"border-white/10":"border-gray-200"),children:[jsx("h3",{className:l("text-sm font-semibold mb-3",m?"text-white":"text-gray-900"),children:b==="es"?"Campos personalizados":"Custom fields"}),jsxs("button",{className:l("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"}),b==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxs("div",{className:l("mt-6 pt-4 border-t",m?"border-white/10":"border-gray-200"),children:[jsx("h3",{className:l("text-sm font-semibold mb-3",m?"text-white":"text-gray-900"),children:b==="es"?"Agregar subtarea":"Add subtask"}),v.subtasks&&v.subtasks.length>0&&jsx("div",{className:"space-y-2 mb-3",children:v.subtasks.map(P=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:l("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",P.progress===100?"bg-green-500 border-green-500":m?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:P.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("span",{className:l("text-sm",P.progress===100?"line-through text-[#6B7280]":m?"text-white":"text-gray-900"),children:P.name})]},P.id))}),jsxs("button",{className:l("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"}),b==="es"?"Add Tarea":"Add Task"]})]}),jsxs("div",{className:l("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:l("text-sm font-semibold",m?"text-white":"text-gray-900"),children:b==="es"?"Listas de control":"Checklists"}),jsx("button",{className:l("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:l("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"}),b==="es"?"Crear lista de control":"Create checklist"]})]}),jsxs("div",{className:l("mt-6 pt-4 border-t",m?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:l("text-sm font-semibold mb-3",m?"text-white":"text-gray-900"),children:[b==="es"?"Adjuntos":"Attachments",ut.length>0&&jsxs("span",{className:l("ml-2 text-xs font-normal",m?"text-[#6B7280]":"text-gray-400"),children:["(",ut.length,")"]})]}),ut.length>0&&jsx("div",{className:"space-y-2 mb-4",children:ut.map(P=>{let _=Ua(P.type),Ee=P.type.startsWith("image/");return jsxs("div",{className:l("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:[Ee&&P.thumbnailUrl?jsx("img",{src:P.thumbnailUrl,alt:P.name,className:"w-10 h-10 rounded object-cover"}):jsx("div",{className:l("w-10 h-10 rounded flex items-center justify-center",m?"bg-white/10":"bg-gray-200"),children:jsx(_,{className:l("w-5 h-5",m?"text-[#9CA3AF]":"text-gray-500")})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("a",{href:P.url,target:"_blank",rel:"noopener noreferrer",className:l("text-sm font-medium truncate block hover:underline",m?"text-white":"text-gray-900"),children:P.name}),jsx("p",{className:l("text-xs",m?"text-[#6B7280]":"text-gray-400"),children:ya(P.size)})]}),a.onDeleteAttachment&&jsx("button",{onClick:()=>a.onDeleteAttachment?.(P.id),className:l("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:b==="es"?"Eliminar":"Delete",children:jsx(Trash2,{className:"w-4 h-4"})})]},P.id)})}),jsxs("div",{onDragOver:It,onDragLeave:st,onDrop:le,className:l("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",ve?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",Fe&&"pointer-events-none opacity-50"),children:[jsx("input",{type:"file",multiple:true,onChange:We,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!a.onUploadAttachments||Fe}),Fe?jsxs(Fragment,{children:[jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),jsx("p",{className:l("text-sm",m?"text-[#9CA3AF]":"text-gray-500"),children:b==="es"?"Subiendo...":"Uploading..."})]}):jsxs(Fragment,{children:[jsx(Upload,{className:l("w-6 h-6 mx-auto mb-2",ve?"text-blue-500":m?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:l("text-sm",m?"text-[#9CA3AF]":"text-gray-500"),children:ve?b==="es"?"Suelta los archivos aqu\xED":"Drop files here":b==="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:l("text-xs mt-1",m?"text-[#6B7280]":"text-gray-400"),children:b==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxs("div",{className:l("w-80 border-l flex flex-col",m?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsx("div",{className:l("px-4 py-3 border-b",m?"border-white/10":"border-gray-200"),children:jsxs("h3",{className:l("text-sm font-semibold",m?"text-white":"text-gray-900"),children:[b==="es"?"Actividad":"Activity",d&&d.length>0&&jsxs("span",{className:l("ml-2 text-xs font-normal",m?"text-[#6B7280]":"text-gray-400"),children:["(",d.length,")"]})]})}),jsx("div",{className:"flex-1 overflow-y-auto p-4",children:d&&d.length>0?jsx("div",{className:"space-y-4",children:d.map(P=>{let _=(()=>{let Ee=new Date,Xe=new Date(P.createdAt),At=Ee.getTime()-Xe.getTime(),de=Math.floor(At/6e4),_e=Math.floor(de/60),kt=Math.floor(_e/24);return de<1?b==="es"?"ahora":"now":de<60?b==="es"?`hace ${de}m`:`${de}m ago`:_e<24?b==="es"?`hace ${_e}h`:`${_e}h ago`:b==="es"?`hace ${kt}d`:`${kt}d ago`})();return jsxs("div",{className:"flex gap-3",children:[jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:"#8B5CF6"},children:P.user?.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsx("span",{className:l("text-sm font-medium",m?"text-white":"text-gray-900"),children:P.user?.name||(b==="es"?"Usuario":"User")}),jsx("span",{className:l("text-xs",m?"text-[#6B7280]":"text-gray-400"),children:_})]}),jsx("p",{className:l("text-sm break-words",m?"text-[#9CA3AF]":"text-gray-600"),children:P.content})]})]},P.id)})}):jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsx(MessageSquare,{className:l("w-10 h-10 mb-3",m?"text-[#3B4252]":"text-gray-300")}),jsx("p",{className:l("text-sm",m?"text-[#6B7280]":"text-gray-500"),children:b==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsx("div",{className:l("p-4 border-t",m?"border-white/10":"border-gray-200"),children:jsxs("div",{className:"flex items-start gap-2",children:[y&&jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:y.color||"#8B5CF6"},children:y.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:l("flex-1 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",value:F,onChange:P=>Ce(P.target.value),onKeyDown:async P=>{if(P.key==="Enter"&&!P.shiftKey&&v&&F.trim()&&f){P.preventDefault(),xe(true);try{await f(v.id,F.trim()),Ce("");}finally{xe(false);}}},placeholder:b==="es"?"Escribe un comentario...":"Write a comment...",disabled:Z||!f,className:l("flex-1 bg-transparent text-sm outline-none",m?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400",(Z||!f)&&"opacity-50")}),jsx("button",{onClick:async()=>{if(v&&F.trim()&&f){xe(true);try{await f(v.id,F.trim()),Ce("");}finally{xe(false);}}},disabled:Z||!F.trim()||!f,className:l("p-1.5 rounded transition-colors",F.trim()&&f?"bg-blue-500 text-white hover:bg-blue-600":m?"text-[#6B7280]":"text-gray-400",Z&&"opacity-50 cursor-not-allowed"),children:Z?jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsx(Send,{className:"w-4 h-4"})})]})]})})]})]})]})}),jsx(AnimatePresence,{children:A&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>T(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:l("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:l("px-4 py-3 border-b flex items-center justify-between",m?"border-white/10":"border-gray-200"),children:[jsx("span",{className:l("font-medium",m?"text-white":"text-gray-900"),children:A.date.toLocaleDateString(b==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsx("button",{onClick:()=>T(null),className:l("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:A.events.map(P=>jsxs("button",{onClick:()=>{T(null),I(P.task),C?.(P.task.id);},className:l("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(vp,{task:P.task}),jsx("span",{className:l("text-sm truncate flex-1",m?"text-white":"text-gray-900"),children:P.title}),P.task.priority==="high"||P.task.priority==="urgent"?jsx(Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},P.id))})]})]})})]})}var wl={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"},Cl={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"},Tl={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"},vs={dark:wl,light:Cl,neutral:Tl};function wp(e){return vs[e]||vs.dark}function Cv({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:c}){let[g,i]=useState(false),p=useMemo(()=>t.filter(y=>e.cardIds.includes(y.id)),[t,e.cardIds]),d=useMemo(()=>{let y=p.length,k=new Set(p.flatMap(b=>b.assignedUserIds||[])).size,C=p.map(b=>b.priority).filter(Boolean),h=new Set(p.flatMap(b=>b.labels||[])).size;return {totalCards:y,uniqueAssignees:k,priorities:C,labels:h}},[p]),f=()=>{o?.(e.id);};return jsxs("div",{className:l("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:f,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:l("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"]})]}),g&&jsx("div",{className:"card-stack-actions",children:jsx("button",{className:"card-stack-action",onClick:y=>{y.stopPropagation(),n?.(e.id);},"aria-label":"Delete stack",children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxs("div",{className:"card-stack-summary",children:[jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxs("span",{children:[d.uniqueAssignees," assignees"]})]}),d.labels>0&&jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxs("span",{children:[d.labels," labels"]})]}),e.confidence&&jsx("div",{className:"card-stack-summary-item",children:jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsx("div",{className:"card-stack-content",children:p.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:p.map(y=>jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsx("div",{onClick:()=>r?.(y),children:a(y)}):jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(y),children:[jsx("h4",{children:y.title}),y.description&&jsxs("p",{children:[y.description.substring(0,100),"..."]})]}),jsx("button",{className:"card-stack-unstack-btn",onClick:k=>{k.stopPropagation(),s?.(e.id,y.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"})]})})]},y.id))})})]})}var Tp={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function mn(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 pn(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 Np(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 Dp({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:c}){let g=useMemo(()=>({...Tp,...n}),[n]),[i,p]=useState(new Set),d=useRef(null),f=useMemo(()=>{if(!g.groupByDay)return [{date:null,events:e}];let u=new Map;return e.forEach(x=>{let m=x.timestamp.toISOString().split("T")[0],N=u.get(m);N?N.push(x):u.set(m,[x]);}),Array.from(u.entries()).sort((x,m)=>m[0].localeCompare(x[0])).map(([x,m])=>({date:new Date(x),events:m.sort((N,w)=>w.timestamp.getTime()-N.timestamp.getTime())}))},[e,g.groupByDay]),{uniqueUsers:y,uniqueTypes:k}=useMemo(()=>{let u=new Set,x=new Set;return e.forEach(m=>{u.add(m.userId),x.add(m.type);}),{uniqueUsers:Array.from(u),uniqueTypes:Array.from(x)}},[e]),C=u=>{p(x=>{let m=new Set(x);return m.has(u)?m.delete(u):m.add(u),m});},h=u=>{let m=new Date().getTime()-u.getTime(),N=Math.floor(m/6e4),w=Math.floor(m/36e5),B=Math.floor(m/864e5);return N<1?"just now":N<60?`${N}m ago`:w<24?`${w}h ago`:B<7?`${B}d ago`:u.toLocaleDateString()},b=useMemo(()=>{let u=0;return t.types&&t.types.length>0&&u++,t.users&&t.users.length>0&&u++,t.dateRange&&u++,t.searchTerm&&u++,u},[t]);return useEffect(()=>{if(s&&d.current){let u=d.current.querySelector(`[data-event-id="${s}"]`);u&&u.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxs("div",{className:l("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:l("history-timeline",g.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:u=>{let x=u.target.value;a({...t,types:x?[x]:void 0});},children:[jsx("option",{value:"",children:"All Events"}),k.map(u=>jsxs("option",{value:u,children:[pn(u)," ",u.replace("_"," ")]},u))]}),y.length>1&&jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:u=>{let x=u.target.value;a({...t,users:x?[x]:void 0});},children:[jsx("option",{value:"",children:"All Users"}),y.map(u=>jsx("option",{value:u,children:u},u))]}),jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:u=>a({...t,searchTerm:u.target.value})})]}),b>0&&jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",b,")"]})]}),jsx("div",{className:"history-timeline-container",ref:d,children:f.map(u=>jsxs("div",{className:"history-timeline-group",children:[g.groupByDay&&u.date&&jsxs("div",{className:"history-timeline-day-header",children:[jsx("span",{className:"history-timeline-day-date",children:u.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxs("span",{className:"history-timeline-day-count",children:[u.events.length," events"]})]}),jsx("div",{className:"history-timeline-events",children:u.events.map((x,m)=>{let N=i.has(x.id),w=s===x.id,B=Np(x.type);return jsxs("div",{"data-event-id":x.id,className:l("history-timeline-event",N&&"expanded",w&&"selected"),onClick:()=>o?.(x),children:[jsxs("div",{className:"history-timeline-line",children:[jsx("div",{className:"history-timeline-dot",style:{backgroundColor:B},children:g.showIcons&&jsx("span",{className:"history-timeline-dot-icon",children:pn(x.type)})}),m<u.events.length-1&&jsx("div",{className:"history-timeline-connector",style:{borderColor:B}})]}),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:[g.showAvatars&&x.userAvatar&&jsx("img",{src:x.userAvatar,alt:x.userName||x.userId,className:"history-timeline-event-avatar"}),jsxs("div",{className:"history-timeline-event-description",children:[jsx("span",{className:"history-timeline-event-user",children:x.userName||x.userId}),jsx("span",{className:"history-timeline-event-action",children:mn(x)})]})]}),jsx("div",{className:"history-timeline-event-time",children:g.useRelativeTime?h(x.timestamp):x.timestamp.toLocaleString()})]}),Object.keys(x.changes).length>0&&jsxs("button",{className:"history-timeline-event-toggle",onClick:v=>{v.stopPropagation(),C(x.id);},children:[N?"\u25BC":"\u25B6"," Show changes"]}),N&&jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(x.changes).map(([v,I])=>jsxs("div",{className:"history-timeline-event-change",children:[jsxs("span",{className:"history-timeline-event-change-key",children:[v,":"]}),jsxs("div",{className:"history-timeline-event-change-values",children:[jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(I.from)}),jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(I.to)})]})]},v)),x.metadata&&Object.keys(x.metadata).length>0&&jsxs("div",{className:"history-timeline-event-metadata",children:[jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(x.metadata).map(([v,I])=>jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxs("span",{className:"history-timeline-event-metadata-key",children:[v,":"]}),jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(I)})]},v))]})]})]})]},x.id)})})]},u.date?.toISOString()||"all"))})]})}function Ep({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:c,onSpeedChange:g,className:i}){let p=[.5,1,1.5,2,3],d=useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),f=useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxs("div",{className:l("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:l("history-replay",i),children:[jsxs("div",{className:"history-replay-current-event",children:[jsx("div",{className:"history-replay-event-icon",children:d&&pn(d.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:d&&mn(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:y=>c(parseInt(y.target.value))}),jsx("div",{className:"history-replay-progress-fill",style:{width:`${f}%`}}),jsx("div",{className:"history-replay-progress-markers",children:t.map((y,k)=>jsx("div",{className:l("history-replay-progress-marker",k===e.currentIndex&&"active"),style:{left:`${k/(e.totalEvents-1)*100}%`},onClick:()=>c(k),title:mn(y)},y.id))})]}),jsxs("div",{className:"history-replay-controls",children:[jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:o,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsx("button",{className:"history-replay-control-btn",onClick:n,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxs("div",{className:"history-replay-speed",children:[jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsx("div",{className:"history-replay-speed-buttons",children:p.map(y=>jsxs("button",{className:l("history-replay-speed-btn",e.speed===y&&"active"),onClick:()=>g(y),children:[y,"x"]},y))})]}),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(y=>jsx("span",{className:"history-replay-card-preview-label-tag",children:y},y))})]})]})]})]}):jsxs("div",{className:l("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 Nl(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 Dl(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 Pp(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 Mp(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Pv(e,t,a,r,o,s=100){let n=e.map(g=>({...g,x:g.x??a/2+Math.random()*100-50,y:g.y??r/2+Math.random()*100-50,vx:0,vy:0})),c=new Map(n.map(g=>[g.id,g]));for(let g=0;g<s;g++){let i=1-g/s;n.forEach(p=>{let d=a/2,f=r/2;p.vx+=(d-p.x)*o.centerForce*i,p.vy+=(f-p.y)*o.centerForce*i,n.forEach(y=>{if(p.id===y.id)return;let k=p.x-y.x,C=p.y-y.y,h=Math.sqrt(k*k+C*C)||1,b=o.chargeStrength*i/(h*h);p.vx+=k/h*b,p.vy+=C/h*b;});}),t.forEach(p=>{let d=c.get(typeof p.source=="string"?p.source:p.source.id),f=c.get(typeof p.target=="string"?p.target:p.target.id);if(!d||!f)return;let y=f.x-d.x,k=f.y-d.y,C=Math.sqrt(y*y+k*k)||1,h=(C-o.linkDistance)/C*o.forceStrength*i;d.vx+=y*h,d.vy+=k*h,f.vx-=y*h,f.vy-=k*h;}),n.forEach(p=>{p.fx!==null&&p.fx!==void 0?(p.x=p.fx,p.vx=0):p.x+=p.vx,p.fy!==null&&p.fy!==void 0?(p.y=p.fy,p.vy=0):p.y+=p.vy,p.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,p.x)),p.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,p.y)),p.vx*=.9,p.vy*=.9;});}return n}function Ap({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:c,className:g}){let i=useRef(null),[p,d]=useState([]),[f,y]=useState(null),[k,C]=useState(null),[h,b]=useState(null),[u,x]=useState(1),[m,N]=useState({x:0,y:0});useEffect(()=>{if(e.length===0)return;let O=Pv(e,t,a.width,a.height,a,150);d(O);},[e,t,a]);let w=useCallback((O,j)=>{a.enableDragging&&(j.stopPropagation(),y(O));},[a.enableDragging]),B=useCallback(O=>{if(!f||!i.current)return;let ae=i.current.getBoundingClientRect(),ne=(O.clientX-ae.left-m.x)/u,re=(O.clientY-ae.top-m.y)/u;d(ge=>ge.map(fe=>fe.id===f?{...fe,x:ne,y:re,fx:ne,fy:re}:fe));},[f,u,m]),v=useCallback(()=>{y(null);},[]),I=useCallback((O,j)=>{j.stopPropagation(),c?.({type:"node-click",node:O,position:{x:j.clientX,y:j.clientY}});},[c]),A=useCallback((O,j)=>{j.stopPropagation(),c?.({type:"edge-click",edge:O,position:{x:j.clientX,y:j.clientY}});},[c]),T=useCallback(O=>{let j=p.find(ae=>ae.id===O);return j?{x:j.x,y:j.y}:{x:0,y:0}},[p]),H=useCallback(O=>{if(O.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return O.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let j=O.card.priority;return j==="URGENT"?"#ef4444":j==="HIGH"?"#f59e0b":j==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return O.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxs("div",{className:l("relationships-graph-empty",g),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:l("relationships-graph",g),children:[jsxs("div",{className:"relationships-graph-controls",children:[jsxs("div",{className:"relationships-graph-stats",children:[jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:n.totalNodes}),jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:n.totalEdges}),jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>x(O=>Math.min(O+.2,3)),children:"+"}),jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(u*100),"%"]}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>x(O=>Math.max(O-.2,.5)),children:"\u2212"}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{x(1),N({x:0,y:0});},children:"Reset"})]})]}),jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(O=>O.type))).map(O=>jsxs("div",{className:"relationships-graph-legend-item",children:[jsx("div",{className:"relationships-graph-legend-color",style:{background:Nl(O)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[Pp(O)," ",Dl(O)]})]},O))}),jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:B,onMouseUp:v,onMouseLeave:v,children:[jsxs("g",{transform:`translate(${m.x}, ${m.y}) scale(${u})`,children:[jsx("g",{className:"relationships-graph-edges",children:t.map(O=>{let j=T(typeof O.source=="string"?O.source:O.source.id),ae=T(typeof O.target=="string"?O.target:O.target.id),ne=Mp(O.type),re=h===O.id,ge=O.onCriticalPath;return jsxs("g",{className:l("relationships-graph-edge",re&&"hovered",ge&&"critical"),onMouseEnter:()=>b(O.id),onMouseLeave:()=>b(null),onClick:fe=>A(O,fe),children:[jsx("line",{x1:j.x,y1:j.y,x2:ae.x,y2:ae.y,stroke:Nl(O.type),strokeWidth:ge?a.edgeWidth*2:a.edgeWidth,strokeOpacity:re?1:.6,markerEnd:ne?"url(#arrowhead)":void 0}),a.showEdgeLabels&&re&&jsx("text",{x:(j.x+ae.x)/2,y:(j.y+ae.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Dl(O.type)})]},O.id)})}),jsx("g",{className:"relationships-graph-nodes",children:p.map(O=>{let j=k===O.id,ae=O.onCriticalPath;return jsxs("g",{className:l("relationships-graph-node",j&&"hovered",ae&&"critical"),transform:`translate(${O.x}, ${O.y})`,onMouseDown:ne=>w(O.id,ne),onMouseEnter:()=>C(O.id),onMouseLeave:()=>C(null),onClick:ne=>I(O,ne),children:[jsx("circle",{r:ae?a.nodeSize*1.2:a.nodeSize,fill:H(O),stroke:ae?"#fbbf24":"#ffffff",strokeWidth:ae?3:2,opacity:j?1:.9}),a.showLabels&&jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:O.card.title.length>20?O.card.title.substring(0,20)+"...":O.card.title})]},O.id)})})]}),jsx("defs",{children:jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function Ip({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=useState(""),[c,g]=useState(false),[i,p]=useState(null),[d,f]=useState(null),y=useRef(null),k=c||o;useEffect(()=>{e&&y.current&&y.current.focus();},[e]),useEffect(()=>{let u=x=>{x.key==="Escape"&&!k&&C();};if(e)return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[e,k]);let C=()=>{k||(n(""),p(null),f(null),t());},h=async()=>{if(!(!s.trim()||k)){g(true),p(null),f(null);try{let u=await r(s.trim());f(u);}catch(u){p(u instanceof Error?u.message:"Failed to generate plan");}finally{g(false);}}},b=()=>{d&&(a(d),C());};return e?jsxs(ht,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:C}),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:u=>u.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:C,disabled:k,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((u,x)=>jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:u.title},x))})]}),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((u,x)=>jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsx("p",{className:"text-sm font-medium text-white/90",children:u.title}),u.description&&jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:u.description})]}),u.priority&&jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${u.priority==="URGENT"?"bg-red-500/20 text-red-400":u.priority==="HIGH"?"bg-orange-500/20 text-orange-400":u.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:u.priority})]})},x)),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:y,value:s,onChange:u=>n(u.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:k}),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((u,x)=>jsx("button",{onClick:()=>n(u),disabled:k,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:u},x))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:k&&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:C,disabled:k,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),d?jsx("button",{onClick:b,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsx("button",{onClick:h,disabled:!s.trim()||k,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:k?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Sl={"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 Av={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Fv={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 Lv(e,t,a){let r=Sl[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function un(e){return `$${e.toFixed(4)}`}var El=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=Lv(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,f)=>d+f.cost,0),s=a.reduce((d,f)=>d+f.inputTokens,0),n=a.reduce((d,f)=>d+f.outputTokens,0),c=a.filter(d=>d.success),g=a.reduce((d,f)=>d+f.duration,0),i={},p={};return a.forEach(d=>{i[d.feature]=(i[d.feature]||0)+1,p[d.feature]=(p[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:p,averageDuration:r>0?g/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],s=new Date,n=new Date;a==="month"?n.setMonth(s.getMonth()-1):n.setDate(s.getDate()-1);let c=this.operations.filter(p=>p.timestamp>=n).length,g=Math.max(0,o-c),i=c/o*100;return {used:c,limit:o,remaining:g,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)}},bo=new El;function Op({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=useState(bo.getStats()),[s,n]=useState(bo.checkLimit(a));if(useEffect(()=>{if(!e)return;let g=setInterval(()=>{o(bo.getStats()),n(bo.checkLimit(a));},1e3);return ()=>clearInterval(g)},[e,a]),useEffect(()=>{let g=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[e,t]),!e)return null;let c=bo.getRecentOperations(5);return jsxs(ht,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick: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:[jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-blue-500/10 to-purple-500/10 border border-blue-500/30",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:un(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(([g,i])=>{let p=r.costsByFeature[g]||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:g.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:un(p)})]})]}),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}%`}})})]},g)})})]}),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(g=>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:g.feature.replace(/([A-Z])/g," $1").trim()}),jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(g.timestamp).toLocaleTimeString()," \u2022"," ",g.duration,"ms"]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[g.inputTokens+g.outputTokens," tokens"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:un(g.cost)}),jsx("div",{className:`w-2 h-2 rounded-full ${g.success?"bg-green-400":"bg-red-400"}`})]})]},g.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 zp({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,c]=useState(""),[g,i]=useState(""),[p,d]=useState(""),[f,y]=useState(false),[k,C]=useState(null),[h,b]=useState(null),[u,x]=useState(null),m=useRef(null),N=f||o;useEffect(()=>{e&&m.current&&m.current.focus();},[e]),useEffect(()=>{let A=T=>{T.key==="Escape"&&!N&&w();};if(e)return document.addEventListener("keydown",A),()=>document.removeEventListener("keydown",A)},[e,N]);let w=()=>{N||(c(""),i(""),d(""),C(null),b(null),x(null),t());},B=async()=>{if(!(!n.trim()||N)){y(true),C(null),b(null),x(null);try{let A=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:g||void 0,endDate:p||void 0});b(A.tasks.tasks),x({from_cache:A.from_cache,tokens_used:A.tokens_used,mock_mode:A.mock_mode,similarity:A.similarity,tokens_saved:A.tokens_saved});}catch(A){C(A instanceof Error?A.message:"Failed to generate tasks");}finally{y(false);}}},v=()=>{h&&(a(h),w());};if(!e)return null;let I=u?.similarity?((u.similarity||0)*100).toFixed(0):"0";return jsxs(ht,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:w}),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:A=>A.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:w,disabled:N,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:h?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxs("div",{className:"flex flex-wrap gap-2",children:[u?.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"}),u?.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 (",I,"% 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:[u?.tokens_used||0," tokens"]}),u?.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:[u.tokens_saved," tokens saved"]}),jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[h.length," tasks"]})]}),jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:h.map((A,T)=>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:["#",T+1]}),jsx("p",{className:"text-sm font-medium text-white/90",children:A.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"})]}),A.start," \u2192 ",A.end]}),jsxs("span",{children:[A.duration," days"]}),A.dependencies.length>0&&jsxs("span",{className:"text-blue-400",children:["Depends: ",A.dependencies.join(", ")]})]})]}),jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${A.priority==="high"?"bg-red-500/20 text-red-400":A.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:A.priority})]})},A.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:m,value:n,onChange:A=>c(A.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:g,onChange:A=>i(A.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:p,onChange:A=>d(A.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})]})]}),k&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:k}),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((A,T)=>jsx("button",{onClick:()=>c(A),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:A},T))})]})]})}),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:w,disabled:N,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),h?jsx("button",{onClick:v,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsx("button",{onClick:B,disabled:!n.trim()||N,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:N?"Generating...":"Generate Tasks"})]})]})]})})]})}function ws({initialBoard:e,onPersist:t}){let[a,r]=useState(e),o=useCallback(h=>{t&&Cn(()=>Promise.resolve(t(h)),{maxAttempts:3,initialDelay:1e3,onRetry:(b,u,x)=>{console.warn(`Retry attempt ${u} after ${x}ms: ${b.message}`);}}).then(b=>{b.success||console.error(`Failed to persist board after ${b.attempts} attempts:`,b.error);});},[t]),s=useCallback(async(h,b,u)=>{r(x=>{let m=x.cards.find(A=>A.id===h);if(!m)return x;let N=m.columnId,w={...m,columnId:b,position:u},B=x.cards.map(A=>A.id===h?w:A),v=x.columns.map(A=>{if(A.id===N)return {...A,cardIds:A.cardIds.filter(T=>T!==h)};if(A.id===b){let T=B.filter(H=>H.columnId===b).sort((H,O)=>H.position-O.position);return {...A,cardIds:T.map(H=>H.id)}}return A}),I={...x,cards:B,columns:v};return o(I),I});},[o]),n=useCallback(async(h,b)=>{r(u=>{let x=u.cards.map(N=>N.id===h?{...N,...b}:N),m={...u,cards:x};return o(m),m});},[o]),c=useCallback(async h=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(u=>{let x={...h,id:b},m=u.columns.map(w=>w.id===h.columnId?{...w,cardIds:[...w.cardIds,b]}:w),N={...u,cards:[...u.cards,x],columns:m};return o(N),N});},[o]),g=useCallback(async h=>{r(b=>{let u=b.cards.find(w=>w.id===h);if(!u)return b;let x=b.cards.filter(w=>w.id!==h),m=b.columns.map(w=>w.id===u.columnId?{...w,cardIds:w.cardIds.filter(B=>B!==h)}:w),N={...b,cards:x,columns:m};return o(N),N});},[o]),i=useCallback(async h=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(u=>{let x={...h,id:b,cardIds:[]},m={...u,columns:[...u.columns,x]};return o(m),m});},[o]),p=useCallback(async(h,b)=>{r(u=>{let x=u.columns.map(N=>N.id===h?{...N,...b}:N),m={...u,columns:x};return o(m),m});},[o]),d=useCallback(async h=>{r(b=>{let u=b.cards.filter(N=>N.columnId!==h),x=b.columns.filter(N=>N.id!==h),m={...b,cards:u,columns:x};return o(m),m});},[o]),f=useCallback(h=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return c(h),b},[c]),y=useCallback(h=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(h),b},[i]),k=useCallback(()=>{r(h=>{let b={...h,cards:[],columns:[]};return o(b),b});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:c,onCardDelete:g,onColumnCreate:i,onColumnUpdate:p,onColumnDelete:d},setBoard:r,helpers:{addCard:f,addColumn:y,deleteCard:g,deleteColumn:d,clearBoard:k}}}function Wp({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=ws({initialBoard:e,onPersist:a}),n=useMemo(()=>({addCard:(g,i,p={})=>{s.addCard({title:i,columnId:g,position:r.cards.filter(d=>d.columnId===g).length,...p});},addColumn:(g,i)=>{let p=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:g,position:i??p+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:n}}var gn={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},_p={by:"none",order:"asc"};function Vp({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=useState({...gn,...e}),[s,n]=useState({..._p,...t}),c=useCallback(C=>{o(h=>({...h,...C}));},[]),g=useCallback(C=>{n(h=>({...h,...C}));},[]),i=useCallback(()=>{o(gn),n(_p);},[]),p=useCallback(()=>{a&&o({...gn,assignees:[a]});},[a]),d=useCallback(()=>{o({...gn,dateFilter:"overdue"});},[]),f=useCallback(()=>{o({...gn,priorities:["HIGH","URGENT"]});},[]),y=useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),k=useCallback(C=>{let h=[...C];if(r.search){let b=r.search.toLowerCase();h=h.filter(u=>u.title.toLowerCase().includes(b)||u.description?.toLowerCase().includes(b));}if(r.dateFilter!=="all"){let b=new Date,u=b.getFullYear(),x=String(b.getMonth()+1).padStart(2,"0"),m=String(b.getDate()).padStart(2,"0"),N=`${u}-${x}-${m}`;h=h.filter(w=>{if(!w.endDate&&!w.dueDate)return false;let B=w.endDate||w.dueDate;if(!B)return false;let v;if(typeof B=="string")v=B.split("T")[0]||B;else {let I=B.getUTCFullYear(),A=String(B.getUTCMonth()+1).padStart(2,"0"),T=String(B.getUTCDate()).padStart(2,"0");v=`${I}-${A}-${T}`;}switch(r.dateFilter){case "overdue":return v<N;case "today":return v===N;case "this-week":let I=new Date(N+"T00:00:00"),A=new Date(v+"T00:00:00"),T=new Date(I);return T.setDate(T.getDate()+7),A>=I&&A<=T;case "custom":if(r.dateRange){let H=typeof B=="string"?new Date(B):B;return H>=r.dateRange.start&&H<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(h=h.filter(b=>b.priority&&r.priorities.includes(b.priority))),r.assignees.length>0&&(h=h.filter(b=>(b.assignedUserIds||(b.assigneeId?[b.assigneeId]:[])).some(x=>r.assignees.includes(x)))),r.labels.length>0&&(h=h.filter(b=>b.labels&&b.labels.some(u=>r.labels.includes(u)))),r.columns.length>0&&(h=h.filter(b=>r.columns.includes(b.columnId))),s.by!=="none"&&h.sort((b,u)=>{let x=0;switch(s.by){case "created":let m=b.createdAt?new Date(b.createdAt).getTime():0,N=u.createdAt?new Date(u.createdAt).getTime():0;x=m-N;break;case "priority":let w={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},B=w[b.priority||"LOW"],v=w[u.priority||"LOW"];x=B-v;break;case "dueDate":let I=b.endDate||b.dueDate,A=u.endDate||u.dueDate;if(!I)return 1;if(!A)return -1;let T=typeof I=="string"?new Date(I).getTime():I.getTime(),H=typeof A=="string"?new Date(A).getTime():A.getTime();x=T-H;break;case "title":x=b.title.localeCompare(u.title);break;case "estimate":let O=b.estimatedTime||0,j=u.estimatedTime||0;x=O-j;break;default:x=0;}return s.order==="asc"?x:-x}),h},[r,s]);return {filters:r,sort:s,setFilters:c,setSort:g,resetFilters:i,filterMyTasks:p,filterOverdue:d,filterHighPriority:f,applyFilters:k,hasActiveFilters:y}}var Kp,Yp;if(typeof window<"u")try{let e=xn("ai");Kp=e.generateObject,Yp=e.generateText;}catch{}function qp(e={}){let[t,a]=useState(false),[r,o]=useState(null),s=!!(Kp&&Yp&&e.apiKey),n=useCallback(async d=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",d),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${d}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(f){let y=f instanceof Error?f:new Error("Failed to generate plan");throw o(y),y}finally{a(false);}},[s]),c=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",d.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(f){let y=f instanceof Error?f:new Error("Failed to suggest assignee");throw o(y),y}finally{a(false);}},[s]),g=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(f){let y=f instanceof Error?f:new Error("Failed to predict risks");throw o(y),y}finally{a(false);}},[s]),i=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",d.title),[{title:`Subtask 1 for: ${d.title}`,position:d.position+.1,columnId:d.columnId},{title:`Subtask 2 for: ${d.title}`,position:d.position+.2,columnId:d.columnId}]}catch(f){let y=f instanceof Error?f:new Error("Failed to generate subtasks");throw o(y),y}finally{a(false);}},[s]),p=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",d.title),{hours:8,confidence:.75}}catch(f){let y=f instanceof Error?f:new Error("Failed to estimate effort");throw o(y),y}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:c,onPredictRisks:g,onGenerateSubtasks:i,onEstimateEffort:p,isAvailable:s,isLoading:t,error:r}}function Ml(){let[e,t]=useState(()=>selectionStore.getState());useEffect(()=>selectionStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{selectionStore.setState(r);},[]);return [e,a]}function Xp(e){let{cards:t}=e,[a,r]=Ml(),o=useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=useCallback((d,f)=>{if(!f){r({selectedCardIds:[d],lastSelectedCardId:d});return}let y=f.ctrlKey||f.metaKey,k=f.shiftKey;if(y)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(C=>C!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(k&&a.lastSelectedCardId){let C=t.find(b=>b.id===d),h=t.find(b=>b.id===a.lastSelectedCardId);if(C&&h&&C.columnId===h.columnId){let b=t.filter(v=>v.columnId===C.columnId).sort((v,I)=>v.position-I.position),u=b.findIndex(v=>v.id===a.lastSelectedCardId),x=b.findIndex(v=>v.id===d),[m,N]=u<x?[u,x]:[x,u],w=b.slice(m,N+1).map(v=>v.id),B=Array.from(new Set([...a.selectedCardIds,...w]));r({selectedCardIds:B,lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});},[t,a,r]),n=useCallback(d=>{r({selectedCardIds:a.selectedCardIds.filter(f=>f!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),c=useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),g=useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=useCallback(d=>{a.selectedCardIds.includes(d)?n(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,n,r]),p=useCallback(()=>t.filter(d=>a.selectedCardIds.includes(d.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:c,selectAll:g,toggleCard:i,getSelectedCards:p}}var Jp={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function Zp(e){let{cards:t,config:a,aiService:r}=e,o=useMemo(()=>({...Jp,...a}),[a]),[s,n]=useState([]),c=useCallback((C,h,b,u,x)=>{if(h.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let m={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:C,cardIds:h,columnId:b,strategy:u,color:x,isExpanded:true,position:s.filter(N=>N.columnId===b).length,createdAt:new Date};n(N=>[...N,m]);},[o.minCardsPerStack,s]),g=useCallback(C=>{n(h=>h.filter(b=>b.id!==C));},[]),i=useCallback(C=>{n(h=>h.map(b=>b.id===C?{...b,isExpanded:!b.isExpanded}:b));},[]),p=useCallback((C,h)=>{n(b=>b.map(u=>u.id===C&&!u.cardIds.includes(h)?{...u,cardIds:[...u.cardIds,h]}:u));},[]),d=useCallback((C,h)=>{n(b=>b.map(u=>{if(u.id===C){let x=u.cardIds.filter(m=>m!==h);return x.length<o.minCardsPerStack?null:{...u,cardIds:x}}return u}).filter(u=>u!==null));},[o.minCardsPerStack]),f=useCallback(C=>s.filter(h=>h.columnId===C).sort((h,b)=>h.position-b.position),[s]),y=useCallback(async C=>{let h=t.filter(N=>N.columnId===C);if(h.length<o.minCardsPerStack*2)return [];let b=[],u=new Map;h.forEach(N=>{N.labels&&N.labels.length>0&&N.labels.forEach(w=>{u.has(w)||u.set(w,[]),u.get(w).push(N);});}),u.forEach((N,w)=>{N.length>=o.minCardsPerStack&&b.push({stack:{title:`\u{1F4CC} ${w}`,cardIds:N.map(B=>B.id),columnId:C,strategy:"labels",color:"#3b82f6"},reason:`${N.length} cards with label "${w}"`,confidence:.85});});let x=new Map;h.forEach(N=>{N.assignedUserIds&&N.assignedUserIds.length>0&&N.assignedUserIds.forEach(w=>{x.has(w)||x.set(w,[]),x.get(w).push(N);});}),x.forEach((N,w)=>{N.length>=o.minCardsPerStack&&b.push({stack:{title:`\u{1F464} Assigned to user-${w.slice(-4)}`,cardIds:N.map(B=>B.id),columnId:C,strategy:"assignee",color:"#8b5cf6"},reason:`${N.length} cards assigned to the same user`,confidence:.8});});let m=new Map;if(h.forEach(N=>{N.priority&&(m.has(N.priority)||m.set(N.priority,[]),m.get(N.priority).push(N));}),m.forEach((N,w)=>{if(N.length>=o.minCardsPerStack){let B={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[w.toLowerCase()]||"\u26AA";b.push({stack:{title:`${B} ${w} Priority`,cardIds:N.map(v=>v.id),columnId:C,strategy:"priority",color:w==="high"||w==="urgent"?"#ef4444":"#10b981"},reason:`${N.length} cards with ${w} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let N of h){let B=(await r.findSimilar(N,h)).filter(v=>v.similarity>=o.autoStackConfidenceThreshold);if(B.length>=o.minCardsPerStack-1){let v=[N.id,...B.map(A=>A.card.id)],I=B.reduce((A,T)=>A+T.similarity,0)/B.length;b.push({stack:{title:`\u2728 Similar to "${N.title.substring(0,30)}${N.title.length>30?"...":""}"`,cardIds:v,columnId:C,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${B.length+1} similar tasks`,confidence:I});}}return b.filter(N=>N.confidence>=o.autoStackConfidenceThreshold).sort((N,w)=>w.confidence-N.confidence).slice(0,5)},[t,o,r]),k=useCallback(C=>{c(C.stack.title,C.stack.cardIds,C.stack.columnId,C.stack.strategy,C.stack.color);},[c]);return useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(h=>h.columnId)).forEach(async h=>{let b=await y(h),u=b[0];b.length>0&&u&&u.confidence>=.9&&k(u);});},[]),{stacks:s,createStack:c,deleteStack:g,toggleStack:i,addToStack:p,removeFromStack:d,getStacksForColumn:f,getSuggestions:y,applySuggestion:k,config:o}}var Qp=createContext(null);function eu({children:e,initialData:t,onStateChange:a}){let r=useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(g=>{let{Column:i}=xn("@libxai/core");s.set(g.id,new i(g));}),t?.cards?.forEach(g=>{let{Card:i}=xn("@libxai/core");n.set(g.id,new i(g));});let c=null;if(t?.board){let{Board:g}=xn("@libxai/core");c=new g(t.board);}r.current=new BoardStore({board:c,columns:s,cards:n});}let o=r.current;return useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsx(Qp.Provider,{value:{store:o},children:e})}function Cs(){let e=useContext(Qp);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function bn(){let e=Cs(),[t,a]=useState(e.getBoard()),[r,o]=useState(e.getAllColumns()),[s,n]=useState(e.getAllCards());useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),n(e.getAllCards());}),[e]);let c=useCallback(u=>{e.updateBoard(u);},[e]),g=useCallback(u=>{e.addColumn(u);},[e]),i=useCallback((u,x)=>{e.updateColumn(u,x);},[e]),p=useCallback(u=>{e.deleteColumn(u);},[e]),d=useCallback(u=>e.getColumn(u),[e]),f=useCallback(u=>{e.addCard(u);},[e]),y=useCallback((u,x)=>{e.updateCard(u,x);},[e]),k=useCallback(u=>{e.deleteCard(u);},[e]),C=useCallback((u,x,m)=>{e.moveCard(u,x,m);},[e]),h=useCallback(u=>e.getCard(u),[e]),b=useCallback(u=>e.getCardsByColumn(u),[e]);return {board:t,columns:r,cards:s,updateBoard:c,addColumn:g,updateColumn:i,deleteColumn:p,getColumn:d,addCard:f,updateCard:y,deleteCard:k,moveCard:C,getCard:h,getCardsByColumn:b}}function au(e){let{cards:t}=bn();return useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let r=e.searchQuery.toLowerCase(),o=a.title.toLowerCase().includes(r),s=a.description?.toLowerCase().includes(r);if(!o&&!s)return false}return !(e.priorities&&e.priorities.length>0&&(!a.priority||!e.priorities.includes(a.priority))||e.statuses&&e.statuses.length>0&&(!a.status||!e.statuses.includes(a.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(o=>a.isAssignedTo(o))||e.labels&&e.labels.length>0&&!e.labels.some(o=>a.hasLabel(o))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(a.columnId)||e.isOverdue!==void 0&&e.isOverdue!==a.isOverdue())}):t,[t,e])}function ru(e="position",t="asc"){let{cards:a}=bn();return useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let c={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},g=o.priority?c[o.priority]:0,i=s.priority?c[s.priority]:0;n=g-i;break}case "createdAt":n=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":n=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":n=o.position-s.position;break}return t==="asc"?n:-n}),[a,e,t])}var Ts=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=dd.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let o=this.config.get(t);o[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let o=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let n=s[t];if(typeof n=="function")try{let c=await Promise.resolve(n.apply(s,a));c!==void 0&&(o=c,a[0]=c);}catch(c){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,c,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(n=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,n,{plugin:o.id,hook:t});}));}await Promise.all(r);}},Xv=new Ts;function nu({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:c=0,getItemKey:g}){let i=useRef(null),p=useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:c}),d=p.getVirtualItems(),f={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},y=n?{width:`${p.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${p.getTotalSize()}px`,width:"100%",position:"relative"};return jsx("div",{ref:i,style:f,className:o,children:jsx("div",{style:y,children:d.map(k=>{let C=e[k.index];if(!C)return null;let h=g?g(C,k.index):k.index,b={position:"absolute",top:n?0:k.start,left:n?k.start:0,width:n?k.size:"100%",height:n?"100%":k.size};return jsx("div",{style:b,"data-index":k.index,children:r(C,k.index)},h)})})})}function su(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 lu({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:c=16,getItemKey:g,horizontal:i=true}){let p=useRef(null),d=useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>p.current,estimateSize:()=>r,overscan:n,gap:c}),f=d.getVirtualItems(),y={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},k={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsx("div",{ref:p,style:y,className:s,children:jsx("div",{style:k,children:f.map(C=>{let h=e[C.index];if(!h)return null;let b=g?g(h,C.index):C.index,u={position:"absolute",top:0,left:C.start,width:C.size,height:"100%"};return jsx("div",{style:u,"data-index":C.index,children:o(h,C.index)},b)})})})}function du(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 cu(e,t=10){return e>t}var Il={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Bl={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},Rl={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Ol={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},$l={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Ul={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},zl={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Hl={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)"},Wl={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)"},Gl={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},_l={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}},Vl={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}},Ns={spacing:Il,borderRadius:Bl,fontSize:Rl,fontWeight:Ol,lineHeight:$l,zIndex:Ul,duration:zl,easing:Hl,shadows:Wl,opacity:Gl,kanban:_l,gantt:Vl};function mu(e,t,a){return e[t]??a}function jl(e,t="",a={}){for(let[r,o]of Object.entries(e)){let s=t?`${t}-${r}`:r;typeof o=="object"&&o!==null&&!Array.isArray(o)?jl(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function Qv(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Kl(e="asakaa"){let t=jl(Ns),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=Qv(o);a.push(` ${s}: ${n};`);}return `:root {
|
|
390
390
|
${a.join(`
|
|
391
391
|
`)}
|
|
392
|
-
}`}function
|
|
392
|
+
}`}function hn(e,t="asakaa"){let a=[],r=jl(e);for(let[o,s]of Object.entries(r)){let n=`--${t}-color-${o}`;a.push(` ${n}: ${s};`);}return `:root {
|
|
393
393
|
${a.join(`
|
|
394
394
|
`)}
|
|
395
|
-
}`}var
|
|
395
|
+
}`}var Ds={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"}},Yl={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"}},ql={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 Xl(e=Ds,t="asakaa"){let a=Kl(t),r=hn(e,t);return `${a}
|
|
396
396
|
|
|
397
|
-
${r}`}function
|
|
397
|
+
${r}`}function pu(){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
|
-
${
|
|
403
|
+
${Xl(Ds)}
|
|
404
404
|
|
|
405
405
|
/* Light theme */
|
|
406
406
|
[data-theme="light"] {
|
|
407
|
-
${
|
|
407
|
+
${hn(Yl,"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
|
+
${hn(ql,"asakaa").split(`
|
|
415
415
|
`).slice(1,-1).join(`
|
|
416
416
|
`)}
|
|
417
417
|
}
|
|
418
|
-
`}var
|
|
419
|
-
export{
|
|
418
|
+
`}var ex=({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 uu({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=Ao();return jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([n,c])=>{let g=n,i=g===r;return jsxs("button",{onClick:()=>o(g),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(ex,{theme:g})}),e&&!t&&jsx("span",{className:"theme-switcher__label",children:c.displayName})]},g)})})}
|
|
419
|
+
export{Op as AIUsageDashboard,Fv as AI_FEATURES,Sl as AI_MODELS,ti as AddCardButton,ei as AddColumnButton,wr as AttachmentUploader,eu as BoardProvider,On as BulkOperationsToolbar,ui as BurnDownChart,mp as CUSTOM_FIELD_TYPES,kp as CalendarBoard,Sr as Card,ii as CardDetailModal,ci as CardDetailModalV2,Ep as CardHistoryReplay,Dp as CardHistoryTimeline,Ap as CardRelationshipsGraph,Cv as CardStack,xi as CardTemplateSelector,Bs as CircuitBreaker,No as Column,_n as ColumnManager,oi as CommandPalette,Ti as ConfigMenu,Io as ContextMenu,Zo as DEFAULT_SHORTCUTS,dp as DEFAULT_TABLE_COLUMNS,vi as DEFAULT_TEMPLATES,Wo as DateRangePicker,_o as DependenciesSelector,Zn as DependencyLine,gi as DistributionCharts,Gs as EditableColumnTitle,So as ErrorBoundary,wi as ExportImportModal,Ci as FilterBar,bm as GANTT_AI_SYSTEM_PROMPT,rs as GanttAIAssistant,pm as GanttBoard,Lo as GanttI18nContext,es as GanttMilestone,Gn as GanttToolbar,zp as GenerateGanttTasksDialog,Ip as GeneratePlanModal,hi as GroupBySelector,zr as KanbanBoard,Zs as KanbanToolbar,qo as KanbanViewAdapter,yi as KeyboardShortcutsHelp,lp as ListView,Gt as MenuIcons,Ts as PluginManager,to as PrioritySelector,Av as RATE_LIMITS,cp as STANDARD_FIELDS,fi as SwimlaneBoardView,Vs as TagBadge,Vd as TagList,yr as TagPicker,qn as TaskBar,so as TaskDetailModal,fm as TaskFormModal,Kn as TaskGrid,Ei as ThemeModal,Pc as ThemeProvider,uu as ThemeSwitcher,as as Timeline,ro as UserAssignmentSelector,pi as VelocityChart,lu as VirtualGrid,nu as VirtualList,bo as aiUsageTracker,Bl as borderRadius,wn as calculatePosition,wl as calendarDarkTheme,gl as calendarEnTranslations,fl as calendarEsTranslations,Cl as calendarLightTheme,Tl as calendarNeutralTheme,vs as calendarThemes,bs as calendarTranslations,ns as cardToGanttTask,Cm as cardsToGanttTasks,l as cn,lc as createKanbanView,Iu as createRetryWrapper,Ni as darkTheme,Ds as darkTokenTheme,Un as defaultTheme,Ns as designTokens,zl as duration,Hl as easing,pu as exportTokensToCSS,Ar as findTaskByName,Rl as fontSize,Ol as fontWeight,un as formatCost,Hn as ganttEnTranslations,Ac as ganttEsTranslations,wm as ganttTaskToCardUpdate,rt as ganttThemes,Vl as ganttTokens,Pi as ganttTranslations,he as ganttUtils,Kl as generateCSSVariables,Xl as generateCompleteCSS,Mu as generateInitialPositions,hm as generateTasksContext,hn as generateThemeVariables,wp as getCalendarTheme,ln as getCalendarTranslations,pp as getListViewTheme,rl as getListViewTranslations,up as getMonthNames,mu as getToken,Fc as getTranslations,gp as getWeekdayNames,_l as kanbanTokens,Di as lightTheme,Yl as lightTokenTheme,$l as lineHeight,ml as listViewDarkTheme,tl as listViewEnTranslations,al as listViewEsTranslations,pl as listViewLightTheme,ul as listViewNeutralTheme,fs as listViewThemes,ss as listViewTranslations,hs as mergeCalendarTranslations,is as mergeListViewTranslations,Mi as mergeTranslations,Si as neutralTheme,ql as neutralTokenTheme,Gl as opacity,xm as parseLocalCommand,Zi as parseNaturalDate,Qi as parseNaturalDuration,el as parseProgress,vm as parseStatus,Xv as pluginManager,Lu as retrySyncOperation,Cn as retryWithBackoff,Wl as shadows,cu as shouldVirtualizeGrid,Il as spacing,co as themes,qp as useAI,Wp as useBoard,bn as useBoardCore,Cs as useBoardStore,Zp as useCardStacking,Xs as useDragState,au as useFilteredCards,Vp as useFilters,Vr as useGanttI18n,ws as useKanbanState,Dc as useKeyboardShortcuts,Xp as useMultiSelect,Ml as useSelectionState,ru as useSortedCards,Ao as useTheme,du as useVirtualGrid,su as useVirtualList,km as validateAIResponse,ai as withErrorBoundary,Nn as wouldCreateCircularDependency,Ul as zIndex};//# sourceMappingURL=index.js.map
|
|
420
420
|
//# sourceMappingURL=index.js.map
|