@libxai/board 1.5.24 → 1.5.25
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 +24 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +24 -24
- package/dist/index.js.map +1 -1
- package/dist/styles.css +50 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,selectionStore,BoardStore}from'@libxai/core';export{Board as BoardModel,BoardStore,Card as CardModel,Column as ColumnModel,DependencyEngine,Store}from'@libxai/core';import {createContext,memo,useRef,useState,forwardRef,useContext,useCallback,useEffect,useMemo,useImperativeHandle,useLayoutEffect,Component}from'react';import {useDroppable,useSensors,useSensor,PointerSensor,KeyboardSensor,DndContext,closestCorners,DragOverlay}from'@dnd-kit/core';import {useSortable,SortableContext,verticalListSortingStrategy,sortableKeyboardCoordinates}from'@dnd-kit/sortable';import {useVirtualizer}from'@tanstack/react-virtual';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {jsPDF}from'jspdf';import
|
|
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=Qc(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let i=Qc(t[n]||"");if(i.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-i.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${i.length})`);continue}for(;i.length<a.length;)i.push("");let l={};a.forEach((g,b)=>{l[g]=i[b]||"";});let p=l.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),m={id:l["Card ID"]||`card-${n}`,title:l.Title||"Untitled",description:l.Description?l.Description:void 0,columnId:d.id,position:d.cardIds.length+1,priority:l.Priority||void 0,labels:l.Labels?l.Labels.split(";").filter(Boolean):void 0,assignedUserIds:l["Assigned Users"]?l["Assigned Users"].split(";").filter(Boolean):void 0,startDate:l["Start Date"]?l["Start Date"]:void 0,endDate:l["End Date"]?l["End Date"]:void 0,createdAt:l["Created At"]?l["Created At"]:void 0,updatedAt:l["Updated At"]?l["Updated At"]:void 0};r.push(m),d.cardIds.push(m.id);}catch(i){s.push(`Line ${n+1}: ${i instanceof Error?i.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 Qc(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 Zc(e,t){switch(t){case "json":return Ef(e);case "csv":return Ff(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function eu(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 dl=createContext(null);function tu(){return useContext(dl)}var au=createContext(null);function ru({children:e,themeName:t}){return jsx(au.Provider,{value:{themeName:t},children:e})}function en(){return useContext(au)}function Ht({children:e,container:t}){let[a,r]=useState(false),o=tu(),s=en();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:i,themeName:c}=o,l={"--asakaa-color-background-primary":i.bgPrimary,"--asakaa-color-background-secondary":i.bgSecondary,"--asakaa-color-background-card":i.bgGrid,"--asakaa-color-background-hover":i.hoverBg,"--asakaa-color-text-primary":i.textPrimary,"--asakaa-color-text-secondary":i.textSecondary,"--asakaa-color-text-tertiary":i.textTertiary,"--asakaa-color-text-inverse":i.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":i.border,"--asakaa-color-border-hover":i.borderLight,"--asakaa-color-border-subtle":i.borderLight,"--asakaa-color-interactive-primary":i.accent,"--asakaa-color-interactive-primaryHover":i.accentHover,"--asakaa-color-interactive-primaryBorder":`${i.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${i.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${i.accent}33`,"--asakaa-color-status-success":i.statusCompleted,"--asakaa-color-status-warning":i.milestone,"--asakaa-color-status-error":i.criticalPath,"--asakaa-color-danger":i.criticalPath,"--asakaa-color-danger-border":`${i.criticalPath}4D`,"--asakaa-color-danger-background":`${i.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${i.criticalPath}26`};return createPortal(jsx("div",{"data-theme":c,"data-gantt-portal":"true",style:l,children:e}),n)}return s?createPortal(jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),n):createPortal(e,n)}var lu={URGENT:{label:"Urgent",color:"#EF4444"},HIGH:{label:"High",color:"#F97316"},MEDIUM:{label:"Normal",color:"#F59E0B"},LOW:{label:"Low",color:"#10B981"}},Of="#BDC3C7",$f=({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 Fo({priority:e,onChange:t,className:a}){let[r,o]=useState(false),[s,n]=useState({top:0,left:0}),i=useRef(null),c=useRef(null),l=()=>{if(!c.current)return;let g=c.current.getBoundingClientRect(),b=window.innerHeight,h=window.innerWidth,v=160,f=220,y=4,w=g.right-v;w<10&&(w=g.left),w+v>h-10&&(w=h-v-10);let x=b-g.bottom,C=g.top,k;x>=f+y?k=g.bottom+y:C>=f+y?k=g.top-f-y:k=x>=C?g.bottom+y:Math.max(10,g.top-f-y),n({top:k,left:w}),o(true);};useEffect(()=>{let g=b=>{i.current&&!i.current.contains(b.target)&&!c.current?.contains(b.target)&&o(false);};if(r)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[r]),useEffect(()=>{let g=b=>{b.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[r]);let p=g=>{t(g),o(false);},d=e?lu[e]:null,m=d?.color||Of;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:c,onClick:()=>r?o(false):l(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${m}10`:"transparent",boxShadow:e?`0 0 0 2px ${m}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:m,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:m,fillOpacity:e?"0.6":"0.4"})})}),r&&jsx(Ht,{children:jsxs("div",{ref:i,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(lu).map(([g,b])=>jsxs("button",{onClick:()=>p(g),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98] priority-option",style:{color:b.color,background:"transparent"},onMouseEnter:h=>{h.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:h=>{h.currentTarget.style.background="transparent";},children:[jsx($f,{color:b.color}),jsx("span",{className:"font-semibold text-sm",children:b.label}),e===g&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},g)),jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxs("button",{onClick:()=>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:g=>{g.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:g=>{g.currentTarget.style.background="transparent";},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"#9CA3AF",strokeWidth:"1.5",strokeDasharray:"2 2",opacity:"0.6"})}),jsx("span",{className:"font-semibold text-sm",children:"Clear"}),!e&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var Hf=[{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 In({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=useState(false),[n,i]=useState({top:0,left:0}),c=useRef(null),l=useRef(null),m=(en()?.themeName||"dark")==="dark",g=()=>{if(!l.current)return;let w=l.current.getBoundingClientRect(),x=window.innerHeight,C=window.innerWidth,k=320,D=380,T=4,I=w.left;I+k>C-10&&(I=C-k-10),I<10&&(I=10);let $=x-w.bottom,A=w.top,_;$>=D+T?_=w.bottom+T:A>=D+T?_=w.top-D-T:_=$>=A?w.bottom+T:Math.max(10,w.top-D-T),i({top:_,left:I}),s(true);};useEffect(()=>{let w=x=>{c.current&&!c.current.contains(x.target)&&!l.current?.contains(x.target)&&s(false);};if(o)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[o]),useEffect(()=>{let w=x=>{x.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[o]);let b=w=>{let x=new Date,C=I=>{let $=I.getFullYear(),A=String(I.getMonth()+1).padStart(2,"0"),_=String(I.getDate()).padStart(2,"0");return `${$}-${A}-${_}`},k=C(x),D=new Date(x);D.setDate(D.getDate()+w);let T=C(D);a(k,T),s(false);},h=()=>{if(!e||!t)return "Set date";let w=D=>{if(D instanceof Date)return D;if(typeof D!="string"||!D.match(/^\d{4}-\d{2}-\d{2}$/))return null;let T=D.split("-").map(Number);if(T.length!==3||T.some(_=>isNaN(_)))return null;let I=T[0],$=T[1],A=T[2];return I===void 0||$===void 0||A===void 0?null:new Date(I,$-1,A)},x=w(e),C=w(t);if(!x||!C||isNaN(x.getTime())||isNaN(C.getTime()))return "Set date";let k=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${k[x.getMonth()]} ${x.getDate()} \u2013 ${k[C.getMonth()]} ${C.getDate()}`},v=e&&t,y=(()=>{if(!t)return false;let w=typeof t=="string"?new Date(t):t,x=new Date;return x.setHours(0,0,0,0),w<x})();return jsxs("div",{className:`relative ${r||""}`,children:[jsxs("button",{ref:l,onClick:()=>o?s(false):g(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${y?"asakaa-date-overdue":"asakaa-date"}`,title:v?`${h()}`:"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:h()})]}),o&&jsx(Ht,{children:jsxs("div",{ref:c,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,background:m?"#1A1D25":"#FFFFFF",border:`1px solid ${m?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:m?"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:m?"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:m?"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:Hf.map(w=>jsx("button",{onClick:()=>b(w.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:m?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:x=>{x.currentTarget.style.backgroundColor=m?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",x.currentTarget.style.border=`1px solid ${m?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:x=>{x.currentTarget.style.backgroundColor=m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",x.currentTarget.style.border=`1px solid ${m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:w.label},w.label))})]}),jsxs("div",{className:"p-4",children:[jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:m?"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:w=>a(w.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:m?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:m?"dark":"light"}}),jsx("input",{type:"date",value:t||"",onChange:w=>a(e,w.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:m?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:m?"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:w=>{w.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:w=>{w.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function Po({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=useState(false),[i,c]=useState(""),[l,p]=useState({top:0,left:0}),d=useRef(null),m=useRef(null),g=()=>{if(!m.current)return;let y=m.current.getBoundingClientRect(),w=window.innerHeight,x=window.innerWidth,C=300,k=380,D=4,T=y.right-C;T<10&&(T=y.left),T+C>x-10&&(T=x-C-10);let I=w-y.bottom,$=y.top,A;I>=k+D?A=y.bottom+D:$>=k+D?A=y.top-k-D:A=I>=$?y.bottom+D:Math.max(10,y.top-k-D),p({top:A,left:T}),n(true);};useEffect(()=>{let y=w=>{d.current&&!d.current.contains(w.target)&&!m.current?.contains(w.target)&&(n(false),c(""));};if(s)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[s]),useEffect(()=>{let y=w=>{w.key==="Escape"&&(n(false),c(""));};if(s)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[s]);let b=y=>{let w=e.some(x=>x.id===y.id);a(w?e.filter(x=>x.id!==y.id):[...e,y]);},h=t.filter(y=>y.name.toLowerCase().includes(i.toLowerCase())),v=e.slice(0,o),f=e.length-o;return jsxs("div",{className:`relative ${r||""}`,children:[jsx("button",{ref:m,onClick:()=>s?n(false):g(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxs("div",{className:"asakaa-avatar-group",children:[v.map(y=>jsx("div",{className:"asakaa-avatar",title:y.name,children:y.avatar?jsx("img",{src:y.avatar,alt:y.name,className:"asakaa-avatar-img"}):y.initials},y.id)),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(Ht,{children:jsxs("div",{ref:d,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${l.top}px`,left:`${l.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("input",{type:"text",value:i,onChange:y=>c(y.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:h.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"}):h.map(y=>{let w=e.some(x=>x.id===y.id);return jsxs("button",{onClick:()=>b(y),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:x=>{x.currentTarget.style.background="transparent";},children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor:y.color,color:"#fff"},children:y.avatar?jsx("img",{src:y.avatar,alt:y.name,className:"w-full h-full rounded-full object-cover"}):y.initials}),jsx("span",{className:"font-semibold flex-1 text-left truncate",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:y.name}),jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:w?"#3b82f6":"transparent"},children:w?"\u2713":""})]},y.id)})}),e.length>0&&jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsx("button",{onClick:()=>{a([]),n(false);},className:"w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all hover:bg-red-600/30 active:scale-95 border",style:{color:"#f87171",borderColor:"rgba(248, 113, 113, 0.3)",background:"rgba(248, 113, 113, 0.08)"},children:"Clear All"})})]})})]})}function Fs(e,t,a){let r=new Map;e.forEach(c=>{if(c.dependencies&&Array.isArray(c.dependencies)){let l=c.dependencies.map(p=>{if(typeof p=="string")return p;let d=p;return d.taskId||d.targetId||""}).filter(Boolean);r.set(c.id,l);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,i=c=>{if(!s.has(c)){s.add(c),n.add(c);let l=r.get(c)||[];for(let p of l){if(!s.has(p)&&i(p))return true;if(n.has(p))return true}}return n.delete(c),false};return i(a)}function Rn({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[i,c]=useState(false),[l,p]=useState(""),[d,m]=useState(t.length>0),[g,b]=useState({top:0,left:0}),[h,v]=useState(null),f=useRef(null),y=useRef(null),w=()=>{if(!y.current)return;let T=y.current.getBoundingClientRect(),I=window.innerHeight,$=window.innerWidth,A=300,_=d?380:120,E=4,me=T.right-A;me<10&&(me=T.left),me+A>$-10&&(me=$-A-10);let L=I-T.bottom,X=T.top,Z;L>=_+E?Z=T.bottom+E:X>=_+E?Z=T.top-_-E:Z=L>=X?T.bottom+E:Math.max(10,T.top-_-E),b({top:Z,left:me}),c(true);};useEffect(()=>{if(!i||!y.current)return;let T=y.current.getBoundingClientRect(),I=window.innerHeight,$=window.innerWidth,A=300,_=d?380:120,E=4,me=T.right-A;me<10&&(me=T.left),me+A>$-10&&(me=$-A-10);let L=I-T.bottom,X=T.top,Z;L>=_+E?Z=T.bottom+E:X>=_+E?Z=T.top-_-E:Z=L>=X?T.bottom+E:Math.max(10,T.top-_-E),b({top:Z,left:me});},[d,i]),useEffect(()=>{let T=I=>{f.current&&!f.current.contains(I.target)&&!y.current?.contains(I.target)&&(c(false),p(""));};if(i)return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[i]),useEffect(()=>{let T=I=>{I.key==="Escape"&&(c(false),p(""));};if(i)return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[i]);let x=T=>{let I=t.includes(T),$=a.find(A=>A.id===T);if(v(null),I){let A=t.filter(_=>_!==T);r(A),A.length===0&&m(false);}else {if(s&&Fs(a,T,e)){let _=`Cannot add "${$?.title||T}" as dependency - would create circular reference`;v(_),n?.(T,$?.title||T),setTimeout(()=>v(null),3e3);return}r([...t,T]),m(true);}},C=()=>{let T=!d;m(T),T||r([]);},k=a.filter(T=>T.id!==e).filter(T=>T.title.toLowerCase().includes(l.toLowerCase())||T.id.toLowerCase().includes(l.toLowerCase())),D=t.length>0?"#2E94FF":"#BDC3C7";return jsxs("div",{className:`relative ${o||""}`,children:[jsxs("button",{ref:y,onClick:()=>i?c(false):w(),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:D,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsx("span",{className:"text-xs font-medium",style:{color:D},children:t.length})]}),i&&jsx(Ht,{children:jsxs("div",{ref:f,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${g.top}px`,left:`${g.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[h&&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:h})]}),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:C,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:l,onChange:T=>p(T.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:k.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"}):k.map(T=>{let I=t.includes(T.id);return jsxs("button",{onClick:()=>x(T.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:$=>{$.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:$=>{$.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:T.title}),jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:T.id})]})]},T.id)})})]}),t.length>0&&jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsx("button",{onClick:()=>{r([]),m(false),c(false);},className:"w-full px-3 py-2 rounded-md text-xs font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#E74C3C"},children:"Clear All Dependencies"})})]})})]})}var Kr=memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:i=[],allCards:c=[]})=>{let{attributes:l,listeners:p,setNodeRef:d,transform:m,transition:g,isDragging:b}=useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),h={transform:Ns.Transform.toString(m),transition:g};if(t)return jsx("div",{ref:d,style:h,...l,...p,onClick:()=>a?.(e),children:t(e)});let v=i.filter(x=>e.assignedUserIds?.includes(x.id)),f=e.progress===100,y=(e.attachments||[]).filter(x=>x.type.startsWith("image/")),w={...h,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxs("div",{ref:d,style:w,className:u("asakaa-card",b&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...l,...p,onClick:x=>{x.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||a?.(e);},children:[e.coverImage&&jsx("div",{className:"asakaa-card-cover mb-3",children:jsx("img",{src:e.coverImage,alt:`Cover for ${e.title}`,className:"w-full h-32 object-cover rounded-md",loading:"lazy",onError:x=>{x.currentTarget.style.display="none";}})}),y.length>0&&!e.coverImage&&jsx("div",{className:"asakaa-card-attachments mb-3",children:y.length===1&&y[0]?jsx("img",{src:y[0].url,alt:y[0].name,className:"w-full h-32 object-cover rounded-md",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:x=>{x.currentTarget.style.display="none";}}):jsx("div",{className:"grid grid-cols-2 gap-1",children:y.slice(0,4).map((x,C)=>jsxs("div",{className:"relative",children:[jsx("img",{src:x.url,alt:x.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:k=>{k.currentTarget.style.display="none";}}),C===3&&y.length>4&&jsx("div",{className:"absolute inset-0 bg-black/60 rounded flex items-center justify-center",children:jsxs("span",{className:"text-white text-sm font-medium",children:["+",y.length-4]})})]},x.id))})}),jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration: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:x=>x.stopPropagation(),className:"priority-selector",children:jsx(Fo,{priority:e.priority,onChange:x=>n?.(e.id,{priority:x})})}),jsx("div",{onClick:x=>x.stopPropagation(),className:"date-picker",children:jsx(In,{startDate:e.startDate?typeof e.startDate=="string"?e.startDate:e.startDate.toISOString().split("T")[0]:void 0,endDate:e.endDate?typeof e.endDate=="string"?e.endDate:e.endDate.toISOString().split("T")[0]:void 0,onChange:(x,C)=>n?.(e.id,{startDate:x,endDate:C})})}),i.length>0&&jsx("div",{onClick:x=>x.stopPropagation(),className:"user-selector",children:jsx(Po,{assignedUsers:v,availableUsers:i,onChange:x=>n?.(e.id,{assignedUserIds:x.map(C=>C.id)})})}),jsx("div",{onClick:x=>x.stopPropagation(),className:"dependencies-selector",children:jsx(Rn,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(x=>typeof x=="string"?x:x.taskId):[],availableTasks:c,onChange:x=>n?.(e.id,{dependencies:x})})})]}),e.labels&&e.labels.length>0&&jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(x=>jsx("span",{className:"asakaa-label",children:x},x))}),typeof e.progress=="number"&&jsxs("div",{className:"mt-3 pt-2 border-t border-white/5",children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:"text-[10px] text-[#6B7280]",children:"Progreso"}),jsxs("span",{className:"text-[10px] font-medium",style:{color:"#2E94FF"},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:"#2E94FF"}})})]})]})},(e,t)=>e.card.id===t.card.id&&e.card.title===t.card.title&&e.card.description===t.card.description&&e.card.position===t.card.position&&e.card.columnId===t.card.columnId&&e.card.priority===t.card.priority&&e.card.color===t.card.color&&e.card.progress===t.card.progress&&e.card.startDate===t.card.startDate&&e.card.endDate===t.card.endDate&&e.isSelected===t.isSelected&&e.render===t.render&&JSON.stringify(e.card.labels)===JSON.stringify(t.card.labels)&&JSON.stringify(e.card.assignedUserIds)===JSON.stringify(t.card.assignedUserIds)&&JSON.stringify(e.card.dependencies)===JSON.stringify(t.card.dependencies)&&JSON.stringify(e.card.attachments?.map(a=>a.id))===JSON.stringify(t.card.attachments?.map(a=>a.id)));Kr.displayName="Card";var Ms={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"}},yu=({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 xu({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=useState(false),[n,i]=useState({top:0,left:0}),c=useRef(null),l=useRef(null),p=[...Object.entries(Ms).map(([v,f])=>({id:v,label:f.label,color:f.color,icon:f.icon})),...r.filter(v=>!Object.keys(Ms).includes(v.id)).map(v=>({id:v.id,label:v.title,color:v.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let v=Ms[e];if(v)return {...v,id:e};let f=r.find(y=>y.id===e);return f?{id:f.id,label:f.title,color:f.color||"#8B5CF6",icon:"circle-dot"}:{...Ms.todo,id:"todo"}},m=()=>{if(!l.current)return;let v=l.current.getBoundingClientRect(),f=window.innerHeight,y=window.innerWidth,w=180,x=280,C=4,k=v.right-w;k<10&&(k=v.left),k+w>y-10&&(k=y-w-10);let D=f-v.bottom,T=v.top,I;D>=x+C?I=v.bottom+C:T>=x+C?I=v.top-x-C:I=D>=T?v.bottom+C:Math.max(10,v.top-x-C),i({top:I,left:k}),s(true);};useEffect(()=>{let v=f=>{c.current&&!c.current.contains(f.target)&&!l.current?.contains(f.target)&&s(false);};if(o)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[o]),useEffect(()=>{let v=f=>{f.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[o]);let g=v=>{t(v),s(false);},b=d(),h=b.color;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:l,onClick:()=>o?s(false):m(),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:`${h}10`,boxShadow:`0 0 0 2px ${h}30 inset`},title:b.label,children:jsx(yu,{icon:b.icon,color:h})}),o&&jsx(Ht,{children:jsxs("div",{ref:c,className:"status-selector-menu",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsx("div",{className:"py-1",children:p.map(v=>jsxs("button",{onClick:()=>g(v.id),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:v.color,background:"transparent"},onMouseEnter: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(yu,{icon:v.icon,color:v.color}),jsx("span",{className:"font-semibold",children:v.label}),e===v.id&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},v.id))})]})})]})}var vu={en:{renameColumn:"Rename Column",rename:"Rename",delete:"Delete",columnName:"Column name",columnOptions:"Column options"},es:{renameColumn:"Renombrar Columna",rename:"Renombrar",delete:"Eliminar",columnName:"Nombre de columna",columnOptions:"Opciones de columna"}};function wu({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o,locale:s="en"}){let n=vu[s]||vu.en,[i,c]=useState(false),[l,p]=useState(false),[d,m]=useState(e),[g,b]=useState({top:0,left:0}),h=useRef(null),v=useRef(null),f=useRef(null);useEffect(()=>{if(i&&v.current){let C=v.current.getBoundingClientRect();b({top:C.bottom+window.scrollY+8,left:C.left+window.scrollX});}},[i]),useEffect(()=>{let C=k=>{h.current&&!h.current.contains(k.target)&&!v.current?.contains(k.target)&&(c(false),p(false));};if(i)return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[i]),useEffect(()=>{let C=k=>{k.key==="Escape"&&(c(false),p(false),m(e));};if(i)return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[i,e]),useEffect(()=>{l&&f.current&&(f.current.focus(),f.current.select());},[l]);let y=()=>{p(true),m(e);},w=()=>{let C=d.trim();C&&C!==e&&t(C),p(false),c(false),m(e);},x=C=>{C.key==="Enter"?w():C.key==="Escape"&&(p(false),m(e));};return jsxs("div",{className:`relative ${o||""}`,children:[jsx("button",{ref:v,onClick:()=>c(!i),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:n.columnOptions,"aria-label":n.columnOptions,children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),i&&jsx(Ht,{children:jsx("div",{ref:h,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${g.top}px`,left:`${g.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:l?jsxs("div",{className:"p-3",children:[jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:n.renameColumn}),jsx("input",{ref:f,type:"text",value:d,onChange:C=>m(C.target.value),onKeyDown:x,onBlur:w,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:n.columnName,maxLength:50})]}):jsxs("div",{className:"py-1",children:[jsxs("button",{onClick:y,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:n.rename})]}),r&&a&&jsxs(Fragment,{children:[jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxs("button",{onClick:()=>{a(),c(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:n.delete})]})]})]})})})]})}var rn=memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:i,availableUsers:c,allCards:l,enableVirtualization:p,cardHeight:d=120,isCollapsed:m,onToggleCollapse:g,onColumnRename:b,onColumnDelete:h,isDeletable:v=false,className:f,renderMetrics:y,locale:w})=>{let{setNodeRef:x,isOver:C}=useDroppable({id:e.id,data:{type:"column",column:e}}),k=useRef(null),D=p??jc(t.length),T=useVirtualizer({count:t.length,getScrollElement:()=>k.current,estimateSize:()=>d,enabled:D});if(a)return jsx("div",{ref:x,className:f,children:a(e,t)});let $=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let E=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:E}:E>=80?{state:"warning",percentage:E}:E>=60?{state:"approaching",percentage:E}:{state:"ok",percentage:E}})(),A=$.state==="exceeded",_=()=>"asakaa-column-count";return jsxs("div",{ref:x,className:u("asakaa-column",C&&"ring-2 ring-asakaa-accent-blue",A&&"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:u(_()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&$.state!=="none"&&jsxs("span",{className:"text-xs font-medium flex items-center",title:`${$.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[$.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"})]}),$.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"})]}),$.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"})}),$.state==="ok"&&jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(b||h)&&jsx(wu,{columnTitle:e.title,onRename:E=>b?.(e.id,E),onDelete:h?()=>h(e.id):void 0,isDeletable:v,locale:w}),g&&jsx("button",{onClick:g,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":m?"Expand column":"Collapse column",children:m?"\u25B6":"\u25BC"})]})]}),y&&y(e,t),!m&&jsx("div",{ref:k,className:"asakaa-column-cards",style:{maxHeight:D?"600px":void 0},children:jsx(SortableContext,{items:t.map(E=>E.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"})}):D?jsx("div",{style:{height:`${T.getTotalSize()}px`,position:"relative"},children:T.getVirtualItems().map(E=>{let me=t[E.index];return me?jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${E.start}px)`},children:jsx(Kr,{card:me,render:r,onClick:n,onUpdate:i,availableUsers:c,allCards:l})},me.id):null})}):t.map(E=>jsx(Kr,{card:E,render:r,onClick:n,onUpdate:i,availableUsers:c,allCards:l},E.id))})})]})});rn.displayName="Column";function gl({title:e,onSave:t,className:a}){let[r,o]=useState(false),[s,n]=useState(e),i=useRef(null);useEffect(()=>{r&&i.current&&(i.current.focus(),i.current.select());},[r]);let c=()=>{let p=s.trim();p&&p!==e?t(p):n(e),o(false);},l=p=>{p.key==="Enter"?c():p.key==="Escape"&&(n(e),o(false));};return r?jsx("input",{ref:i,type:"text",value:s,onChange:p=>n(p.target.value),onBlur:c,onKeyDown:l,className:u("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsx("h2",{className:u("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function nb(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 Su(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(i=>{let c=i.name.toLowerCase(),l=c.replace(/\s+/g,""),p=c.split(/\s+/);return !!(l===s||c===s||p.some(d=>d===s))});n&&!a.includes(n.id)&&a.push(n.id);}return a}function sb(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function ib(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var lb=["\u{1F600}","\u{1F602}","\u{1F970}","\u{1F60D}","\u{1F914}","\u{1F44D}","\u{1F44E}","\u{1F389}","\u{1F525}","\u2764\uFE0F","\u{1F4AF}","\u2705","\u274C","\u26A0\uFE0F","\u{1F4CC}","\u{1F4A1}","\u{1F680}","\u2B50","\u{1F3AF}","\u{1F4AA}","\u{1F64F}","\u{1F440}","\u{1F4DD}","\u{1F4AC}"];function Eu({value:e,onChange:t,onSubmit:a,users:r,placeholder:o,disabled:s=false,isSubmitting:n=false,theme:i="dark",locale:c="es",currentUser:l,enableEmoji:p=true,enableAttachments:d=true,pendingFiles:m=[],onFilesSelect:g,onRemoveFile:b,maxFileSizeMB:h=10}){let v=i==="dark",[f,y]=useState(false),[w,x]=useState([]),[C,k]=useState(0),[D,T]=useState(null),[I,$]=useState(false),A=useRef(null),_=useRef(null),E=useRef(null),me=useRef(null),L=useCallback((U,re)=>{let ee=nb(U,re);if(T(ee),ee){let Ee=r.filter(we=>we.name.toLowerCase().includes(ee.query)||we.email&&we.email.toLowerCase().includes(ee.query)).slice(0,5);x(Ee),y(Ee.length>0),k(0);}else y(false),x([]);},[r]),X$1=U=>{let re=U.target.value;if(t(re),L(re,U.target.selectionStart||0),A.current){A.current.style.height="24px";let ee=A.current.scrollHeight,Ee=280,we=Math.min(ee,Ee);A.current.style.height=`${we}px`,A.current.style.overflowY=ee>Ee?"auto":"hidden";}},Z=()=>{A.current&&L(e,A.current.selectionStart||0);},He=useCallback(U=>{if(!D||!A.current)return;let re=e.slice(0,D.start),ee=e.slice(D.end),Ee=`@${U.name.replace(/\s+/g,"")} `,we=re+Ee+ee;t(we),y(false),T(null),setTimeout(()=>{if(A.current){let Be=D.start+Ee.length;A.current.selectionStart=Be,A.current.selectionEnd=Be,A.current.focus();}},0);},[D,e,t]),O=U=>{if(f&&w.length>0)switch(U.key){case "ArrowDown":U.preventDefault(),k(re=>re<w.length-1?re+1:0);break;case "ArrowUp":U.preventDefault(),k(re=>re>0?re-1:w.length-1);break;case "Enter":{U.preventDefault();let re=w[C];re&&He(re);break}case "Tab":{U.preventDefault();let re=w[C];re&&He(re);break}case "Escape":U.preventDefault(),y(false);break}else U.key==="Enter"&&!U.shiftKey&&(U.preventDefault(),a());};useEffect(()=>{let U=re=>{_.current&&!_.current.contains(re.target)&&A.current&&!A.current.contains(re.target)&&y(false),me.current&&!me.current.contains(re.target)&&$(false);};return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[]);let j=useCallback(U=>{if(!A.current)return;let re=A.current.selectionStart||e.length,ee=e.slice(0,re)+U+e.slice(re);t(ee),$(false),setTimeout(()=>{if(A.current){let Ee=re+U.length;A.current.selectionStart=Ee,A.current.selectionEnd=Ee,A.current.focus();}},0);},[e,t]),he=useCallback(U=>{if(!g||!U.target.files)return;let re=Array.from(U.target.files),ee=h*1024*1024,Ee=re.filter(we=>we.size>ee?(console.warn(`File ${we.name} exceeds max size of ${h}MB`),false):true);Ee.length>0&&g(Ee),U.target.value="";},[g,h]),je=useCallback(U=>U.type.startsWith("image/")?Image:U.type.includes("pdf")||U.type.includes("document")?FileText:File,[]);return useEffect(()=>{if(f&&_.current){let U=_.current.children[C];U&&U.scrollIntoView({block:"nearest"});}},[C,f]),jsxs("div",{className:"flex flex-col gap-2",children:[m.length>0&&jsx("div",{className:"flex flex-wrap gap-2",children:m.map(U=>{let re=je(U.file),ee=U.file.type.startsWith("image/");return jsxs("div",{className:u("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",v?"bg-white/10":"bg-gray-100"),children:[ee&&U.preview?jsx("img",{src:U.preview,alt:U.file.name,className:"w-6 h-6 rounded object-cover"}):jsx(re,{className:u("w-4 h-4",v?"text-[#9CA3AF]":"text-gray-500")}),jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsx("p",{className:u("text-xs truncate",v?"text-white":"text-gray-900"),children:U.file.name}),jsx("p",{className:u("text-xs",v?"text-[#6B7280]":"text-gray-400"),children:ib(U.file.size)})]}),b&&jsx("button",{onClick:()=>b(U.id),className:u("p-0.5 rounded-full transition-colors",v?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600"),children:jsx(X,{className:"w-3 h-3"})})]},U.id)})}),jsxs("div",{className:"flex items-start gap-2",children:[l&&jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:l.color||"#8B5CF6"},children:l.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:u("flex-1 relative min-w-0"),children:[jsxs("div",{className:u("flex items-end gap-1 px-2 py-2 rounded-lg",v?"bg-white/5":"bg-white border border-gray-200"),children:[p&&jsxs("div",{className:"relative",children:[jsx("button",{type:"button",onClick:()=>$(!I),disabled:s||n,className:u("p-1 rounded transition-colors flex-shrink-0",v?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:"Emojis",children:jsx(Smile,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:I&&jsx(motion.div,{ref:me,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:u("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",v?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-8 gap-1 w-[200px]",children:lb.map(U=>jsx("button",{type:"button",onClick:()=>j(U),className:u("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",v?"hover:bg-white/10":"hover:bg-gray-100"),children:U},U))})})})]}),d&&g&&jsxs(Fragment,{children:[jsx("button",{type:"button",onClick:()=>E.current?.click(),disabled:s||n,className:u("p-1.5 rounded transition-colors",v?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:c==="es"?"Adjuntar archivo":"Attach file",children:jsx(Paperclip,{className:"w-4 h-4"})}),jsx("input",{ref:E,type:"file",multiple:true,onChange:he,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsx("textarea",{ref:A,value:e,onChange:X$1,onSelect:Z,onKeyDown:O,placeholder:o||(c==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||n,rows:1,className:u("flex-1 bg-transparent text-sm outline-none min-w-[100px] resize-none py-0.5",v?"text-white placeholder:text-[#6B7280] scrollbar-slim":"text-gray-900 placeholder:text-gray-400 scrollbar-slim-light",(s||n)&&"opacity-50"),style:{lineHeight:"1.5",height:"24px",maxHeight:"280px",overflowY:"hidden"}}),jsx("button",{onClick:a,disabled:n||!e.trim()&&m.length===0||s,className:u("p-1.5 rounded transition-colors",(e.trim()||m.length>0)&&!s?"bg-blue-500 text-white hover:bg-blue-600":v?"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:f&&w.length>0&&jsx(motion.div,{ref:_,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:u("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",v?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:w.map((U,re)=>jsxs("button",{type:"button",onClick:()=>He(U),className:u("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",re===C?v?"bg-white/10":"bg-gray-100":v?"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:U.color||"#8B5CF6"},children:sb(U.name)}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("p",{className:u("text-sm font-medium truncate",v?"text-white":"text-gray-900"),children:U.name}),U.email&&jsx("p",{className:u("text-xs truncate",v?"text-[#6B7280]":"text-gray-500"),children:U.email})]})]},U.id))})})]})]})]})}function Fu({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((i,c)=>i.type==="mention"?jsx("span",{className:u("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:i.value},c):jsx("span",{children:i.value},c))})}var Bs=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#2E94FF","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function lo({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[i,c]=useState(false),[l,p]=useState(""),[d,m]=useState(false),[g,b]=useState(Bs[10]||"#2E94FF"),[h,v]=useState({top:0,left:0}),f=useRef(null),y=useRef(null),w=useRef(null),x=useRef(null),C=t.filter(A=>A.name.toLowerCase().includes(l.toLowerCase())),k=t.some(A=>A.name.toLowerCase()===l.toLowerCase());useEffect(()=>{if(i&&y.current){let A=y.current.getBoundingClientRect();v({top:A.bottom+6,left:A.left});}},[i]),useEffect(()=>{let A=_=>{let E=_.target,me=f.current?.contains(E),L=w.current?.contains(E);!me&&!L&&(c(false),p(""),m(false));};if(i)return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[i]),useEffect(()=>{i&&x.current&&x.current.focus();},[i]);let D=A=>{let _=e.some(E=>E.id===A.id);a(_?e.filter(E=>E.id!==A.id):[...e,A]);},T=async()=>{if(!(!r||!l.trim())){m(true);try{let A=await r(l.trim(),g);A&&(a([...e,A]),p(""),b(Bs[Math.floor(Math.random()*Bs.length)]||"#2E94FF"));}finally{m(false);}}},I=(A,_)=>{_.stopPropagation(),a(e.filter(E=>E.id!==A));},$={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxs("div",{ref:f,className:"relative",children:[jsxs("button",{ref:y,type:"button",onClick:()=>!s&&c(!i),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:$,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(A=>jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${A.color}20`,color:A.color},children:A.name},A.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:i&&jsxs(motion.div,{ref:w,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:h.top,left:h.left,zIndex:99999,backgroundColor:o.bgPrimary,border:`1px solid ${o.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsx("div",{className:"p-2 border-b",style:{borderColor:o.border},children:jsx("input",{ref:x,type:"text",value:l,onChange:A=>p(A.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:A=>{A.key==="Enter"&&l.trim()&&!k&&r&&T();}})}),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(A=>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:`${A.color}20`,color:A.color},onClick:_=>I(A.id,_),children:[A.name,jsx(X,{className:"w-3 h-3"})]},A.id))})]}),jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:C.length>0?C.map(A=>{let _=e.some(E=>E.id===A.id);return jsxs("button",{type:"button",onClick:()=>D(A),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:_?`${A.color}15`:"transparent",color:o.textPrimary},onMouseEnter:E=>{_||(E.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:E=>{_||(E.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:A.color}}),jsx("span",{className:"flex-1 text-left",children:A.name}),_&&jsx(Check,{className:"w-4 h-4",style:{color:A.color}})]},A.id)}):l.trim()?jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No se encontraron etiquetas"}):jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No hay etiquetas disponibles"})}),l.trim()&&!k&&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:Bs.map(A=>jsx("button",{type:"button",onClick:()=>b(A),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:A,outline:g===A?`2px solid ${A}`:"none",outlineOffset:"2px"}},A))}),jsxs("button",{type:"button",onClick:T,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:g,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 "',l.trim(),'"']})]})]})}),document.body)]})}function bl({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 Pu({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(bl,{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 Lo=[{name:"Azul",value:"#2E94FF",light:"#5AADFF"},{name:"P\xFArpura",value:"#A855F7",light:"#C084FC"},{name:"Rosa",value:"#EC4899",light:"#F472B6"},{name:"Rojo",value:"#EF4444",light:"#F87171"},{name:"Naranja",value:"#F59E0B",light:"#FBBF24"},{name:"Amarillo",value:"#EAB308",light:"#FACC15"},{name:"Lima",value:"#84CC16",light:"#A3E635"},{name:"Verde",value:"#10B981",light:"#34D399"},{name:"Esmeralda",value:"#059669",light:"#10B981"},{name:"Cyan",value:"#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 Au(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h${a}m`}function hb(e){switch(e){case "on-track":return {text:"text-green-600 dark:text-green-400",bg:"bg-green-50 dark:bg-green-900/20",border:"border-green-200 dark:border-green-800"};case "at-risk":return {text:"text-yellow-600 dark:text-yellow-400",bg:"bg-yellow-50 dark:bg-yellow-900/20",border:"border-yellow-200 dark:border-yellow-800"};case "over-budget":return {text:"text-red-600 dark:text-red-400",bg:"bg-red-50 dark:bg-red-900/20",border:"border-red-200 dark:border-red-800"};case "no-estimate":default:return {text:"text-gray-500 dark:text-gray-400",bg:"bg-gray-50 dark:bg-gray-800/50",border:"border-gray-200 dark:border-gray-700"}}}function yb({className:e}){return jsxs("svg",{className:u("w-3 h-3",e),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M12 6v6l4 2"})]})}function hl({summary:e,size:t="sm",showEstimate:a=true,onClick:r,className:o}){let s=hb(e.health),n={sm:"text-xs px-1.5 py-0.5 gap-1",md:"text-sm px-2 py-1 gap-1.5",lg:"text-base px-2.5 py-1.5 gap-2"},i={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},c=Au(e.loggedMinutes),l=e.estimateMinutes?Au(e.estimateMinutes):null,p=a&&l?`${c} / ${l}`:c;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxs(r?"button":"span",{className:u("inline-flex items-center rounded-full border font-medium","transition-colors duration-150",s.text,s.bg,s.border,n[t],r&&"cursor-pointer hover:opacity-80 focus:outline-none focus:ring-2 focus:ring-offset-1",o),onClick:r,type:r?"button":void 0,children:[jsx(yb,{className:i[t]}),jsx("span",{children:p})]})}function xb(e){let t=e.trim();if(!t)return null;let a;if(t.startsWith("="))a=t.slice(1).trim();else if(t.startsWith("+")&&/[*\/()]/.test(t))a=t.slice(1).trim();else if(/^\d[\d\s]*[*\/]/.test(t)||/^\(/.test(t))a=t;else return null;if(!a||!/^[\d+\-*/().\s]+$/.test(a)||/[+\-*/]{2,}/.test(a.replace(/\s/g,"").replace(/\*-/g,"X").replace(/\/-/g,"X")))return null;try{let r=new Function(`"use strict"; return (${a});`)();return typeof r!="number"||!isFinite(r)||r<0?null:r}catch{return null}}function Os(e){let t=xb(e);return t!==null?String(t):e}function Iu(e){let a=Os(e).trim().toLowerCase();if(a.includes(":")){let[n,i]=a.split(":").map(Number);return (n||0)*60+(i||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),o=a.match(/(\d+)\s*m/);if(r||o){let n=r?.[1]?parseFloat(r[1]):0,i=o?.[1]?parseInt(o[1],10):0;return Math.round(n*60)+i}let s=parseFloat(a);return isNaN(s)?0:Math.round(s*60)}function $s(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function kb(e){let t=Math.floor(e/3600),a=Math.floor(e%3600/60),r=e%60;return t>0?`${t}:${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`:`${a}:${r.toString().padStart(2,"0")}`}function Cb({className:e}){return jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{d:"M8 5v14l11-7z"})})}function Tb({className:e}){return jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})})}function Bu({className:e}){return jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:jsx("path",{d:"M6 18L18 6M6 6l12 12"})})}function Nb({className:e}){return jsxs("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M12 6v6l4 2"})]})}function yl({taskId:e,summary:t,entries:a=[],isTimerRunning:r=false,timerElapsedSeconds:o=0,onLogTime:s,onUpdateEstimate:n,onStartTimer:i,onStopTimer:c,onDiscardTimer:l,onClose:p,className:d}){let[m,g]=useState(""),[b,h]=useState(t.estimateMinutes?$s(t.estimateMinutes):""),[v,f]=useState(""),[y,w]=useState(false),[x,C]=useState(false),k=useRef(null);useEffect(()=>{k.current?.focus();},[]);let D=async()=>{let $=Iu(m);if(!($<=0||!s)){w(true);try{await s({durationMinutes:$,note:v.trim()||void 0,source:"manual"}),g(""),f("");}finally{w(false);}}},T=async()=>{if(!n)return;let $=b.trim()?Iu(b):null;await n($),C(false);},I=$=>{$.key==="Enter"&&!$.shiftKey&&($.preventDefault(),D()),$.key==="Escape"&&p?.();};return jsxs("div",{className:u("w-72 bg-white dark:bg-gray-800 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700","divide-y divide-gray-100 dark:divide-gray-700",d),children:[jsxs("div",{className:"px-3 py-2 flex items-center justify-between",children:[jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-200",children:"Time Tracking"}),jsx("button",{onClick:p,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-400",children:jsx(Bu,{className:"w-4 h-4"})})]}),jsx("div",{className:"px-3 py-2",children:r?jsxs("div",{className:"flex items-center gap-2",children:[jsxs("div",{className:"flex-1 flex items-center gap-2",children:[jsxs("span",{className:"relative flex h-2 w-2",children:[jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-green-500"})]}),jsx("span",{className:"text-lg font-mono font-medium text-gray-900 dark:text-white",children:kb(o)})]}),jsx("button",{onClick:c,className:"p-2 rounded-lg bg-green-500 hover:bg-green-600 text-white",title:"Stop and save",children:jsx(Tb,{className:"w-4 h-4"})}),jsx("button",{onClick:l,className:"p-2 rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-600 dark:text-gray-300",title:"Discard",children:jsx(Bu,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:i,className:u("w-full flex items-center justify-center gap-2 px-3 py-2 rounded-lg","bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600","text-gray-700 dark:text-gray-200 font-medium text-sm"),children:[jsx(Cb,{className:"w-4 h-4"}),"Start Timer"]})}),jsxs("div",{className:"px-3 py-2 space-y-2",children:[jsxs("div",{className:"flex gap-2",children:[jsxs("div",{className:"relative flex-1",children:[jsx(Nb,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsx("input",{ref:k,type:"text",value:m,onChange:$=>g($.target.value),onKeyDown:I,placeholder:"8 (=8h), 2h 30m",className:u("w-full pl-8 pr-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent")})]}),jsx("button",{onClick:D,disabled:y||!m.trim(),className:u("px-3 py-1.5 rounded-lg text-sm font-medium","bg-blue-500 hover:bg-blue-600 text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:"Log"})]}),jsx("input",{type:"text",value:v,onChange:$=>f($.target.value),onKeyDown:I,placeholder:"Note (optional)",className:u("w-full px-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent")})]}),jsxs("div",{className:"px-3 py-2",children:[jsxs("div",{className:"flex justify-between text-sm",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Logged"}),jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:$s(t.loggedMinutes)})]}),jsxs("div",{className:"flex justify-between text-sm mt-1",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Estimate"}),x?jsx("div",{className:"flex items-center gap-1",children:jsx("input",{type:"text",value:b,onChange:$=>h($.target.value),onKeyDown:$=>{$.key==="Enter"&&T(),$.key==="Escape"&&C(false);},onBlur:T,autoFocus:true,className:"w-16 px-1 py-0.5 text-sm text-right rounded border border-blue-500 bg-transparent focus:outline-none",placeholder:"4h"})}):jsx("button",{onClick:()=>C(true),className:"font-medium text-gray-900 dark:text-white hover:text-blue-500",children:t.estimateMinutes?$s(t.estimateMinutes):"Set estimate"})]}),t.progressPercent!==null&&jsxs("div",{className:"mt-2",children:[jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Progress"}),jsxs("span",{className:u("font-medium",t.health==="on-track"&&"text-green-600",t.health==="at-risk"&&"text-yellow-600",t.health==="over-budget"&&"text-red-600"),children:[t.progressPercent,"%"]})]}),jsx("div",{className:"h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:jsx("div",{className:u("h-full transition-all duration-300",t.health==="on-track"&&"bg-green-500",t.health==="at-risk"&&"bg-yellow-500",t.health==="over-budget"&&"bg-red-500"),style:{width:`${Math.min(100,t.progressPercent)}%`}})})]})]}),a.length>0&&jsxs("div",{className:"px-3 py-2",children:[jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-2",children:"Recent Entries"}),jsx("div",{className:"space-y-1 max-h-24 overflow-y-auto",children:a.slice(0,3).map($=>jsxs("div",{className:"flex items-center justify-between text-xs text-gray-600 dark:text-gray-300",children:[jsx("span",{className:"truncate flex-1",children:$.note||"Time logged"}),jsx("span",{className:"font-medium ml-2",children:$s($.durationMinutes)})]},$.id))})]})]})}function Mb(e){let a=Os(e).trim().toLowerCase();if(!a||a==="-")return null;if(a.includes(":")){let[n,i]=a.split(":").map(Number);return (n||0)*60+(i||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),o=a.match(/(\d+)\s*m/);if(r||o){let n=r?.[1]?parseFloat(r[1]):0,i=o?.[1]?parseInt(o[1],10):0;return Math.round(n*60)+i}let s=parseFloat(a);return isNaN(s)?null:Math.round(s*60)}function Pb(e){if(!e||e===0)return "";let t=Math.floor(e/60),a=e%60;return t===0?`${a}m`:a===0?`${t}h`:`${t}h ${a}m`}function $r({mode:e,locale:t,isDark:a,currentValue:r,onSave:o,onClose:s,className:n}){let[i,c]=useState(Pb(r)),[l,p]=useState(""),[d,m]=useState(false),g=useRef(null);useEffect(()=>{g.current?.focus();},[]);let b=async()=>{m(true);let w=Mb(i);await o(w&&w>0?w:null,l||void 0),m(false);},h=async()=>{m(true),await o(null),m(false);},v=w=>{w.key==="Enter"&&!w.shiftKey&&(w.preventDefault(),b()),w.key==="Escape"&&s();},f={estimate:t==="es"?"Estimaci\xF3n":"Estimate",quoted:t==="es"?"T. Ofertado":"Quoted",log:t==="es"?"Registrar":"Log Time"},y=t==="es";return jsxs("div",{className:u("w-56",n),style:{background:a?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:a?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:"8px",boxShadow:a?"0 8px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.05)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)"},onClick:w=>w.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between px-3 py-2",style:{borderBottom:a?"1px solid rgba(255,255,255,0.06)":"1px solid #F3F4F6"},children:[jsxs("div",{className:"flex items-center gap-1.5",children:[jsx(Clock,{className:"w-3 h-3",style:{color:a?"#007FFF":"#2E94FF"}}),jsx("span",{className:"font-mono uppercase tracking-wider",style:{fontSize:"10px",fontWeight:600,color:a?"rgba(255,255,255,0.5)":"#6B7280"},children:f[e]})]}),jsx("button",{type:"button",onClick:s,className:"p-0.5 rounded transition-colors",style:{color:a?"rgba(255,255,255,0.3)":"#9CA3AF"},children:jsx(X,{className:"w-3 h-3"})})]}),jsxs("div",{className:"p-3 space-y-2",children:[jsx("input",{ref:g,type:"text",value:i,onChange:w=>c(w.target.value),onKeyDown:v,placeholder:"2h 30m",className:"w-full font-mono outline-none",style:{fontSize:"13px",fontWeight:700,padding:"6px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"#FFFFFF":"#111827"}}),jsx("p",{className:"font-mono",style:{fontSize:"9px",color:a?"rgba(255,255,255,0.25)":"#9CA3AF",letterSpacing:"0.02em"},children:"8=8h \xB7 1h 30m \xB7 45m \xB7 =8*9"}),e==="log"&&jsx("input",{type:"text",value:l,onChange:w=>p(w.target.value),onKeyDown:v,placeholder:y?"Nota (opcional)":"Note (optional)",className:"w-full outline-none",style:{fontSize:"11px",padding:"5px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"rgba(255,255,255,0.7)":"#374151"}}),jsx("button",{type:"button",onClick:b,disabled:d||!i.trim(),className:"w-full font-mono uppercase tracking-wider transition-all disabled:opacity-30 disabled:cursor-not-allowed",style:{fontSize:"10px",fontWeight:600,padding:"6px 0",borderRadius:"4px",border:a?"1px solid rgba(0,127,255,0.3)":"1px solid #2E94FF",background:a?"rgba(0,127,255,0.15)":"#2E94FF",color:a?"#007FFF":"#FFFFFF"},children:d?y?"Guardando...":"Saving...":y?"Registrar":"Save"}),r&&e!=="log"&&jsx("button",{type:"button",onClick:h,disabled:d,className:"w-full font-mono uppercase tracking-wider transition-colors",style:{fontSize:"9px",padding:"4px 0",color:a?"rgba(255,255,255,0.3)":"#9CA3AF"},children:y?"Quitar":"Clear"})]})]})}function Ab(e){switch(e){case "on-track":return "bg-green-500";case "at-risk":return "bg-yellow-500";case "over-budget":return "bg-red-500";case "no-estimate":default:return "bg-gray-400"}}function Lb(e){switch(e){case "on-track":return "text-green-600 dark:text-green-400";case "at-risk":return "text-yellow-600 dark:text-yellow-400";case "over-budget":return "text-red-600 dark:text-red-400";case "no-estimate":default:return "text-gray-500 dark:text-gray-400"}}function vl({summary:e,showLabel:t=false,size:a="md",className:r}){let o=Ab(e.health),s=Lb(e.health),n={sm:"h-1",md:"h-1.5",lg:"h-2"},i=e.progressPercent??0,c=Math.min(100,i),l=i>100;return e.health==="no-estimate"?jsxs("div",{className:u("flex items-center gap-2",r),children:[jsx("div",{className:u("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",n[a]),children:jsx("div",{className:u("h-full w-1/4",o)})}),t&&jsx("span",{className:u("text-xs font-medium",s),children:"--"})]}):jsxs("div",{className:u("flex items-center gap-2",r),children:[jsxs("div",{className:u("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",n[a]),children:[jsx("div",{className:u("h-full transition-all duration-300",o),style:{width:`${c}%`}}),l&&jsx("div",{className:"absolute inset-0 bg-red-500",style:{backgroundImage:"repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(255,255,255,0.2) 2px, rgba(255,255,255,0.2) 4px)"}})]}),t&&jsxs("span",{className:u("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[i,"%"]})]})}function on(e){if(e<1)return `${Math.round(e*60)}s`;let t=Math.round(e);if(t<60)return `${t}m`;let a=Math.floor(t/60),r=t%60;return r===0?`${a}h`:`${a}h ${r}m`}function Bb(e,t){switch(e){case "profitable":return t?"text-green-400":"text-green-600";case "at-cost":return t?"text-blue-400":"text-blue-600";case "loss":return t?"text-red-400":"text-red-600";case "no-estimate":return t?"text-gray-500":"text-gray-400"}}function Rb(e,t){switch(e){case "profitable":return t?"bg-green-900/30 border-green-700/50":"bg-green-50 border-green-200";case "at-cost":return t?"bg-blue-900/30 border-blue-700/50":"bg-blue-50 border-blue-200";case "loss":return t?"bg-red-900/30 border-red-700/50":"bg-red-50 border-red-200";case "no-estimate":return t?"bg-gray-800/50 border-gray-700":"bg-gray-50 border-gray-200"}}function Ob(e,t){if(t==="es")switch(e){case "profitable":return "Rentable";case "at-cost":return "En costo";case "loss":return "P\xE9rdida";case "no-estimate":return "Sin oferta"}switch(e){case "profitable":return "Profitable";case "at-cost":return "At Cost";case "loss":return "Loss";case "no-estimate":return "No Estimate"}}function $b({summary:e,locale:t,isDark:a}){let r=e.totalVarianceMinutes>0,o=r?a?"text-green-400":"text-green-600":e.totalVarianceMinutes<0?a?"text-red-400":"text-red-600":a?"text-gray-400":"text-gray-600",s=a?"bg-[#1A1D25]":"bg-white",n=a?"border-white/5":"border-gray-200",i=a?"text-[#9CA3AF]":"text-gray-500",c=a?"text-[#E5E7EB]":"text-gray-900";return jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-6",children:[jsxs("div",{className:u("p-4 rounded-lg border",s,n),children:[jsx("div",{className:u("text-sm font-medium mb-1",i),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxs("div",{className:u("text-2xl font-bold",o),children:[r?"+":"",on(Math.abs(e.totalVarianceMinutes))]}),jsxs("div",{className:u("text-xs mt-1",i),children:[e.avgVariancePercent>0?"+":"",e.avgVariancePercent,"%"]})]}),jsxs("div",{className:u("p-4 rounded-lg border",s,n),children:[jsx("div",{className:u("text-sm font-medium mb-2",i),children:t==="es"?"Distribuci\xF3n":"Distribution"}),jsxs("div",{className:"space-y-1 text-sm",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-green-400":"text-green-600",children:t==="es"?"Rentables":"Profitable"}),jsx("span",{className:u("font-medium",c),children:e.profitableTasksCount})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-blue-400":"text-blue-600",children:t==="es"?"En costo":"At Cost"}),jsx("span",{className:u("font-medium",c),children:e.atCostTasksCount})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-red-400":"text-red-600",children:t==="es"?"P\xE9rdidas":"Loss"}),jsx("span",{className:u("font-medium",c),children:e.lossTasksCount})]})]})]}),jsxs("div",{className:u("p-4 rounded-lg border",s,n),children:[jsx("div",{className:u("text-sm font-medium mb-2",i),children:t==="es"?"Tiempos":"Time Summary"}),jsxs("div",{className:"space-y-1 text-sm",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:i,children:t==="es"?"Ofertado":"Sold"}),jsx("span",{className:u("font-medium",c),children:on(e.totalSoldMinutes)})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:i,children:t==="es"?"Trabajado":"Logged"}),jsx("span",{className:u("font-medium",c),children:on(e.totalLoggedMinutes)})]}),jsxs("div",{className:u("flex justify-between pt-1 border-t",n),children:[jsx("span",{className:i,children:t==="es"?"Tareas":"Tasks"}),jsx("span",{className:u("font-medium",c),children:e.totalTasksWithEstimate})]})]})]})]})}function Hb({task:e,locale:t,isDark:a,onClick:r}){let o=e.varianceMinutes!==null?e.varianceMinutes>0?"+":e.varianceMinutes<0?"-":"":"",s=a?"border-white/5":"border-gray-200",n=a?"text-[#E5E7EB]":"text-gray-900",i=a?"text-[#9CA3AF]":"text-gray-500";return jsxs("tr",{className:u("border-b",s,r&&u("cursor-pointer",a?"hover:bg-white/5":"hover:bg-gray-50")),onClick:()=>r?.(e.taskId),children:[jsxs("td",{className:"px-4 py-3",children:[jsx("div",{className:u("font-medium",n),children:e.taskName}),e.projectName&&jsx("div",{className:u("text-xs mt-1",i),children:e.projectName})]}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?on(e.soldEffortMinutes):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:on(e.loggedMinutes)}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.varianceMinutes!==null?jsxs("span",{className:u("font-medium",e.varianceMinutes>0?a?"text-green-400":"text-green-600":e.varianceMinutes<0?a?"text-red-400":"text-red-600":i),children:[o,on(Math.abs(e.varianceMinutes))]}):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.variancePercent!==null?jsxs("span",{className:u("font-medium",e.variancePercent>0?a?"text-green-400":"text-green-600":e.variancePercent<0?a?"text-red-400":"text-red-600":i),children:[o,Math.abs(e.variancePercent),"%"]}):"-"}),jsx("td",{className:"px-4 py-3 text-center",children:jsx("span",{className:u("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",Rb(e.status,a),Bb(e.status,a)),children:Ob(e.status,t)})})]})}function wl({report:e,isLoading:t=false,locale:a="en",theme:r="light",className:o,onTaskClick:s}){let n=r==="dark",i=n?"bg-[#050505]":"bg-gray-50",c=n?"bg-[#0A0A0A]":"bg-white",l=n?"border-white/[0.08]":"border-gray-200",p=n?"text-white/[0.92]":"text-gray-900",d=n?"text-white/[0.60]":"text-gray-500",m=n?"bg-[#050505]/50":"bg-gray-50",g=useMemo(()=>e?[...e.tasks].sort((b,h)=>b.varianceMinutes===null?1:h.varianceMinutes===null?-1:h.varianceMinutes-b.varianceMinutes):[],[e]);return t?jsx("div",{className:u("p-8 text-center",d,o),children:a==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsx("div",{className:u("p-8 text-center",d,o),children:a==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxs("div",{className:u("space-y-6 p-6",i,o),children:[jsx("div",{className:"flex items-center justify-between",children:jsxs("div",{children:[jsx("h2",{className:u("text-2xl font-bold",p),children:a==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsx("p",{className:u("text-sm mt-1",d),children:a==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsx($b,{summary:e.summary,locale:a,isDark:n}),jsx("div",{className:u("rounded-lg border overflow-hidden",c,l),children:jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-white/5",children:[jsx("thead",{className:m,children:jsxs("tr",{children:[jsx("th",{className:u("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Tarea":"Task"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Ofertado":"Sold"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Trabajado":"Logged"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Variaci\xF3n":"Variance"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:"%"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Estado":"Status"})]})}),jsx("tbody",{className:u("divide-y",l),children:g.map(b=>jsx(Hb,{task:b,locale:a,isDark:n,onClick:s},b.taskId))})]})})}),jsx("div",{className:u("text-xs text-center",d),children:a==="es"?jsx(Fragment,{children:"Rentable: variaci\xF3n > +5% | En costo: \xB15% | P\xE9rdida: variaci\xF3n < -5%"}):jsx(Fragment,{children:"Profitable: variance > +5% | At cost: \xB15% | Loss: variance < -5%"})})]})}function nn(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function Zb(e){let t=Math.floor(e/3600),a=Math.floor(e%3600/60),r=e%60;return t>0?`${t.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`:`${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`}function _u(e,t=[]){if("title"in e&&!("name"in e)){let a=e,r=(a.assignedUserIds||[]).map(o=>{let s=t.find(n=>n.id===o);return s||null}).filter(o=>o!==null);return {id:a.id,name:a.title,startDate:a.startDate?new Date(a.startDate):void 0,endDate:a.endDate?new Date(a.endDate):void 0,progress:a.progress||0,status:a.columnId,priority:a.priority?.toLowerCase(),assignees:r,dependencies:Array.isArray(a.dependencies)?a.dependencies.map(o=>typeof o=="string"?o:o.taskId):[],tags:a.tags,subtasks:a.subtasks?.map(o=>({id:o.id,name:o.title,progress:o.completed?100:0,startDate:new Date,endDate:new Date})),color:a.color,description:a.description,effortMinutes:a.effortMinutes,timeLoggedMinutes:a.timeLoggedMinutes,soldEffortMinutes:a.soldEffortMinutes}}return e}function eh(e,t){return {...t,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,priority:e.priority?.toUpperCase(),tags:e.tags,description:e.description,color:e.color,columnId:e.status,assignedUserIds:t.assignedUserIds,dependencies:e.dependencies}}function qr({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:i=[],availableTags:c=[],onCreateTag:l,attachments:p=[],onUploadAttachments:d,onDeleteAttachment:m,availableTasks:g=[],comments:b=[],onAddComment:h,currentUser:v,mentionableUsers:f=[],onUploadCommentAttachments:y,enableTimeTracking:w=false,timeTrackingSummary:x,timeEntries:C=[],isTimerRunning:k=false,timerElapsedSeconds:D=0,onTimeLog:T,onEstimateUpdate:I,onSoldEffortUpdate:$,onTimerStart:A,onTimerStop:_,onTimerDiscard:E,blurFinancials:me=false}){let L=s==="dark",X$1={textTertiary:L?"#6B7280":"#9CA3AF",textSecondary:L?"#9CA3AF":"#6B7280",textPrimary:L?"#FFFFFF":"#111827",borderLight:L?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:L?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:L?"#1A1D25":"#FFFFFF",bgSecondary:L?"#0A0A0A":"#F9FAFB",hoverBg:L?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},Z=e&&"title"in e&&!("name"in e),He=e,[O,j]=useState(e?_u(e,i):null),[he,je]=useState(false),[U,re]=useState(false),[ee,Ee]=useState(false),[we,Be]=useState(null),[ze,Qe]=useState(new Date),[te,tt]=useState(false),[pe,at]=useState(false),[pt,Et]=useState(""),[Ce,rt]=useState(false),[it,Ze]=useState(false),[H,de]=useState(false),[N,Y]=useState(false),[ie,ke]=useState(""),V=useRef(null),ae=useRef(null),[Ve,De]=useState(""),Ue=useRef(null),[Ne,Ke]=useState(""),[bt,lt]=useState(false),[nt,et]=useState([]),[At,Mt]=useState(""),[mt,yt]=useState(false),gt=useRef(null);useEffect(()=>{if(console.log("\u{1F4E5} TaskDetailModal useEffect - task received:",{isOpen:t,taskId:e?.id,taskName:e?.name,soldEffortMinutes:e?.soldEffortMinutes,quotedMinutes:e?.quotedMinutes,effortMinutes:e?.effortMinutes,timeLoggedMinutes:e?.timeLoggedMinutes,fullTask:e}),e&&t){let S=_u(e,i);console.log("\u{1F4E5} After normalizeToTask:",{taskId:S?.id,taskName:S?.name,soldEffortMinutes:S?.soldEffortMinutes,quotedMinutes:S?.quotedMinutes,effortMinutes:S?.effortMinutes,timeLoggedMinutes:S?.timeLoggedMinutes}),j(S),ke(S.description||""),De(S.name||"");}},[e?.id,e?.quotedMinutes,i,t]),useEffect(()=>{if(!t||!ie)return;let S=setTimeout(()=>{let oe=ae.current;oe&&(oe.style.height="auto",oe.style.height=`${Math.max(100,oe.scrollHeight)}px`);},50);return ()=>clearTimeout(S)},[t,ie]),useEffect(()=>()=>{V.current&&clearTimeout(V.current),Ue.current&&clearTimeout(Ue.current);},[]),useEffect(()=>{t&>.current&&b.length>0&&setTimeout(()=>{gt.current&&(gt.current.scrollTop=gt.current.scrollHeight);},100);},[t,b.length]);let Pt=useCallback(S=>{j(S),Z&&o&&He?o(eh(S,He)):r&&r(S);},[Z,He,o,r]),Ge=useCallback(()=>{je(false),re(false),Ee(false),Be(null),at(false),Et(""),rt(false);},[]),Re=useCallback((S,oe)=>{if(!O)return;let Te={...O,[S]:oe};Pt(Te);},[O,Pt]),ut=useCallback(()=>{let S=ae.current;S&&(S.style.height="auto",S.style.height=`${Math.max(100,S.scrollHeight)}px`);},[]),le=useCallback(S=>{ke(S),setTimeout(ut,0),V.current&&clearTimeout(V.current),V.current=setTimeout(()=>{if(O){let oe={...O,description:S};Pt(oe);}},800);},[O,Pt,ut]),fe=useCallback(S=>{De(S),Ue.current&&clearTimeout(Ue.current),Ue.current=setTimeout(()=>{if(O&&S.trim()){let oe={...O,name:S.trim()};Pt(oe);}},800);},[O,Pt]),P=useCallback(S=>{let oe=S.map(Te=>{let We={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:Te};return Te.type.startsWith("image/")&&(We.preview=URL.createObjectURL(Te)),We});et(Te=>[...Te,...oe]);},[]),K=useCallback(S=>{et(oe=>{let Te=oe.find(We=>We.id===S);return Te?.preview&&URL.revokeObjectURL(Te.preview),oe.filter(We=>We.id!==S)});},[]),q=useCallback(async()=>{if(!(!O||!Ne.trim()&&nt.length===0||!h)){lt(true);try{let S=Su(Ne,f),oe=[];if(nt.length>0&&y){let Te=nt.map(We=>We.file);oe=await y(Te);}await h(O.id,Ne.trim(),S.length>0?S:void 0,oe.length>0?oe:void 0),Ke(""),nt.forEach(Te=>{Te.preview&&URL.revokeObjectURL(Te.preview);}),et([]);}finally{lt(false);}}},[O,Ne,nt,h,f,y]),ce=useCallback(()=>{if(!O||!At.trim())return;let S=O.subtasks||[],oe={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:At.trim(),progress:0,startDate:new Date,endDate:new Date,position:S.length},Te=[...S,oe],We={...O,subtasks:Te};Pt(We),Mt(""),yt(false);},[O,At,Pt]),Se=useCallback(S=>{if(!O?.subtasks)return;let oe=O.subtasks.map(We=>We.id===S?{...We,progress:We.progress===100?0:100}:We),Te={...O,subtasks:oe};Pt(Te);},[O,Pt]),Xe=useCallback(S=>{if(!O?.subtasks)return;let oe=O.subtasks.filter(We=>We.id!==S),Te={...O,subtasks:oe};Pt(Te);},[O,Pt]),_e=useCallback(S=>{let oe=typeof S=="string"?new Date(S):S,We=new Date().getTime()-oe.getTime(),Tt=Math.floor(We/6e4),Nt=Math.floor(We/36e5),la=Math.floor(We/864e5);return Tt<1?n==="es"?"Ahora":"Just now":Tt<60?n==="es"?`Hace ${Tt} min`:`${Tt}m ago`:Nt<24?n==="es"?`Hace ${Nt}h`:`${Nt}h ago`:la<7?n==="es"?`Hace ${la}d`:`${la}d ago`:oe.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),Ie=useCallback(S=>{if(!O)return;let oe=O.progress||0;S==="completed"?oe=100:S==="in-progress"&&oe===0?oe=10:S==="todo"&&(oe=0);let Te={...O,status:S,progress:oe};Pt(Te),je(false);},[O,Pt]),M=useCallback((S,oe)=>{if(!O)return;let Te={...O,startDate:S,endDate:oe};Pt(Te);},[O,Pt]),J=useCallback(()=>{let S=ze.getFullYear(),oe=ze.getMonth(),Te=new Date(S,oe,1),Tt=new Date(S,oe+1,0).getDate(),Nt=Te.getDay(),la=[],aa=new Date(S,oe,0).getDate();for(let Ut=Nt-1;Ut>=0;Ut--)la.push({date:new Date(S,oe-1,aa-Ut),isCurrentMonth:false});for(let Ut=1;Ut<=Tt;Ut++)la.push({date:new Date(S,oe,Ut),isCurrentMonth:true});let ya=42-la.length;for(let Ut=1;Ut<=ya;Ut++)la.push({date:new Date(S,oe+1,Ut),isCurrentMonth:false});return la},[ze]),ye=useCallback(async S=>{if(S.preventDefault(),S.stopPropagation(),de(false),!O||!d)return;let oe=Array.from(S.dataTransfer.files);if(oe.length!==0){Y(true);try{await d(O.id,oe);}finally{Y(false);}}},[O,d]),Le=useCallback(async S=>{if(!O||!d||!S.target.files)return;let oe=Array.from(S.target.files);if(oe.length!==0){Y(true);try{await d(O.id,oe);}finally{Y(false);}S.target.value="";}},[O,d]),Oe=useCallback(S=>{S.preventDefault(),S.stopPropagation(),de(true);},[]),B=useCallback(S=>{S.preventDefault(),S.stopPropagation(),de(false);},[]),z=useCallback(S=>S<1024?`${S} B`:S<1024*1024?`${(S/1024).toFixed(1)} KB`:`${(S/(1024*1024)).toFixed(1)} MB`,[]),ne=useCallback(S=>S.startsWith("image/")?Image:S.includes("pdf")||S.includes("document")?FileText:File,[]);return !t||!O?null:jsx(AnimatePresence,{children:t&&O&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:a,className:"fixed inset-0 bg-black/50 z-40"}),jsxs(motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:u("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",L?"bg-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxs("div",{className:u("px-6 py-3 border-b flex items-center gap-3 h-[49px]",L?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Circle,{className:u("w-4 h-4",L?"text-[#9CA3AF]":"text-gray-500")}),jsxs("span",{className:u("text-xs px-2 py-0.5 rounded",L?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsx("span",{className:u("text-xs font-mono",L?"text-[#6B7280]":"text-gray-400"),children:O.id.slice(0,8)})]}),jsx("div",{className:"flex-1"})]}),jsx("div",{className:"px-6 py-4",children:jsxs("div",{className:"flex items-start gap-3",children:[jsx("button",{onClick:()=>{let S=O.progress===100?0:100,Te={...O,progress:S,status:S===100?"completed":"todo"};Pt(Te);},className:u("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",O.progress===100?"bg-green-500 border-green-500":L?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:O.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("input",{type:"text",value:Ve,onChange:S=>fe(S.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:u("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",O.progress===100?"line-through text-[#6B7280]":L?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400")})]})}),jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CheckCircle2,{className:u("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsx("button",{onClick:()=>{Ge(),je(!he);},className:u("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",O.progress===100||O.status==="completed"?"bg-green-500/20 text-green-400":O.progress&&O.progress>0||O.status==="in-progress"?"bg-blue-500/20 text-blue-400":L?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:O.progress===100||O.status==="completed"?n==="es"?"COMPLETADO":"DONE":O.progress&&O.progress>0||O.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsx(AnimatePresence,{children:he&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>je(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label: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(S=>jsxs("button",{onClick:()=>Ie(S.id),className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",O.status===S.id&&(L?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:u("w-2 h-2 rounded-full",S.color)}),jsx("span",{className:L?"text-white":"text-gray-900",children:S.label})]},S.id))})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(User,{className:u("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxs("button",{onClick:()=>{Ge(),Ee(!ee);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[O.assignees&&O.assignees.length>0?jsxs("div",{className:"flex items-center gap-1",children:[O.assignees.slice(0,3).map((S,oe)=>jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:S.color||"#8B5CF6"},title:S.name,children:S.initials||S.name.slice(0,2).toUpperCase()},oe)),O.assignees.length>3&&jsxs("span",{className:u("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:["+",O.assignees.length-3]})]}):jsx("span",{className:u("text-sm",L?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsx(ChevronDown,{className:u("w-3 h-3",L?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:ee&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ee(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:i.length>0?i.map(S=>{let oe=O.assignees?.some(Te=>Te.name===S.name);return jsxs("button",{onClick:()=>{let Te=O.assignees||[],We;oe?We=Te.filter(Tt=>Tt.name!==S.name):We=[...Te,S],Re("assignees",We);},className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",oe&&(L?"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:S.color||"#8B5CF6"},children:S.initials||S.name.slice(0,2).toUpperCase()}),jsx("span",{className:u("flex-1",L?"text-white":"text-gray-900"),children:S.name}),oe&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},S.name)}):jsx("div",{className:u("px-3 py-4 text-sm text-center",L?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CalendarDays,{className:u("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxs("button",{onClick:()=>{Be(we?null:"start"),Qe(O.startDate||new Date);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[O.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsx("span",{className:u("mx-1",L?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),O.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsx(AnimatePresence,{children:we&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Be(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:u("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:S=>S.stopPropagation(),children:[jsxs("div",{className:u("w-44 py-2 border-r",L?"border-white/10":"border-gray-200"),children:[(()=>{let S=new Date,oe=new Date(S);oe.setDate(S.getDate()+1);let Te=new Date(S);Te.setDate(S.getDate()+((6-S.getDay()+7)%7||7));let We=new Date(S);We.setDate(S.getDate()+((1-S.getDay()+7)%7||7));let Tt=new Date(S);Tt.setDate(S.getDate()+(6-S.getDay()+7)%7+7);let Nt=new Date(S);Nt.setDate(S.getDate()+14);let la=new Date(S);return la.setDate(S.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:S,display:S.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:oe,display:oe.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:Te,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:We,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:Tt,display:Tt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:Nt,display:Nt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:la,display:la.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((ya,Ut)=>jsxs("button",{className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",L?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(we==="start"){let ua=O.endDate&&ya.date>O.endDate?ya.date:O.endDate;M(ya.date,ua),Be("end");}else {let ua=O.startDate&&ya.date<O.startDate?ya.date:O.startDate;M(ua,ya.date),Be(null);}},children:[jsx("span",{children:ya.label}),jsx("span",{className:u("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:ya.display})]},Ut))})(),jsx("div",{className:u("border-t mt-2 pt-2",L?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{M(void 0,void 0),Be(null);},className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",L?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:n==="es"?"Quitar fechas":"Clear dates"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[jsx("div",{className:u("text-xs mb-3 px-2 py-1 rounded",L?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:we==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("span",{className:u("font-medium",L?"text-white":"text-gray-900"),children:ze.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>Qe(new Date),className:u("p-1 rounded text-sm transition-colors",L?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>Qe(new Date(ze.getFullYear(),ze.getMonth()-1)),className:u("p-1 rounded",L?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),jsx("button",{onClick:()=>Qe(new Date(ze.getFullYear(),ze.getMonth()+1)),className:u("p-1 rounded",L?"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(S=>jsx("div",{className:u("w-8 h-8 flex items-center justify-center text-xs",L?"text-[#6B7280]":"text-gray-400"),children:S},S))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:J().map((S,oe)=>{let Te=S.date.toDateString()===new Date().toDateString(),We=O.startDate?.toDateString()===S.date.toDateString(),Tt=O.endDate?.toDateString()===S.date.toDateString(),Nt=We||Tt,la=O.startDate&&O.endDate&&S.date>=O.startDate&&S.date<=O.endDate;return jsx("button",{onClick:()=>{let aa=new Date(S.date);if(we==="start"){let ya=O.endDate&&aa>O.endDate?aa:O.endDate;M(aa,ya),Be("end");}else {let ya=O.startDate&&aa<O.startDate?aa:O.startDate;M(ya,aa),Be(null);}},className:u("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!S.isCurrentMonth&&(L?"text-[#4B5563]":"text-gray-300"),S.isCurrentMonth&&(L?"text-white":"text-gray-900"),Te&&"ring-2 ring-[#2E94FF]",We&&"bg-[#2E94FF] text-white",Tt&&!We&&"bg-[#7C3AED] text-white",la&&!Nt&&(L?"bg-[#7C3AED]/20":"bg-purple-100"),!Nt&&(L?"hover:bg-white/10":"hover:bg-gray-100")),children:S.date.getDate()},oe)})})]})]})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Flag,{className:u("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsx("button",{onClick:()=>{Ge(),re(!U);},className:u("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",O.priority==="high"||O.priority==="urgent"?"bg-red-500/20 text-red-400":O.priority==="medium"?"bg-yellow-500/20 text-yellow-400":O.priority==="low"?"bg-green-500/20 text-green-400":L?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:O.priority?O.priority==="high"||O.priority==="urgent"?n==="es"?"Alta":"High":O.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsx(AnimatePresence,{children:U&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>re(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label: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(S=>jsxs("button",{onClick:()=>{Re("priority",S.id),re(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",O.priority===S.id&&(L?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:u("w-2 h-2 rounded-full",S.color)}),jsx("span",{className:L?"text-white":"text-gray-900",children:S.label})]},S.id||"none"))})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:u("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsx("span",{className:u("text-sm",L?"text-white":"text-gray-900"),children:O.startDate&&O.endDate?`${Math.ceil((O.endDate.getTime()-O.startDate.getTime())/(1e3*60*60*24))} ${n==="es"?"d\xEDas":"days"}`:n==="es"?"Sin definir":"Not set"})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:u("w-4 h-4 rounded-full border-2",L?"border-[#6B7280]":"border-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[te?jsx("input",{type:"range",min:"0",max:"100",step:"5",value:O.progress||0,onChange:S=>{let oe=parseInt(S.target.value),Te=O.status;oe===100?Te="completed":oe>0?Te="in-progress":Te="todo";let We={...O,progress:oe,status:Te};Pt(We);},onBlur:()=>tt(false),className:u("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",L?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#2E94FF] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsx("button",{onClick:()=>tt(true),className:u("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",L?"bg-white/10":"bg-gray-200"),children:jsx("div",{className:u("h-full rounded-full transition-all",O.progress===100?"bg-green-500":"bg-[#2E94FF]"),style:{width:`${O.progress||0}%`}})}),jsxs("span",{className:u("text-sm font-medium min-w-[40px]",L?"text-white":"text-gray-900"),children:[O.progress||0,"%"]})]})]}),w&&jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Hourglass,{className:u("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n estimada":"Estimated duration"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:O.status==="completed"||O.progress===100?jsx("span",{className:u("text-sm px-2 py-0.5 cursor-not-allowed",L?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:x?.estimateMinutes?nn(x.estimateMinutes):n==="es"?"Vac\xEDo":"Empty"}):x?.estimateMinutes?jsx("button",{type:"button",onClick:()=>Ze("estimate"),className:u("text-sm px-2 py-0.5 rounded",L?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:nn(x.estimateMinutes)}):jsx("button",{type:"button",onClick:()=>Ze("estimate"),className:u("text-sm",L?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:it==="estimate"&&jsx(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsx($r,{mode:"estimate",locale:n,isDark:L,currentValue:x?.estimateMinutes||null,onSave:async S=>{await I?.(O.id,S),Ze(false);},onClose:()=>Ze(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(FileText,{className:u("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Tiempo ofertado":"Quoted time"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:me?jsx("span",{className:u("text-sm select-none blur-[4px] opacity-60 pointer-events-none",L?"text-[#94A3B8]":"text-gray-500"),title:n==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data","aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"}):O.status==="completed"||O.progress===100?jsx("span",{className:u("text-sm px-2 py-0.5 cursor-not-allowed",L?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:O.quotedMinutes?nn(O.quotedMinutes):n==="es"?"Vac\xEDo":"Empty"}):O.quotedMinutes?jsx("button",{type:"button",onClick:()=>Ze("quoted"),className:u("text-sm px-2 py-0.5 rounded",L?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:nn(O.quotedMinutes)}):jsx("button",{type:"button",onClick:()=>Ze("quoted"),className:u("text-sm",L?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:it==="quoted"&&!me&&jsx(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsx($r,{mode:"quoted",locale:n,isDark:L,currentValue:O.quotedMinutes||null,onSave:async S=>{$?(await $(O.id,S),j(oe=>oe?{...oe,quotedMinutes:S}:null)):Re("quotedMinutes",S),Ze(false);},onClose:()=>Ze(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Clock,{className:u("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Registrar tiempo":"Track time"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[O.status==="completed"||O.progress===100?jsx("div",{className:u("flex items-center gap-1.5 p-1.5 rounded-full cursor-not-allowed",L?"bg-white/5 text-gray-600":"bg-gray-50 text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:jsx(Play,{className:"w-3.5 h-3.5 fill-current"})}):k?jsxs("button",{type:"button",onClick:()=>_?.(O.id),className:u("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors","bg-red-500/10 text-red-500 hover:bg-red-500/20"),children:[jsx(Square,{className:"w-3.5 h-3.5 fill-current"}),Zb(D||0)]}):jsx("button",{type:"button",onClick:()=>A?.(O.id),className:u("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",L?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),title:n==="es"?"Iniciar temporizador":"Start timer",children:jsx(Play,{className:"w-3.5 h-3.5 fill-current"})}),O.status==="completed"||O.progress===100?jsxs("div",{className:u("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",L?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:[jsx(Plus,{className:"w-3.5 h-3.5"}),n==="es"?"Agregar tiempo":"Add time"]}):jsxs("button",{type:"button",onClick:()=>Ze("log"),className:u("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors",L?"text-[#9CA3AF] hover:bg-white/10 hover:text-white":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),children:[jsx(Plus,{className:"w-3.5 h-3.5"}),n==="es"?"Agregar tiempo":"Add time"]}),x&&x.loggedMinutes>0&&jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:u("text-sm font-medium",x.health==="over-budget"?"text-red-500":x.health==="at-risk"?"text-yellow-500":L?"text-white":"text-gray-900"),children:[nn(x.loggedMinutes),x.estimateMinutes&&jsxs("span",{className:u("font-normal",L?"text-[#6B7280]":"text-gray-400"),children:[" / ",nn(x.estimateMinutes)]})]}),x.health!=="no-estimate"&&jsx("div",{className:"w-16 h-1.5 rounded-full overflow-hidden bg-gray-200 dark:bg-gray-700",children:jsx("div",{className:u("h-full rounded-full transition-all",x.health==="over-budget"?"bg-red-500":x.health==="at-risk"?"bg-yellow-500":"bg-green-500"),style:{width:`${Math.min(100,x.progressPercent||0)}%`}})})]})]}),jsx(AnimatePresence,{children:it==="log"&&jsx(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsx($r,{mode:"log",locale:n,isDark:L,currentValue:null,onSave:async(S,oe)=>{S&&await T?.(O.id,{durationMinutes:S,note:oe,source:"manual"}),Ze(false);},onClose:()=>Ze(false)})})})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Tag,{className:u("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsx(lo,{selectedTags:O.tags||[],availableTags:c,onChange:S=>{Re("tags",S);},onCreateTag:l,theme:X$1})]}),jsxs("div",{className:"flex items-start gap-3 relative",children:[jsx(Link2,{className:u("w-4 h-4 mt-1.5",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0 mt-1",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxs("div",{className:"flex-1",children:[O.dependencies&&O.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:O.dependencies.map(S=>{let oe=g.find(Te=>Te.id===S);return jsxs("span",{className:u("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",L?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[oe?.name||S.slice(0,8),jsx("button",{onClick:()=>{let Te=(O.dependencies||[]).filter(We=>We!==S);Re("dependencies",Te);},className:u("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsx(X,{className:"w-3 h-3"})})]},S)})}),jsxs("button",{onClick:()=>{Ge(),at(!pe);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{className:u("text-sm",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsx(AnimatePresence,{children:pe&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{at(false),Et("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsx("div",{className:u("p-2 border-b",L?"border-white/10":"border-gray-200"),children:jsx("input",{type:"text",value:pt,onChange:S=>Et(S.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:u("w-full px-3 py-2 rounded-md text-sm outline-none",L?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsx("div",{className:"max-h-[240px] overflow-y-auto",children:g.length>0?g.filter(S=>S.id!==O.id).filter(S=>pt===""||S.name.toLowerCase().includes(pt.toLowerCase())).map(S=>{let oe=O.dependencies?.includes(S.id);return jsxs("button",{onClick:()=>{let Te=O.dependencies||[],We;oe?We=Te.filter(Tt=>Tt!==S.id):We=[...Te,S.id],Re("dependencies",We);},className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",oe&&(L?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:u("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",oe?"bg-blue-500 border-blue-500":L?"border-white/30":"border-gray-300"),children:oe&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:u("block truncate",L?"text-white":"text-gray-900"),children:S.name}),jsx("span",{className:u("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:S.id.slice(0,8)})]})]},S.id)}):jsx("div",{className:u("px-3 py-4 text-sm text-center",L?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Palette,{className:u("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxs("button",{onClick:()=>{Ge(),rt(!Ce);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:O.color||"#6366F1"}}),jsx("span",{className:u("text-sm",L?"text-white":"text-gray-900"),children:Lo.find(S=>S.value===O.color)?.name||(n==="es"?"Azul":"Blue")}),jsx(ChevronDown,{className:u("w-3 h-3",L?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:Ce&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>rt(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-6 gap-1.5",children:Lo.map(S=>{let oe=O.color===S.value;return jsx("button",{onClick:()=>{Re("color",S.value),rt(false);},className:u("w-7 h-7 rounded-full flex items-center justify-center transition-all",oe&&"ring-2 ring-offset-2",L?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:S.value,outlineColor:oe?S.value:void 0},title:S.name,children:oe&&jsx(Check,{className:"w-3.5 h-3.5 text-white"})},S.value)})})})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Diamond,{className:u("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",L?"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:O.isMilestone||false,onChange:S=>Re("isMilestone",S.target.checked),className:u("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",O.isMilestone?"bg-purple-500 border-purple-500":L?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsx("span",{className:u("text-sm",L?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxs("div",{className:u("mt-6 pt-4 border-t",L?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsx(FileText,{className:u("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("h3",{className:u("text-sm font-semibold",L?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsx("textarea",{ref:ae,value:ie,onChange:S=>le(S.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:u("w-full min-h-[100px] max-h-[400px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors overflow-y-auto",L?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")})]}),jsxs("div",{className:u("mt-6 pt-4 border-t",L?"border-white/10":"border-gray-200"),children:[jsx("div",{className:"flex items-center justify-between mb-3",children:jsxs("h3",{className:u("text-sm font-semibold",L?"text-white":"text-gray-900"),children:[n==="es"?"Subtareas":"Subtasks",O.subtasks&&O.subtasks.length>0&&jsxs("span",{className:u("ml-2 text-xs font-normal",L?"text-[#6B7280]":"text-gray-400"),children:["(",O.subtasks.filter(S=>S.progress===100).length,"/",O.subtasks.length,")"]})]})}),O.subtasks&&O.subtasks.length>0&&jsx("div",{className:"space-y-2 mb-3",children:[...O.subtasks].sort((S,oe)=>(S.position??0)-(oe.position??0)).map(S=>jsxs("div",{className:u("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",L?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx("button",{onClick:()=>Se(S.id),className:u("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",S.progress===100?"bg-green-500 border-green-500":L?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:S.progress===100&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:u("text-sm flex-1",S.progress===100?"line-through text-[#6B7280]":L?"text-white":"text-gray-900"),children:S.name}),jsx("button",{onClick:()=>Xe(S.id),className:u("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",L?"hover:bg-white/10 text-[#6B7280] hover:text-red-400":"hover:bg-gray-100 text-gray-400 hover:text-red-500"),children:jsx(Trash2,{className:"w-3.5 h-3.5"})})]},S.id))}),mt?jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:At,onChange:S=>Mt(S.target.value),onKeyDown:S=>{S.key==="Enter"&&At.trim()?ce():S.key==="Escape"&&(yt(false),Mt(""));},placeholder:n==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:u("flex-1 px-3 py-2 rounded-lg text-sm outline-none transition-colors",L?"bg-white/5 border border-white/10 text-white placeholder:text-[#6B7280] focus:border-blue-500/50":"bg-gray-50 border border-gray-200 text-gray-900 placeholder:text-gray-400 focus:border-blue-500")}),jsx("button",{onClick:ce,disabled:!At.trim(),className:u("px-3 py-2 rounded-lg text-sm font-medium transition-colors",At.trim()?"bg-blue-500 hover:bg-blue-600 text-white":L?"bg-white/5 text-[#6B7280] cursor-not-allowed":"bg-gray-100 text-gray-400 cursor-not-allowed"),children:n==="es"?"Agregar":"Add"}),jsx("button",{onClick:()=>{yt(false),Mt("");},className:u("p-2 rounded-lg transition-colors",L?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:()=>yt(true),className:u("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsx(Plus,{className:"w-4 h-4"}),n==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxs("div",{className:u("mt-6 pt-4 border-t",L?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:u("text-sm font-semibold mb-3",L?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",p.length>0&&jsxs("span",{className:u("ml-2 text-xs font-normal",L?"text-[#6B7280]":"text-gray-400"),children:["(",p.length,")"]})]}),p.length>0&&jsx("div",{className:"space-y-2 mb-4",children:p.map(S=>{let oe=ne(S.type),Te=S.type.startsWith("image/");return jsxs("div",{className:u("flex items-center gap-3 p-2 rounded-lg group transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[Te&&S.thumbnailUrl?jsx("img",{src:S.thumbnailUrl,alt:S.name,className:"w-10 h-10 rounded object-cover"}):jsx("div",{className:u("w-10 h-10 rounded flex items-center justify-center",L?"bg-white/10":"bg-gray-200"),children:jsx(oe,{className:u("w-5 h-5",L?"text-[#9CA3AF]":"text-gray-500")})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("a",{href:S.url,target:"_blank",rel:"noopener noreferrer",className:u("text-sm font-medium truncate block hover:underline",L?"text-white":"text-gray-900"),children:S.name}),jsx("p",{className:u("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:z(S.size)})]}),m&&jsx("button",{onClick:()=>m(S.id),className:u("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",L?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:n==="es"?"Eliminar":"Delete",children:jsx(Trash2,{className:"w-4 h-4"})})]},S.id)})}),jsxs("div",{onDragOver:Oe,onDragLeave:B,onDrop:ye,className:u("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",H?L?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":L?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",N&&"pointer-events-none opacity-50"),children:[jsx("input",{type:"file",multiple:true,onChange:Le,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!d||N}),N?jsxs(Fragment,{children:[jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),jsx("p",{className:u("text-sm",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxs(Fragment,{children:[jsx(Upload,{className:u("w-6 h-6 mx-auto mb-2",H?"text-blue-500":L?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:u("text-sm",L?"text-[#9CA3AF]":"text-gray-500"),children:H?n==="es"?"Suelta los archivos aqu\xED":"Drop files here":n==="es"?jsxs(Fragment,{children:["Suelta tus archivos aqu\xED o ",jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxs(Fragment,{children:["Drop your files here or ",jsx("span",{className:"underline",children:"click to upload"})]})}),!d&&jsx("p",{className:u("text-xs mt-1",L?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxs("div",{className:u("w-96 border-l flex flex-col",L?"border-white/[0.08] bg-[#0A0A0A]":"border-gray-200 bg-gray-50"),children:[jsxs("div",{className:u("px-4 py-3 border-b flex items-center justify-between h-[49px]",L?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:u("text-sm font-semibold",L?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",b.length>0&&jsxs("span",{className:u("ml-2 text-xs font-normal",L?"text-[#6B7280]":"text-gray-400"),children:["(",b.length,")"]})]}),jsx("button",{onClick:a,className:u("p-1.5 rounded transition-colors",L?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-5 h-5"})})]}),jsx("style",{children:`
|
|
1
|
+
import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,selectionStore,BoardStore}from'@libxai/core';export{Board as BoardModel,BoardStore,Card as CardModel,Column as ColumnModel,DependencyEngine,Store}from'@libxai/core';import {createContext,memo,useRef,useState,forwardRef,useContext,useCallback,useEffect,useMemo,useImperativeHandle,useLayoutEffect,Component}from'react';import {useDroppable,useSensors,useSensor,PointerSensor,KeyboardSensor,DndContext,closestCorners,DragOverlay}from'@dnd-kit/core';import {useSortable,SortableContext,verticalListSortingStrategy,sortableKeyboardCoordinates}from'@dnd-kit/sortable';import {useVirtualizer}from'@tanstack/react-virtual';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {jsPDF}from'jspdf';import Nf from'html2canvas';import {createPortal}from'react-dom';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {AnimatePresence,motion}from'framer-motion';import {CheckCircle2,PlayCircle,Circle,Copy,Scissors,Settings,Eye,EyeOff,ArrowDown,ArrowUp,ArrowUpDown,BarChart3,Link2,Minus,Plus,Trash2,Pencil,Edit3,AlertTriangle,CheckSquare,ChevronDown,Calendar,Hash,Type,BarChart,Users,CalendarClock,FileText,Timer,Clock,Tag,CalendarCheck,Flag,CircleDot,Moon,Sun,Palette,Search,ZoomOut,ZoomIn,Keyboard,ChevronRight,Image,File,User,Check,CalendarDays,X,Hourglass,Play,Square,Diamond,Upload,MessageSquare,Layers,Filter,Zap,GitBranch,FileImage,FileSpreadsheet,FolderKanban,Share2,Download,ChevronLeft,GripVertical,Smile,Paperclip,Send,AlertCircle,Milestone,List,PanelRight,FolderOpen,Folder,FileJson,Target,DollarSign,Loader2}from'lucide-react';import {Command}from'cmdk';import _h from'react-markdown';import jh from'remark-gfm';import Kh from'rehype-sanitize';import {ResponsiveContainer,LineChart,CartesianGrid,XAxis,YAxis,Tooltip,Legend,Line,AreaChart,Area,PieChart,Pie,Cell,BarChart as BarChart$1,Bar}from'recharts';import {toPng}from'html-to-image';var Ns=(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 Ds=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 [Ds.Translate.toString(e),Ds.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function u(...e){return twMerge(clsx(e))}function Ss(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 vf(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function sl(e,t){return e.length===0?1e3:t===0?Ss(null,e[0].position):t>=e.length?Ss(e[e.length-1].position,null):Ss(e[t-1].position,e[t].position)}function Kc(e,t=100){return e>t}var wf=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 kf(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 Es(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:n=wf,onRetry:i}=t,c,l=0;for(let p=1;p<=a;p++){l=p;try{return {data:await e(),attempts:l,success:!0}}catch(d){if(c=d,p===a||!n(c,p))return {error:c,attempts:l,success:false};let g=kf(p,r,o,s);if(i)try{i(c,p,g);}catch(b){console.error("Error in retry callback:",b);}await new Promise(b=>setTimeout(b,g));}}return {error:c||new Error("Unknown error"),attempts:l,success:false}}function Cf(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 Tf(e,t={}){return async(...a)=>Es(()=>e(...a),t)}var il=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 Yc=(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))(Yc||{}),Eo=class Eo{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...n}=t,i=`[${a}] [${r}] [${s}]`,c=Object.keys(n).length>0;switch(r){case "DEBUG":console.debug(i,o,c?n:"");break;case "INFO":console.info(i,o,c?n:"");break;case "WARN":console.warn(i,o,c?n:"");break;case "ERROR":console.error(i,o,c?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 Fs((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new Fs(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:Yc[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};Eo.globalOptions={};var ll=Eo,Fs=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}},qc=new ll;function Df(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 Sf(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(i=>i.id===s.columnId);return [s.id,dl(s.title),dl(s.description||""),dl(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 Ef(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 Nf(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),i=n.toDataURL("image/png"),c=297,l=210,p=n.width/n.height,d=c-20,m=d/p;m>l-20&&(m=l-20,d=m*p);let g=new jsPDF({orientation:"landscape",unit:"mm",format:"a4"});g.setFontSize(16),g.setTextColor(255,255,255),g.setFillColor(10,10,10),g.rect(0,0,c,15,"F"),g.text(e.title||"Kanban Board",10,10);let b=(c-d)/2;return g.addImage(i,"PNG",b,20,d,m),g}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 i=e.cards.filter(c=>c.columnId===n.id);s>250&&(o.addPage(),s=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(n.title,20,s),s+=8,i.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):i.forEach(c=>{if(s>260&&(o.addPage(),s=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(c.title,25,s),s+=6,c.description){o.setFontSize(9),o.setFont("helvetica","normal");let p=o.splitTextToSize(c.description,160);o.text(p,25,s),s+=p.length*5;}let l=[];if(c.priority&&l.push(`Priority: ${c.priority}`),c.labels&&c.labels.length>0&&l.push(`Labels: ${c.labels.join(", ")}`),c.assignedUserIds&&c.assignedUserIds.length>0&&l.push(`Assigned: ${c.assignedUserIds.length} user(s)`),c.startDate||c.endDate){let p=[];c.startDate&&p.push(`Start: ${c.startDate}`),c.endDate&&p.push(`End: ${c.endDate}`),l.push(p.join(" \u2192 "));}l.length>0&&(o.setFontSize(8),o.setTextColor(100,100,100),o.text(l.join(" \u2022 "),25,s),o.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),o}function dl(e){return e.includes(",")||e.includes('"')||e.includes(`
|
|
3
|
+
`)?`"${e.replace(/"/g,'""')}"`:e}async function Jc(e,t,a,r){switch(t){case "json":return Df(e,r);case "csv":return Sf(e);case "pdf":return await Ef(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function Qc(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"},i=new Blob([e],{type:n[t]}),c=URL.createObjectURL(i),l=document.createElement("a");l.href=c,l.download=s,document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(c);}function Ff(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 Mf(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=Zc(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let i=Zc(t[n]||"");if(i.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-i.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${i.length})`);continue}for(;i.length<a.length;)i.push("");let l={};a.forEach((g,b)=>{l[g]=i[b]||"";});let p=l.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),m={id:l["Card ID"]||`card-${n}`,title:l.Title||"Untitled",description:l.Description?l.Description:void 0,columnId:d.id,position:d.cardIds.length+1,priority:l.Priority||void 0,labels:l.Labels?l.Labels.split(";").filter(Boolean):void 0,assignedUserIds:l["Assigned Users"]?l["Assigned Users"].split(";").filter(Boolean):void 0,startDate:l["Start Date"]?l["Start Date"]:void 0,endDate:l["End Date"]?l["End Date"]:void 0,createdAt:l["Created At"]?l["Created At"]:void 0,updatedAt:l["Updated At"]?l["Updated At"]:void 0};r.push(m),d.cardIds.push(m.id);}catch(i){s.push(`Line ${n+1}: ${i instanceof Error?i.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 Zc(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 eu(e,t){switch(t){case "json":return Ff(e);case "csv":return Mf(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function tu(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 cl=createContext(null);function au(){return useContext(cl)}var ru=createContext(null);function ou({children:e,themeName:t}){return jsx(ru.Provider,{value:{themeName:t},children:e})}function en(){return useContext(ru)}function Ht({children:e,container:t}){let[a,r]=useState(false),o=au(),s=en();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:i,themeName:c}=o,l={"--asakaa-color-background-primary":i.bgPrimary,"--asakaa-color-background-secondary":i.bgSecondary,"--asakaa-color-background-card":i.bgGrid,"--asakaa-color-background-hover":i.hoverBg,"--asakaa-color-text-primary":i.textPrimary,"--asakaa-color-text-secondary":i.textSecondary,"--asakaa-color-text-tertiary":i.textTertiary,"--asakaa-color-text-inverse":i.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":i.border,"--asakaa-color-border-hover":i.borderLight,"--asakaa-color-border-subtle":i.borderLight,"--asakaa-color-interactive-primary":i.accent,"--asakaa-color-interactive-primaryHover":i.accentHover,"--asakaa-color-interactive-primaryBorder":`${i.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${i.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${i.accent}33`,"--asakaa-color-status-success":i.statusCompleted,"--asakaa-color-status-warning":i.milestone,"--asakaa-color-status-error":i.criticalPath,"--asakaa-color-danger":i.criticalPath,"--asakaa-color-danger-border":`${i.criticalPath}4D`,"--asakaa-color-danger-background":`${i.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${i.criticalPath}26`};return createPortal(jsx("div",{"data-theme":c,"data-gantt-portal":"true",style:l,children:e}),n)}return s?createPortal(jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),n):createPortal(e,n)}var du={URGENT:{label:"Urgent",color:"#EF4444"},HIGH:{label:"High",color:"#F97316"},MEDIUM:{label:"Normal",color:"#F59E0B"},LOW:{label:"Low",color:"#10B981"}},$f="#BDC3C7",Hf=({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 Fo({priority:e,onChange:t,className:a}){let[r,o]=useState(false),[s,n]=useState({top:0,left:0}),i=useRef(null),c=useRef(null),l=()=>{if(!c.current)return;let g=c.current.getBoundingClientRect(),b=window.innerHeight,h=window.innerWidth,v=160,f=220,y=4,w=g.right-v;w<10&&(w=g.left),w+v>h-10&&(w=h-v-10);let x=b-g.bottom,T=g.top,k;x>=f+y?k=g.bottom+y:T>=f+y?k=g.top-f-y:k=x>=T?g.bottom+y:Math.max(10,g.top-f-y),n({top:k,left:w}),o(true);};useEffect(()=>{let g=b=>{i.current&&!i.current.contains(b.target)&&!c.current?.contains(b.target)&&o(false);};if(r)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[r]),useEffect(()=>{let g=b=>{b.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[r]);let p=g=>{t(g),o(false);},d=e?du[e]:null,m=d?.color||$f;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:c,onClick:()=>r?o(false):l(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${m}10`:"transparent",boxShadow:e?`0 0 0 2px ${m}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:m,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:m,fillOpacity:e?"0.6":"0.4"})})}),r&&jsx(Ht,{children:jsxs("div",{ref:i,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(du).map(([g,b])=>jsxs("button",{onClick:()=>p(g),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98] priority-option",style:{color:b.color,background:"transparent"},onMouseEnter:h=>{h.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:h=>{h.currentTarget.style.background="transparent";},children:[jsx(Hf,{color:b.color}),jsx("span",{className:"font-semibold text-sm",children:b.label}),e===g&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},g)),jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxs("button",{onClick:()=>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:g=>{g.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:g=>{g.currentTarget.style.background="transparent";},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"#9CA3AF",strokeWidth:"1.5",strokeDasharray:"2 2",opacity:"0.6"})}),jsx("span",{className:"font-semibold text-sm",children:"Clear"}),!e&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var zf=[{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 In({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=useState(false),[n,i]=useState({top:0,left:0}),c=useRef(null),l=useRef(null),m=(en()?.themeName||"dark")==="dark",g=()=>{if(!l.current)return;let w=l.current.getBoundingClientRect(),x=window.innerHeight,T=window.innerWidth,k=320,S=380,C=4,I=w.left;I+k>T-10&&(I=T-k-10),I<10&&(I=10);let $=x-w.bottom,A=w.top,_;$>=S+C?_=w.bottom+C:A>=S+C?_=w.top-S-C:_=$>=A?w.bottom+C:Math.max(10,w.top-S-C),i({top:_,left:I}),s(true);};useEffect(()=>{let w=x=>{c.current&&!c.current.contains(x.target)&&!l.current?.contains(x.target)&&s(false);};if(o)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[o]),useEffect(()=>{let w=x=>{x.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[o]);let b=w=>{let x=new Date,T=I=>{let $=I.getFullYear(),A=String(I.getMonth()+1).padStart(2,"0"),_=String(I.getDate()).padStart(2,"0");return `${$}-${A}-${_}`},k=T(x),S=new Date(x);S.setDate(S.getDate()+w);let C=T(S);a(k,C),s(false);},h=()=>{if(!e||!t)return "Set date";let w=S=>{if(S instanceof Date)return S;if(typeof S!="string"||!S.match(/^\d{4}-\d{2}-\d{2}$/))return null;let C=S.split("-").map(Number);if(C.length!==3||C.some(_=>isNaN(_)))return null;let I=C[0],$=C[1],A=C[2];return I===void 0||$===void 0||A===void 0?null:new Date(I,$-1,A)},x=w(e),T=w(t);if(!x||!T||isNaN(x.getTime())||isNaN(T.getTime()))return "Set date";let k=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${k[x.getMonth()]} ${x.getDate()} \u2013 ${k[T.getMonth()]} ${T.getDate()}`},v=e&&t,y=(()=>{if(!t)return false;let w=typeof t=="string"?new Date(t):t,x=new Date;return x.setHours(0,0,0,0),w<x})();return jsxs("div",{className:`relative ${r||""}`,children:[jsxs("button",{ref:l,onClick:()=>o?s(false):g(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${y?"asakaa-date-overdue":"asakaa-date"}`,title:v?`${h()}`:"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:h()})]}),o&&jsx(Ht,{children:jsxs("div",{ref:c,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,background:m?"#1A1D25":"#FFFFFF",border:`1px solid ${m?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:m?"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:m?"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:m?"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:zf.map(w=>jsx("button",{onClick:()=>b(w.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:m?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:x=>{x.currentTarget.style.backgroundColor=m?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",x.currentTarget.style.border=`1px solid ${m?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:x=>{x.currentTarget.style.backgroundColor=m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",x.currentTarget.style.border=`1px solid ${m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:w.label},w.label))})]}),jsxs("div",{className:"p-4",children:[jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:m?"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:w=>a(w.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:m?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:m?"dark":"light"}}),jsx("input",{type:"date",value:t||"",onChange:w=>a(e,w.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:m?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:m?"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:w=>{w.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:w=>{w.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function Po({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=useState(false),[i,c]=useState(""),[l,p]=useState({top:0,left:0}),d=useRef(null),m=useRef(null),g=()=>{if(!m.current)return;let y=m.current.getBoundingClientRect(),w=window.innerHeight,x=window.innerWidth,T=300,k=380,S=4,C=y.right-T;C<10&&(C=y.left),C+T>x-10&&(C=x-T-10);let I=w-y.bottom,$=y.top,A;I>=k+S?A=y.bottom+S:$>=k+S?A=y.top-k-S:A=I>=$?y.bottom+S:Math.max(10,y.top-k-S),p({top:A,left:C}),n(true);};useEffect(()=>{let y=w=>{d.current&&!d.current.contains(w.target)&&!m.current?.contains(w.target)&&(n(false),c(""));};if(s)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[s]),useEffect(()=>{let y=w=>{w.key==="Escape"&&(n(false),c(""));};if(s)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[s]);let b=y=>{let w=e.some(x=>x.id===y.id);a(w?e.filter(x=>x.id!==y.id):[...e,y]);},h=t.filter(y=>y.name.toLowerCase().includes(i.toLowerCase())),v=e.slice(0,o),f=e.length-o;return jsxs("div",{className:`relative ${r||""}`,children:[jsx("button",{ref:m,onClick:()=>s?n(false):g(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxs("div",{className:"asakaa-avatar-group",children:[v.map(y=>jsx("div",{className:"asakaa-avatar",title:y.name,children:y.avatar?jsx("img",{src:y.avatar,alt:y.name,className:"asakaa-avatar-img"}):y.initials},y.id)),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(Ht,{children:jsxs("div",{ref:d,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${l.top}px`,left:`${l.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("input",{type:"text",value:i,onChange:y=>c(y.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:h.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"}):h.map(y=>{let w=e.some(x=>x.id===y.id);return jsxs("button",{onClick:()=>b(y),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:x=>{x.currentTarget.style.background="transparent";},children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor:y.color,color:"#fff"},children:y.avatar?jsx("img",{src:y.avatar,alt:y.name,className:"w-full h-full rounded-full object-cover"}):y.initials}),jsx("span",{className:"font-semibold flex-1 text-left truncate",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:y.name}),jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:w?"#3b82f6":"transparent"},children:w?"\u2713":""})]},y.id)})}),e.length>0&&jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsx("button",{onClick:()=>{a([]),n(false);},className:"w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all hover:bg-red-600/30 active:scale-95 border",style:{color:"#f87171",borderColor:"rgba(248, 113, 113, 0.3)",background:"rgba(248, 113, 113, 0.08)"},children:"Clear All"})})]})})]})}function Ms(e,t,a){let r=new Map;e.forEach(c=>{if(c.dependencies&&Array.isArray(c.dependencies)){let l=c.dependencies.map(p=>{if(typeof p=="string")return p;let d=p;return d.taskId||d.targetId||""}).filter(Boolean);r.set(c.id,l);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,i=c=>{if(!s.has(c)){s.add(c),n.add(c);let l=r.get(c)||[];for(let p of l){if(!s.has(p)&&i(p))return true;if(n.has(p))return true}}return n.delete(c),false};return i(a)}function Rn({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[i,c]=useState(false),[l,p]=useState(""),[d,m]=useState(t.length>0),[g,b]=useState({top:0,left:0}),[h,v]=useState(null),f=useRef(null),y=useRef(null),w=()=>{if(!y.current)return;let C=y.current.getBoundingClientRect(),I=window.innerHeight,$=window.innerWidth,A=300,_=d?380:120,E=4,me=C.right-A;me<10&&(me=C.left),me+A>$-10&&(me=$-A-10);let L=I-C.bottom,X=C.top,ee;L>=_+E?ee=C.bottom+E:X>=_+E?ee=C.top-_-E:ee=L>=X?C.bottom+E:Math.max(10,C.top-_-E),b({top:ee,left:me}),c(true);};useEffect(()=>{if(!i||!y.current)return;let C=y.current.getBoundingClientRect(),I=window.innerHeight,$=window.innerWidth,A=300,_=d?380:120,E=4,me=C.right-A;me<10&&(me=C.left),me+A>$-10&&(me=$-A-10);let L=I-C.bottom,X=C.top,ee;L>=_+E?ee=C.bottom+E:X>=_+E?ee=C.top-_-E:ee=L>=X?C.bottom+E:Math.max(10,C.top-_-E),b({top:ee,left:me});},[d,i]),useEffect(()=>{let C=I=>{f.current&&!f.current.contains(I.target)&&!y.current?.contains(I.target)&&(c(false),p(""));};if(i)return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[i]),useEffect(()=>{let C=I=>{I.key==="Escape"&&(c(false),p(""));};if(i)return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[i]);let x=C=>{let I=t.includes(C),$=a.find(A=>A.id===C);if(v(null),I){let A=t.filter(_=>_!==C);r(A),A.length===0&&m(false);}else {if(s&&Ms(a,C,e)){let _=`Cannot add "${$?.title||C}" as dependency - would create circular reference`;v(_),n?.(C,$?.title||C),setTimeout(()=>v(null),3e3);return}r([...t,C]),m(true);}},T=()=>{let C=!d;m(C),C||r([]);},k=a.filter(C=>C.id!==e).filter(C=>C.title.toLowerCase().includes(l.toLowerCase())||C.id.toLowerCase().includes(l.toLowerCase())),S=t.length>0?"#2E94FF":"#BDC3C7";return jsxs("div",{className:`relative ${o||""}`,children:[jsxs("button",{ref:y,onClick:()=>i?c(false):w(),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:S,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsx("span",{className:"text-xs font-medium",style:{color:S},children:t.length})]}),i&&jsx(Ht,{children:jsxs("div",{ref:f,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${g.top}px`,left:`${g.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[h&&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:h})]}),jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:T,children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background: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:l,onChange:C=>p(C.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:k.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"}):k.map(C=>{let I=t.includes(C.id);return jsxs("button",{onClick:()=>x(C.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:$=>{$.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:$=>{$.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:C.title}),jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:C.id})]})]},C.id)})})]}),t.length>0&&jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsx("button",{onClick:()=>{r([]),m(false),c(false);},className:"w-full px-3 py-2 rounded-md text-xs font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#E74C3C"},children:"Clear All Dependencies"})})]})})]})}var Kr=memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:i=[],allCards:c=[]})=>{let{attributes:l,listeners:p,setNodeRef:d,transform:m,transition:g,isDragging:b}=useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),h={transform:Ds.Transform.toString(m),transition:g};if(t)return jsx("div",{ref:d,style:h,...l,...p,onClick:()=>a?.(e),children:t(e)});let v=i.filter(x=>e.assignedUserIds?.includes(x.id)),f=e.progress===100,y=(e.attachments||[]).filter(x=>x.type.startsWith("image/")),w={...h,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxs("div",{ref:d,style:w,className:u("asakaa-card",b&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...l,...p,onClick:x=>{x.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||a?.(e);},children:[e.coverImage&&jsx("div",{className:"asakaa-card-cover mb-3",children:jsx("img",{src:e.coverImage,alt:`Cover for ${e.title}`,className:"w-full h-32 object-cover rounded-md",loading:"lazy",onError:x=>{x.currentTarget.style.display="none";}})}),y.length>0&&!e.coverImage&&jsx("div",{className:"asakaa-card-attachments mb-3",children:y.length===1&&y[0]?jsx("img",{src:y[0].url,alt:y[0].name,className:"w-full h-32 object-cover rounded-md",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:x=>{x.currentTarget.style.display="none";}}):jsx("div",{className:"grid grid-cols-2 gap-1",children:y.slice(0,4).map((x,T)=>jsxs("div",{className:"relative",children:[jsx("img",{src:x.url,alt:x.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:k=>{k.currentTarget.style.display="none";}}),T===3&&y.length>4&&jsx("div",{className:"absolute inset-0 bg-black/60 rounded flex items-center justify-center",children:jsxs("span",{className:"text-white text-sm font-medium",children:["+",y.length-4]})})]},x.id))})}),jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration: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:x=>x.stopPropagation(),className:"priority-selector",children:jsx(Fo,{priority:e.priority,onChange:x=>n?.(e.id,{priority:x})})}),jsx("div",{onClick:x=>x.stopPropagation(),className:"date-picker",children:jsx(In,{startDate:e.startDate?typeof e.startDate=="string"?e.startDate:e.startDate.toISOString().split("T")[0]:void 0,endDate:e.endDate?typeof e.endDate=="string"?e.endDate:e.endDate.toISOString().split("T")[0]:void 0,onChange:(x,T)=>n?.(e.id,{startDate:x,endDate:T})})}),i.length>0&&jsx("div",{onClick:x=>x.stopPropagation(),className:"user-selector",children:jsx(Po,{assignedUsers:v,availableUsers:i,onChange:x=>n?.(e.id,{assignedUserIds:x.map(T=>T.id)})})}),jsx("div",{onClick:x=>x.stopPropagation(),className:"dependencies-selector",children:jsx(Rn,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(x=>typeof x=="string"?x:x.taskId):[],availableTasks:c,onChange:x=>n?.(e.id,{dependencies:x})})})]}),e.labels&&e.labels.length>0&&jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(x=>jsx("span",{className:"asakaa-label",children:x},x))}),typeof e.progress=="number"&&jsxs("div",{className:"mt-3 pt-2 border-t border-white/5",children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:"text-[10px] text-[#6B7280]",children:"Progreso"}),jsxs("span",{className:"text-[10px] font-medium",style:{color:"#2E94FF"},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:"#2E94FF"}})})]})]})},(e,t)=>e.card.id===t.card.id&&e.card.title===t.card.title&&e.card.description===t.card.description&&e.card.position===t.card.position&&e.card.columnId===t.card.columnId&&e.card.priority===t.card.priority&&e.card.color===t.card.color&&e.card.progress===t.card.progress&&e.card.startDate===t.card.startDate&&e.card.endDate===t.card.endDate&&e.isSelected===t.isSelected&&e.render===t.render&&JSON.stringify(e.card.labels)===JSON.stringify(t.card.labels)&&JSON.stringify(e.card.assignedUserIds)===JSON.stringify(t.card.assignedUserIds)&&JSON.stringify(e.card.dependencies)===JSON.stringify(t.card.dependencies)&&JSON.stringify(e.card.attachments?.map(a=>a.id))===JSON.stringify(t.card.attachments?.map(a=>a.id)));Kr.displayName="Card";var Ps={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"}},xu=({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 vu({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=useState(false),[n,i]=useState({top:0,left:0}),c=useRef(null),l=useRef(null),p=[...Object.entries(Ps).map(([v,f])=>({id:v,label:f.label,color:f.color,icon:f.icon})),...r.filter(v=>!Object.keys(Ps).includes(v.id)).map(v=>({id:v.id,label:v.title,color:v.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let v=Ps[e];if(v)return {...v,id:e};let f=r.find(y=>y.id===e);return f?{id:f.id,label:f.title,color:f.color||"#8B5CF6",icon:"circle-dot"}:{...Ps.todo,id:"todo"}},m=()=>{if(!l.current)return;let v=l.current.getBoundingClientRect(),f=window.innerHeight,y=window.innerWidth,w=180,x=280,T=4,k=v.right-w;k<10&&(k=v.left),k+w>y-10&&(k=y-w-10);let S=f-v.bottom,C=v.top,I;S>=x+T?I=v.bottom+T:C>=x+T?I=v.top-x-T:I=S>=C?v.bottom+T:Math.max(10,v.top-x-T),i({top:I,left:k}),s(true);};useEffect(()=>{let v=f=>{c.current&&!c.current.contains(f.target)&&!l.current?.contains(f.target)&&s(false);};if(o)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[o]),useEffect(()=>{let v=f=>{f.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[o]);let g=v=>{t(v),s(false);},b=d(),h=b.color;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:l,onClick:()=>o?s(false):m(),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:`${h}10`,boxShadow:`0 0 0 2px ${h}30 inset`},title:b.label,children:jsx(xu,{icon:b.icon,color:h})}),o&&jsx(Ht,{children:jsxs("div",{ref:c,className:"status-selector-menu",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsx("div",{className:"py-1",children:p.map(v=>jsxs("button",{onClick:()=>g(v.id),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:v.color,background:"transparent"},onMouseEnter: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(xu,{icon:v.icon,color:v.color}),jsx("span",{className:"font-semibold",children:v.label}),e===v.id&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},v.id))})]})})]})}var wu={en:{renameColumn:"Rename Column",rename:"Rename",delete:"Delete",columnName:"Column name",columnOptions:"Column options"},es:{renameColumn:"Renombrar Columna",rename:"Renombrar",delete:"Eliminar",columnName:"Nombre de columna",columnOptions:"Opciones de columna"}};function ku({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o,locale:s="en"}){let n=wu[s]||wu.en,[i,c]=useState(false),[l,p]=useState(false),[d,m]=useState(e),[g,b]=useState({top:0,left:0}),h=useRef(null),v=useRef(null),f=useRef(null);useEffect(()=>{if(i&&v.current){let T=v.current.getBoundingClientRect();b({top:T.bottom+window.scrollY+8,left:T.left+window.scrollX});}},[i]),useEffect(()=>{let T=k=>{h.current&&!h.current.contains(k.target)&&!v.current?.contains(k.target)&&(c(false),p(false));};if(i)return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[i]),useEffect(()=>{let T=k=>{k.key==="Escape"&&(c(false),p(false),m(e));};if(i)return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[i,e]),useEffect(()=>{l&&f.current&&(f.current.focus(),f.current.select());},[l]);let y=()=>{p(true),m(e);},w=()=>{let T=d.trim();T&&T!==e&&t(T),p(false),c(false),m(e);},x=T=>{T.key==="Enter"?w():T.key==="Escape"&&(p(false),m(e));};return jsxs("div",{className:`relative ${o||""}`,children:[jsx("button",{ref:v,onClick:()=>c(!i),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:n.columnOptions,"aria-label":n.columnOptions,children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),i&&jsx(Ht,{children:jsx("div",{ref:h,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${g.top}px`,left:`${g.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:l?jsxs("div",{className:"p-3",children:[jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:n.renameColumn}),jsx("input",{ref:f,type:"text",value:d,onChange:T=>m(T.target.value),onKeyDown:x,onBlur:w,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:n.columnName,maxLength:50})]}):jsxs("div",{className:"py-1",children:[jsxs("button",{onClick:y,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:n.rename})]}),r&&a&&jsxs(Fragment,{children:[jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxs("button",{onClick:()=>{a(),c(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:n.delete})]})]})]})})})]})}var rn=memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:i,availableUsers:c,allCards:l,enableVirtualization:p,cardHeight:d=120,isCollapsed:m,onToggleCollapse:g,onColumnRename:b,onColumnDelete:h,isDeletable:v=false,className:f,renderMetrics:y,locale:w})=>{let{setNodeRef:x,isOver:T}=useDroppable({id:e.id,data:{type:"column",column:e}}),k=useRef(null),S=p??Kc(t.length),C=useVirtualizer({count:t.length,getScrollElement:()=>k.current,estimateSize:()=>d,enabled:S});if(a)return jsx("div",{ref:x,className:f,children:a(e,t)});let $=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let E=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:E}:E>=80?{state:"warning",percentage:E}:E>=60?{state:"approaching",percentage:E}:{state:"ok",percentage:E}})(),A=$.state==="exceeded",_=()=>"asakaa-column-count";return jsxs("div",{ref:x,className:u("asakaa-column",T&&"ring-2 ring-asakaa-accent-blue",A&&"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:u(_()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&$.state!=="none"&&jsxs("span",{className:"text-xs font-medium flex items-center",title:`${$.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[$.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"})]}),$.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"})]}),$.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"})}),$.state==="ok"&&jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(b||h)&&jsx(ku,{columnTitle:e.title,onRename:E=>b?.(e.id,E),onDelete:h?()=>h(e.id):void 0,isDeletable:v,locale:w}),g&&jsx("button",{onClick:g,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":m?"Expand column":"Collapse column",children:m?"\u25B6":"\u25BC"})]})]}),y&&y(e,t),!m&&jsx("div",{ref:k,className:"asakaa-column-cards",style:{maxHeight:S?"600px":void 0},children:jsx(SortableContext,{items:t.map(E=>E.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"})}):S?jsx("div",{style:{height:`${C.getTotalSize()}px`,position:"relative"},children:C.getVirtualItems().map(E=>{let me=t[E.index];return me?jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${E.start}px)`},children:jsx(Kr,{card:me,render:r,onClick:n,onUpdate:i,availableUsers:c,allCards:l})},me.id):null})}):t.map(E=>jsx(Kr,{card:E,render:r,onClick:n,onUpdate:i,availableUsers:c,allCards:l},E.id))})})]})});rn.displayName="Column";function fl({title:e,onSave:t,className:a}){let[r,o]=useState(false),[s,n]=useState(e),i=useRef(null);useEffect(()=>{r&&i.current&&(i.current.focus(),i.current.select());},[r]);let c=()=>{let p=s.trim();p&&p!==e?t(p):n(e),o(false);},l=p=>{p.key==="Enter"?c():p.key==="Escape"&&(n(e),o(false));};return r?jsx("input",{ref:i,type:"text",value:s,onChange:p=>n(p.target.value),onBlur:c,onKeyDown:l,className:u("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsx("h2",{className:u("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function sb(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 Eu(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(i=>{let c=i.name.toLowerCase(),l=c.replace(/\s+/g,""),p=c.split(/\s+/);return !!(l===s||c===s||p.some(d=>d===s))});n&&!a.includes(n.id)&&a.push(n.id);}return a}function ib(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function lb(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var db=["\u{1F600}","\u{1F602}","\u{1F970}","\u{1F60D}","\u{1F914}","\u{1F44D}","\u{1F44E}","\u{1F389}","\u{1F525}","\u2764\uFE0F","\u{1F4AF}","\u2705","\u274C","\u26A0\uFE0F","\u{1F4CC}","\u{1F4A1}","\u{1F680}","\u2B50","\u{1F3AF}","\u{1F4AA}","\u{1F64F}","\u{1F440}","\u{1F4DD}","\u{1F4AC}"];function Fu({value:e,onChange:t,onSubmit:a,users:r,placeholder:o,disabled:s=false,isSubmitting:n=false,theme:i="dark",locale:c="es",currentUser:l,enableEmoji:p=true,enableAttachments:d=true,pendingFiles:m=[],onFilesSelect:g,onRemoveFile:b,maxFileSizeMB:h=10}){let v=i==="dark",[f,y]=useState(false),[w,x]=useState([]),[T,k]=useState(0),[S,C]=useState(null),[I,$]=useState(false),A=useRef(null),_=useRef(null),E=useRef(null),me=useRef(null),L=useCallback((U,oe)=>{let te=sb(U,oe);if(C(te),te){let Fe=r.filter(we=>we.name.toLowerCase().includes(te.query)||we.email&&we.email.toLowerCase().includes(te.query)).slice(0,5);x(Fe),y(Fe.length>0),k(0);}else y(false),x([]);},[r]),X$1=U=>{let oe=U.target.value;if(t(oe),L(oe,U.target.selectionStart||0),A.current){A.current.style.height="24px";let te=A.current.scrollHeight,Fe=280,we=Math.min(te,Fe);A.current.style.height=`${we}px`,A.current.style.overflowY=te>Fe?"auto":"hidden";}},ee=()=>{A.current&&L(e,A.current.selectionStart||0);},ze=useCallback(U=>{if(!S||!A.current)return;let oe=e.slice(0,S.start),te=e.slice(S.end),Fe=`@${U.name.replace(/\s+/g,"")} `,we=oe+Fe+te;t(we),y(false),C(null),setTimeout(()=>{if(A.current){let Re=S.start+Fe.length;A.current.selectionStart=Re,A.current.selectionEnd=Re,A.current.focus();}},0);},[S,e,t]),O=U=>{if(f&&w.length>0)switch(U.key){case "ArrowDown":U.preventDefault(),k(oe=>oe<w.length-1?oe+1:0);break;case "ArrowUp":U.preventDefault(),k(oe=>oe>0?oe-1:w.length-1);break;case "Enter":{U.preventDefault();let oe=w[T];oe&&ze(oe);break}case "Tab":{U.preventDefault();let oe=w[T];oe&&ze(oe);break}case "Escape":U.preventDefault(),y(false);break}else U.key==="Enter"&&!U.shiftKey&&(U.preventDefault(),a());};useEffect(()=>{let U=oe=>{_.current&&!_.current.contains(oe.target)&&A.current&&!A.current.contains(oe.target)&&y(false),me.current&&!me.current.contains(oe.target)&&$(false);};return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[]);let j=useCallback(U=>{if(!A.current)return;let oe=A.current.selectionStart||e.length,te=e.slice(0,oe)+U+e.slice(oe);t(te),$(false),setTimeout(()=>{if(A.current){let Fe=oe+U.length;A.current.selectionStart=Fe,A.current.selectionEnd=Fe,A.current.focus();}},0);},[e,t]),he=useCallback(U=>{if(!g||!U.target.files)return;let oe=Array.from(U.target.files),te=h*1024*1024,Fe=oe.filter(we=>we.size>te?(console.warn(`File ${we.name} exceeds max size of ${h}MB`),false):true);Fe.length>0&&g(Fe),U.target.value="";},[g,h]),je=useCallback(U=>U.type.startsWith("image/")?Image:U.type.includes("pdf")||U.type.includes("document")?FileText:File,[]);return useEffect(()=>{if(f&&_.current){let U=_.current.children[T];U&&U.scrollIntoView({block:"nearest"});}},[T,f]),jsxs("div",{className:"flex flex-col gap-2",children:[m.length>0&&jsx("div",{className:"flex flex-wrap gap-2",children:m.map(U=>{let oe=je(U.file),te=U.file.type.startsWith("image/");return jsxs("div",{className:u("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",v?"bg-white/10":"bg-gray-100"),children:[te&&U.preview?jsx("img",{src:U.preview,alt:U.file.name,className:"w-6 h-6 rounded object-cover"}):jsx(oe,{className:u("w-4 h-4",v?"text-[#9CA3AF]":"text-gray-500")}),jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsx("p",{className:u("text-xs truncate",v?"text-white":"text-gray-900"),children:U.file.name}),jsx("p",{className:u("text-xs",v?"text-[#6B7280]":"text-gray-400"),children:lb(U.file.size)})]}),b&&jsx("button",{onClick:()=>b(U.id),className:u("p-0.5 rounded-full transition-colors",v?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600"),children:jsx(X,{className:"w-3 h-3"})})]},U.id)})}),jsxs("div",{className:"flex items-start gap-2",children:[l&&jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:l.color||"#8B5CF6"},children:l.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:u("flex-1 relative min-w-0"),children:[jsxs("div",{className:u("flex items-end gap-1 px-2 py-2 rounded-lg",v?"bg-white/5":"bg-white border border-gray-200"),children:[p&&jsxs("div",{className:"relative",children:[jsx("button",{type:"button",onClick:()=>$(!I),disabled:s||n,className:u("p-1 rounded transition-colors flex-shrink-0",v?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:"Emojis",children:jsx(Smile,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:I&&jsx(motion.div,{ref:me,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:u("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",v?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-8 gap-1 w-[200px]",children:db.map(U=>jsx("button",{type:"button",onClick:()=>j(U),className:u("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",v?"hover:bg-white/10":"hover:bg-gray-100"),children:U},U))})})})]}),d&&g&&jsxs(Fragment,{children:[jsx("button",{type:"button",onClick:()=>E.current?.click(),disabled:s||n,className:u("p-1.5 rounded transition-colors",v?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:c==="es"?"Adjuntar archivo":"Attach file",children:jsx(Paperclip,{className:"w-4 h-4"})}),jsx("input",{ref:E,type:"file",multiple:true,onChange:he,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsx("textarea",{ref:A,value:e,onChange:X$1,onSelect:ee,onKeyDown:O,placeholder:o||(c==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||n,rows:1,className:u("flex-1 bg-transparent text-sm outline-none min-w-[100px] resize-none py-0.5",v?"text-white placeholder:text-[#6B7280] scrollbar-slim":"text-gray-900 placeholder:text-gray-400 scrollbar-slim-light",(s||n)&&"opacity-50"),style:{lineHeight:"1.5",height:"24px",maxHeight:"280px",overflowY:"hidden"}}),jsx("button",{onClick:a,disabled:n||!e.trim()&&m.length===0||s,className:u("p-1.5 rounded transition-colors",(e.trim()||m.length>0)&&!s?"bg-blue-500 text-white hover:bg-blue-600":v?"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:f&&w.length>0&&jsx(motion.div,{ref:_,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:u("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",v?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:w.map((U,oe)=>jsxs("button",{type:"button",onClick:()=>ze(U),className:u("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",oe===T?v?"bg-white/10":"bg-gray-100":v?"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:U.color||"#8B5CF6"},children:ib(U.name)}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("p",{className:u("text-sm font-medium truncate",v?"text-white":"text-gray-900"),children:U.name}),U.email&&jsx("p",{className:u("text-xs truncate",v?"text-[#6B7280]":"text-gray-500"),children:U.email})]})]},U.id))})})]})]})]})}function Mu({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((i,c)=>i.type==="mention"?jsx("span",{className:u("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:i.value},c):jsx("span",{children:i.value},c))})}var Rs=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#2E94FF","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function lo({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[i,c]=useState(false),[l,p]=useState(""),[d,m]=useState(false),[g,b]=useState(Rs[10]||"#2E94FF"),[h,v]=useState({top:0,left:0}),f=useRef(null),y=useRef(null),w=useRef(null),x=useRef(null),T=t.filter(A=>A.name.toLowerCase().includes(l.toLowerCase())),k=t.some(A=>A.name.toLowerCase()===l.toLowerCase());useEffect(()=>{if(i&&y.current){let A=y.current.getBoundingClientRect();v({top:A.bottom+6,left:A.left});}},[i]),useEffect(()=>{let A=_=>{let E=_.target,me=f.current?.contains(E),L=w.current?.contains(E);!me&&!L&&(c(false),p(""),m(false));};if(i)return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[i]),useEffect(()=>{i&&x.current&&x.current.focus();},[i]);let S=A=>{let _=e.some(E=>E.id===A.id);a(_?e.filter(E=>E.id!==A.id):[...e,A]);},C=async()=>{if(!(!r||!l.trim())){m(true);try{let A=await r(l.trim(),g);A&&(a([...e,A]),p(""),b(Rs[Math.floor(Math.random()*Rs.length)]||"#2E94FF"));}finally{m(false);}}},I=(A,_)=>{_.stopPropagation(),a(e.filter(E=>E.id!==A));},$={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxs("div",{ref:f,className:"relative",children:[jsxs("button",{ref:y,type:"button",onClick:()=>!s&&c(!i),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:$,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(A=>jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${A.color}20`,color:A.color},children:A.name},A.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:i&&jsxs(motion.div,{ref:w,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:h.top,left:h.left,zIndex:99999,backgroundColor:o.bgPrimary,border:`1px solid ${o.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsx("div",{className:"p-2 border-b",style:{borderColor:o.border},children:jsx("input",{ref:x,type:"text",value:l,onChange:A=>p(A.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:A=>{A.key==="Enter"&&l.trim()&&!k&&r&&C();}})}),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(A=>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:`${A.color}20`,color:A.color},onClick:_=>I(A.id,_),children:[A.name,jsx(X,{className:"w-3 h-3"})]},A.id))})]}),jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:T.length>0?T.map(A=>{let _=e.some(E=>E.id===A.id);return jsxs("button",{type:"button",onClick:()=>S(A),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:_?`${A.color}15`:"transparent",color:o.textPrimary},onMouseEnter:E=>{_||(E.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:E=>{_||(E.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:A.color}}),jsx("span",{className:"flex-1 text-left",children:A.name}),_&&jsx(Check,{className:"w-4 h-4",style:{color:A.color}})]},A.id)}):l.trim()?jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No se encontraron etiquetas"}):jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No hay etiquetas disponibles"})}),l.trim()&&!k&&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:Rs.map(A=>jsx("button",{type:"button",onClick:()=>b(A),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:A,outline:g===A?`2px solid ${A}`:"none",outlineOffset:"2px"}},A))}),jsxs("button",{type:"button",onClick:C,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:g,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 "',l.trim(),'"']})]})]})}),document.body)]})}function hl({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 Au({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(hl,{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 Lo=[{name:"Azul",value:"#2E94FF",light:"#5AADFF"},{name:"P\xFArpura",value:"#A855F7",light:"#C084FC"},{name:"Rosa",value:"#EC4899",light:"#F472B6"},{name:"Rojo",value:"#EF4444",light:"#F87171"},{name:"Naranja",value:"#F59E0B",light:"#FBBF24"},{name:"Amarillo",value:"#EAB308",light:"#FACC15"},{name:"Lima",value:"#84CC16",light:"#A3E635"},{name:"Verde",value:"#10B981",light:"#34D399"},{name:"Esmeralda",value:"#059669",light:"#10B981"},{name:"Cyan",value:"#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 Lu(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h${a}m`}function yb(e){switch(e){case "on-track":return {text:"text-green-600 dark:text-green-400",bg:"bg-green-50 dark:bg-green-900/20",border:"border-green-200 dark:border-green-800"};case "at-risk":return {text:"text-yellow-600 dark:text-yellow-400",bg:"bg-yellow-50 dark:bg-yellow-900/20",border:"border-yellow-200 dark:border-yellow-800"};case "over-budget":return {text:"text-red-600 dark:text-red-400",bg:"bg-red-50 dark:bg-red-900/20",border:"border-red-200 dark:border-red-800"};case "no-estimate":default:return {text:"text-gray-500 dark:text-gray-400",bg:"bg-gray-50 dark:bg-gray-800/50",border:"border-gray-200 dark:border-gray-700"}}}function xb({className:e}){return jsxs("svg",{className:u("w-3 h-3",e),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M12 6v6l4 2"})]})}function yl({summary:e,size:t="sm",showEstimate:a=true,onClick:r,className:o}){let s=yb(e.health),n={sm:"text-xs px-1.5 py-0.5 gap-1",md:"text-sm px-2 py-1 gap-1.5",lg:"text-base px-2.5 py-1.5 gap-2"},i={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},c=Lu(e.loggedMinutes),l=e.estimateMinutes?Lu(e.estimateMinutes):null,p=a&&l?`${c} / ${l}`:c;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxs(r?"button":"span",{className:u("inline-flex items-center rounded-full border font-medium","transition-colors duration-150",s.text,s.bg,s.border,n[t],r&&"cursor-pointer hover:opacity-80 focus:outline-none focus:ring-2 focus:ring-offset-1",o),onClick:r,type:r?"button":void 0,children:[jsx(xb,{className:i[t]}),jsx("span",{children:p})]})}function vb(e){let t=e.trim();if(!t)return null;let a;if(t.startsWith("="))a=t.slice(1).trim();else if(t.startsWith("+")&&/[*\/()]/.test(t))a=t.slice(1).trim();else if(/^\d[\d\s]*[*\/]/.test(t)||/^\(/.test(t))a=t;else return null;if(!a||!/^[\d+\-*/().\s]+$/.test(a)||/[+\-*/]{2,}/.test(a.replace(/\s/g,"").replace(/\*-/g,"X").replace(/\/-/g,"X")))return null;try{let r=new Function(`"use strict"; return (${a});`)();return typeof r!="number"||!isFinite(r)||r<0?null:r}catch{return null}}function $s(e){let t=vb(e);return t!==null?String(t):e}function Bu(e){let a=$s(e).trim().toLowerCase();if(a.includes(":")){let[n,i]=a.split(":").map(Number);return (n||0)*60+(i||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),o=a.match(/(\d+)\s*m/);if(r||o){let n=r?.[1]?parseFloat(r[1]):0,i=o?.[1]?parseInt(o[1],10):0;return Math.round(n*60)+i}let s=parseFloat(a);return isNaN(s)?0:Math.round(s*60)}function Hs(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function Cb(e){let t=Math.floor(e/3600),a=Math.floor(e%3600/60),r=e%60;return t>0?`${t}:${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`:`${a}:${r.toString().padStart(2,"0")}`}function Tb({className:e}){return jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{d:"M8 5v14l11-7z"})})}function Nb({className:e}){return jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})})}function Ru({className:e}){return jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:jsx("path",{d:"M6 18L18 6M6 6l12 12"})})}function Db({className:e}){return jsxs("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M12 6v6l4 2"})]})}function xl({taskId:e,summary:t,entries:a=[],isTimerRunning:r=false,timerElapsedSeconds:o=0,onLogTime:s,onUpdateEstimate:n,onStartTimer:i,onStopTimer:c,onDiscardTimer:l,onClose:p,className:d}){let[m,g]=useState(""),[b,h]=useState(t.estimateMinutes?Hs(t.estimateMinutes):""),[v,f]=useState(""),[y,w]=useState(false),[x,T]=useState(false),k=useRef(null);useEffect(()=>{k.current?.focus();},[]);let S=async()=>{let $=Bu(m);if(!($<=0||!s)){w(true);try{await s({durationMinutes:$,note:v.trim()||void 0,source:"manual"}),g(""),f("");}finally{w(false);}}},C=async()=>{if(!n)return;let $=b.trim()?Bu(b):null;await n($),T(false);},I=$=>{$.key==="Enter"&&!$.shiftKey&&($.preventDefault(),S()),$.key==="Escape"&&p?.();};return jsxs("div",{className:u("w-72 bg-white dark:bg-gray-800 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700","divide-y divide-gray-100 dark:divide-gray-700",d),children:[jsxs("div",{className:"px-3 py-2 flex items-center justify-between",children:[jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-200",children:"Time Tracking"}),jsx("button",{onClick:p,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-400",children:jsx(Ru,{className:"w-4 h-4"})})]}),jsx("div",{className:"px-3 py-2",children:r?jsxs("div",{className:"flex items-center gap-2",children:[jsxs("div",{className:"flex-1 flex items-center gap-2",children:[jsxs("span",{className:"relative flex h-2 w-2",children:[jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-green-500"})]}),jsx("span",{className:"text-lg font-mono font-medium text-gray-900 dark:text-white",children:Cb(o)})]}),jsx("button",{onClick:c,className:"p-2 rounded-lg bg-green-500 hover:bg-green-600 text-white",title:"Stop and save",children:jsx(Nb,{className:"w-4 h-4"})}),jsx("button",{onClick:l,className:"p-2 rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-600 dark:text-gray-300",title:"Discard",children:jsx(Ru,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:i,className:u("w-full flex items-center justify-center gap-2 px-3 py-2 rounded-lg","bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600","text-gray-700 dark:text-gray-200 font-medium text-sm"),children:[jsx(Tb,{className:"w-4 h-4"}),"Start Timer"]})}),jsxs("div",{className:"px-3 py-2 space-y-2",children:[jsxs("div",{className:"flex gap-2",children:[jsxs("div",{className:"relative flex-1",children:[jsx(Db,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsx("input",{ref:k,type:"text",value:m,onChange:$=>g($.target.value),onKeyDown:I,placeholder:"8 (=8h), 2h 30m",className:u("w-full pl-8 pr-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent")})]}),jsx("button",{onClick:S,disabled:y||!m.trim(),className:u("px-3 py-1.5 rounded-lg text-sm font-medium","bg-blue-500 hover:bg-blue-600 text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:"Log"})]}),jsx("input",{type:"text",value:v,onChange:$=>f($.target.value),onKeyDown:I,placeholder:"Note (optional)",className:u("w-full px-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent")})]}),jsxs("div",{className:"px-3 py-2",children:[jsxs("div",{className:"flex justify-between text-sm",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Logged"}),jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:Hs(t.loggedMinutes)})]}),jsxs("div",{className:"flex justify-between text-sm mt-1",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Estimate"}),x?jsx("div",{className:"flex items-center gap-1",children:jsx("input",{type:"text",value:b,onChange:$=>h($.target.value),onKeyDown:$=>{$.key==="Enter"&&C(),$.key==="Escape"&&T(false);},onBlur:C,autoFocus:true,className:"w-16 px-1 py-0.5 text-sm text-right rounded border border-blue-500 bg-transparent focus:outline-none",placeholder:"4h"})}):jsx("button",{onClick:()=>T(true),className:"font-medium text-gray-900 dark:text-white hover:text-blue-500",children:t.estimateMinutes?Hs(t.estimateMinutes):"Set estimate"})]}),t.progressPercent!==null&&jsxs("div",{className:"mt-2",children:[jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Progress"}),jsxs("span",{className:u("font-medium",t.health==="on-track"&&"text-green-600",t.health==="at-risk"&&"text-yellow-600",t.health==="over-budget"&&"text-red-600"),children:[t.progressPercent,"%"]})]}),jsx("div",{className:"h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:jsx("div",{className:u("h-full transition-all duration-300",t.health==="on-track"&&"bg-green-500",t.health==="at-risk"&&"bg-yellow-500",t.health==="over-budget"&&"bg-red-500"),style:{width:`${Math.min(100,t.progressPercent)}%`}})})]})]}),a.length>0&&jsxs("div",{className:"px-3 py-2",children:[jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-2",children:"Recent Entries"}),jsx("div",{className:"space-y-1 max-h-24 overflow-y-auto",children:a.slice(0,3).map($=>jsxs("div",{className:"flex items-center justify-between text-xs text-gray-600 dark:text-gray-300",children:[jsx("span",{className:"truncate flex-1",children:$.note||"Time logged"}),jsx("span",{className:"font-medium ml-2",children:Hs($.durationMinutes)})]},$.id))})]})]})}function Pb(e){let a=$s(e).trim().toLowerCase();if(!a||a==="-")return null;if(a.includes(":")){let[n,i]=a.split(":").map(Number);return (n||0)*60+(i||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),o=a.match(/(\d+)\s*m/);if(r||o){let n=r?.[1]?parseFloat(r[1]):0,i=o?.[1]?parseInt(o[1],10):0;return Math.round(n*60)+i}let s=parseFloat(a);return isNaN(s)?null:Math.round(s*60)}function Ab(e){if(!e||e===0)return "";let t=Math.floor(e/60),a=e%60;return t===0?`${a}m`:a===0?`${t}h`:`${t}h ${a}m`}function $r({mode:e,locale:t,isDark:a,currentValue:r,onSave:o,onClose:s,className:n}){let[i,c]=useState(Ab(r)),[l,p]=useState(""),[d,m]=useState(false),g=useRef(null);useEffect(()=>{g.current?.focus();},[]);let b=async()=>{m(true);let w=Pb(i);await o(w&&w>0?w:null,l||void 0),m(false);},h=async()=>{m(true),await o(null),m(false);},v=w=>{w.key==="Enter"&&!w.shiftKey&&(w.preventDefault(),b()),w.key==="Escape"&&s();},f={estimate:t==="es"?"Estimaci\xF3n":"Estimate",quoted:t==="es"?"T. Ofertado":"Quoted",log:t==="es"?"Registrar":"Log Time"},y=t==="es";return jsxs("div",{className:u("w-56",n),style:{background:a?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:a?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:"8px",boxShadow:a?"0 8px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.05)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)"},onClick:w=>w.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between px-3 py-2",style:{borderBottom:a?"1px solid rgba(255,255,255,0.06)":"1px solid #F3F4F6"},children:[jsxs("div",{className:"flex items-center gap-1.5",children:[jsx(Clock,{className:"w-3 h-3",style:{color:a?"#007FFF":"#2E94FF"}}),jsx("span",{className:"font-mono uppercase tracking-wider",style:{fontSize:"10px",fontWeight:600,color:a?"rgba(255,255,255,0.5)":"#6B7280"},children:f[e]})]}),jsx("button",{type:"button",onClick:s,className:"p-0.5 rounded transition-colors",style:{color:a?"rgba(255,255,255,0.3)":"#9CA3AF"},children:jsx(X,{className:"w-3 h-3"})})]}),jsxs("div",{className:"p-3 space-y-2",children:[jsx("input",{ref:g,type:"text",value:i,onChange:w=>c(w.target.value),onKeyDown:v,placeholder:"2h 30m",className:"w-full font-mono outline-none",style:{fontSize:"13px",fontWeight:700,padding:"6px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"#FFFFFF":"#111827"}}),jsx("p",{className:"font-mono",style:{fontSize:"9px",color:a?"rgba(255,255,255,0.25)":"#9CA3AF",letterSpacing:"0.02em"},children:"8=8h \xB7 1h 30m \xB7 45m \xB7 =8*9"}),e==="log"&&jsx("input",{type:"text",value:l,onChange:w=>p(w.target.value),onKeyDown:v,placeholder:y?"Nota (opcional)":"Note (optional)",className:"w-full outline-none",style:{fontSize:"11px",padding:"5px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"rgba(255,255,255,0.7)":"#374151"}}),jsx("button",{type:"button",onClick:b,disabled:d||!i.trim(),className:"w-full font-mono uppercase tracking-wider transition-all disabled:opacity-30 disabled:cursor-not-allowed",style:{fontSize:"10px",fontWeight:600,padding:"6px 0",borderRadius:"4px",border:a?"1px solid rgba(0,127,255,0.3)":"1px solid #2E94FF",background:a?"rgba(0,127,255,0.15)":"#2E94FF",color:a?"#007FFF":"#FFFFFF"},children:d?y?"Guardando...":"Saving...":y?"Registrar":"Save"}),r&&e!=="log"&&jsx("button",{type:"button",onClick:h,disabled:d,className:"w-full font-mono uppercase tracking-wider transition-colors",style:{fontSize:"9px",padding:"4px 0",color:a?"rgba(255,255,255,0.3)":"#9CA3AF"},children:y?"Quitar":"Clear"})]})]})}function Lb(e){switch(e){case "on-track":return "bg-green-500";case "at-risk":return "bg-yellow-500";case "over-budget":return "bg-red-500";case "no-estimate":default:return "bg-gray-400"}}function Ib(e){switch(e){case "on-track":return "text-green-600 dark:text-green-400";case "at-risk":return "text-yellow-600 dark:text-yellow-400";case "over-budget":return "text-red-600 dark:text-red-400";case "no-estimate":default:return "text-gray-500 dark:text-gray-400"}}function wl({summary:e,showLabel:t=false,size:a="md",className:r}){let o=Lb(e.health),s=Ib(e.health),n={sm:"h-1",md:"h-1.5",lg:"h-2"},i=e.progressPercent??0,c=Math.min(100,i),l=i>100;return e.health==="no-estimate"?jsxs("div",{className:u("flex items-center gap-2",r),children:[jsx("div",{className:u("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",n[a]),children:jsx("div",{className:u("h-full w-1/4",o)})}),t&&jsx("span",{className:u("text-xs font-medium",s),children:"--"})]}):jsxs("div",{className:u("flex items-center gap-2",r),children:[jsxs("div",{className:u("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",n[a]),children:[jsx("div",{className:u("h-full transition-all duration-300",o),style:{width:`${c}%`}}),l&&jsx("div",{className:"absolute inset-0 bg-red-500",style:{backgroundImage:"repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(255,255,255,0.2) 2px, rgba(255,255,255,0.2) 4px)"}})]}),t&&jsxs("span",{className:u("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[i,"%"]})]})}function on(e){if(e<1)return `${Math.round(e*60)}s`;let t=Math.round(e);if(t<60)return `${t}m`;let a=Math.floor(t/60),r=t%60;return r===0?`${a}h`:`${a}h ${r}m`}function Rb(e,t){switch(e){case "profitable":return t?"text-green-400":"text-green-600";case "at-cost":return t?"text-blue-400":"text-blue-600";case "loss":return t?"text-red-400":"text-red-600";case "no-estimate":return t?"text-gray-500":"text-gray-400"}}function Ob(e,t){switch(e){case "profitable":return t?"bg-green-900/30 border-green-700/50":"bg-green-50 border-green-200";case "at-cost":return t?"bg-blue-900/30 border-blue-700/50":"bg-blue-50 border-blue-200";case "loss":return t?"bg-red-900/30 border-red-700/50":"bg-red-50 border-red-200";case "no-estimate":return t?"bg-gray-800/50 border-gray-700":"bg-gray-50 border-gray-200"}}function $b(e,t){if(t==="es")switch(e){case "profitable":return "Rentable";case "at-cost":return "En costo";case "loss":return "P\xE9rdida";case "no-estimate":return "Sin oferta"}switch(e){case "profitable":return "Profitable";case "at-cost":return "At Cost";case "loss":return "Loss";case "no-estimate":return "No Estimate"}}function Hb({summary:e,locale:t,isDark:a}){let r=e.totalVarianceMinutes>0,o=r?a?"text-green-400":"text-green-600":e.totalVarianceMinutes<0?a?"text-red-400":"text-red-600":a?"text-gray-400":"text-gray-600",s=a?"bg-[#1A1D25]":"bg-white",n=a?"border-white/5":"border-gray-200",i=a?"text-[#9CA3AF]":"text-gray-500",c=a?"text-[#E5E7EB]":"text-gray-900";return jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-6",children:[jsxs("div",{className:u("p-4 rounded-lg border",s,n),children:[jsx("div",{className:u("text-sm font-medium mb-1",i),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxs("div",{className:u("text-2xl font-bold",o),children:[r?"+":"",on(Math.abs(e.totalVarianceMinutes))]}),jsxs("div",{className:u("text-xs mt-1",i),children:[e.avgVariancePercent>0?"+":"",e.avgVariancePercent,"%"]})]}),jsxs("div",{className:u("p-4 rounded-lg border",s,n),children:[jsx("div",{className:u("text-sm font-medium mb-2",i),children:t==="es"?"Distribuci\xF3n":"Distribution"}),jsxs("div",{className:"space-y-1 text-sm",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-green-400":"text-green-600",children:t==="es"?"Rentables":"Profitable"}),jsx("span",{className:u("font-medium",c),children:e.profitableTasksCount})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-blue-400":"text-blue-600",children:t==="es"?"En costo":"At Cost"}),jsx("span",{className:u("font-medium",c),children:e.atCostTasksCount})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-red-400":"text-red-600",children:t==="es"?"P\xE9rdidas":"Loss"}),jsx("span",{className:u("font-medium",c),children:e.lossTasksCount})]})]})]}),jsxs("div",{className:u("p-4 rounded-lg border",s,n),children:[jsx("div",{className:u("text-sm font-medium mb-2",i),children:t==="es"?"Tiempos":"Time Summary"}),jsxs("div",{className:"space-y-1 text-sm",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:i,children:t==="es"?"Ofertado":"Sold"}),jsx("span",{className:u("font-medium",c),children:on(e.totalSoldMinutes)})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:i,children:t==="es"?"Trabajado":"Logged"}),jsx("span",{className:u("font-medium",c),children:on(e.totalLoggedMinutes)})]}),jsxs("div",{className:u("flex justify-between pt-1 border-t",n),children:[jsx("span",{className:i,children:t==="es"?"Tareas":"Tasks"}),jsx("span",{className:u("font-medium",c),children:e.totalTasksWithEstimate})]})]})]})]})}function zb({task:e,locale:t,isDark:a,onClick:r}){let o=e.varianceMinutes!==null?e.varianceMinutes>0?"+":e.varianceMinutes<0?"-":"":"",s=a?"border-white/5":"border-gray-200",n=a?"text-[#E5E7EB]":"text-gray-900",i=a?"text-[#9CA3AF]":"text-gray-500";return jsxs("tr",{className:u("border-b",s,r&&u("cursor-pointer",a?"hover:bg-white/5":"hover:bg-gray-50")),onClick:()=>r?.(e.taskId),children:[jsxs("td",{className:"px-4 py-3",children:[jsx("div",{className:u("font-medium",n),children:e.taskName}),e.projectName&&jsx("div",{className:u("text-xs mt-1",i),children:e.projectName})]}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?on(e.soldEffortMinutes):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:on(e.loggedMinutes)}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.varianceMinutes!==null?jsxs("span",{className:u("font-medium",e.varianceMinutes>0?a?"text-green-400":"text-green-600":e.varianceMinutes<0?a?"text-red-400":"text-red-600":i),children:[o,on(Math.abs(e.varianceMinutes))]}):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.variancePercent!==null?jsxs("span",{className:u("font-medium",e.variancePercent>0?a?"text-green-400":"text-green-600":e.variancePercent<0?a?"text-red-400":"text-red-600":i),children:[o,Math.abs(e.variancePercent),"%"]}):"-"}),jsx("td",{className:"px-4 py-3 text-center",children:jsx("span",{className:u("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",Ob(e.status,a),Rb(e.status,a)),children:$b(e.status,t)})})]})}function kl({report:e,isLoading:t=false,locale:a="en",theme:r="light",className:o,onTaskClick:s}){let n=r==="dark",i=n?"bg-[#050505]":"bg-gray-50",c=n?"bg-[#0A0A0A]":"bg-white",l=n?"border-white/[0.08]":"border-gray-200",p=n?"text-white/[0.92]":"text-gray-900",d=n?"text-white/[0.60]":"text-gray-500",m=n?"bg-[#050505]/50":"bg-gray-50",g=useMemo(()=>e?[...e.tasks].sort((b,h)=>b.varianceMinutes===null?1:h.varianceMinutes===null?-1:h.varianceMinutes-b.varianceMinutes):[],[e]);return t?jsx("div",{className:u("p-8 text-center",d,o),children:a==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsx("div",{className:u("p-8 text-center",d,o),children:a==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxs("div",{className:u("space-y-6 p-6",i,o),children:[jsx("div",{className:"flex items-center justify-between",children:jsxs("div",{children:[jsx("h2",{className:u("text-2xl font-bold",p),children:a==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsx("p",{className:u("text-sm mt-1",d),children:a==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsx(Hb,{summary:e.summary,locale:a,isDark:n}),jsx("div",{className:u("rounded-lg border overflow-hidden",c,l),children:jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-white/5",children:[jsx("thead",{className:m,children:jsxs("tr",{children:[jsx("th",{className:u("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Tarea":"Task"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Ofertado":"Sold"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Trabajado":"Logged"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Variaci\xF3n":"Variance"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:"%"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Estado":"Status"})]})}),jsx("tbody",{className:u("divide-y",l),children:g.map(b=>jsx(zb,{task:b,locale:a,isDark:n,onClick:s},b.taskId))})]})})}),jsx("div",{className:u("text-xs text-center",d),children:a==="es"?jsx(Fragment,{children:"Rentable: variaci\xF3n > +5% | En costo: \xB15% | P\xE9rdida: variaci\xF3n < -5%"}):jsx(Fragment,{children:"Profitable: variance > +5% | At cost: \xB15% | Loss: variance < -5%"})})]})}function nn(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function eh(e){let t=Math.floor(e/3600),a=Math.floor(e%3600/60),r=e%60;return t>0?`${t.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`:`${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`}function ju(e,t=[]){if("title"in e&&!("name"in e)){let a=e,r=(a.assignedUserIds||[]).map(o=>{let s=t.find(n=>n.id===o);return s||null}).filter(o=>o!==null);return {id:a.id,name:a.title,startDate:a.startDate?new Date(a.startDate):void 0,endDate:a.endDate?new Date(a.endDate):void 0,progress:a.progress||0,status:a.columnId,priority:a.priority?.toLowerCase(),assignees:r,dependencies:Array.isArray(a.dependencies)?a.dependencies.map(o=>typeof o=="string"?o:o.taskId):[],tags:a.tags,subtasks:a.subtasks?.map(o=>({id:o.id,name:o.title,progress:o.completed?100:0,startDate:new Date,endDate:new Date})),color:a.color,description:a.description,effortMinutes:a.effortMinutes,timeLoggedMinutes:a.timeLoggedMinutes,soldEffortMinutes:a.soldEffortMinutes}}return e}function th(e,t){return {...t,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,priority:e.priority?.toUpperCase(),tags:e.tags,description:e.description,color:e.color,columnId:e.status,assignedUserIds:t.assignedUserIds,dependencies:e.dependencies}}function qr({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:i=[],availableTags:c=[],onCreateTag:l,attachments:p=[],onUploadAttachments:d,onDeleteAttachment:m,availableTasks:g=[],comments:b=[],onAddComment:h,currentUser:v,mentionableUsers:f=[],onUploadCommentAttachments:y,enableTimeTracking:w=false,timeTrackingSummary:x,timeEntries:T=[],isTimerRunning:k=false,timerElapsedSeconds:S=0,onTimeLog:C,onEstimateUpdate:I,onSoldEffortUpdate:$,onTimerStart:A,onTimerStop:_,onTimerDiscard:E,blurFinancials:me=false}){let L=s==="dark",X$1={textTertiary:L?"#6B7280":"#9CA3AF",textSecondary:L?"#9CA3AF":"#6B7280",textPrimary:L?"#FFFFFF":"#111827",borderLight:L?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:L?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:L?"#1A1D25":"#FFFFFF",bgSecondary:L?"#0A0A0A":"#F9FAFB",hoverBg:L?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},ee=e&&"title"in e&&!("name"in e),ze=e,[O,j]=useState(e?ju(e,i):null),[he,je]=useState(false),[U,oe]=useState(false),[te,Fe]=useState(false),[we,Re]=useState(null),[Ue,Qe]=useState(new Date),[ae,tt]=useState(false),[pe,at]=useState(false),[mt,Ft]=useState(""),[Te,rt]=useState(false),[lt,Ze]=useState(false),[H,de]=useState(false),[N,Y]=useState(false),[ie,ke]=useState(""),V=useRef(null),re=useRef(null),[Ve,De]=useState(""),We=useRef(null),[Ne,Ke]=useState(""),[ht,dt]=useState(false),[nt,et]=useState([]),[Lt,Pt]=useState(""),[gt,vt]=useState(false),ft=useRef(null);useEffect(()=>{if(console.log("\u{1F4E5} TaskDetailModal useEffect - task received:",{isOpen:t,taskId:e?.id,taskName:e?.name,soldEffortMinutes:e?.soldEffortMinutes,quotedMinutes:e?.quotedMinutes,effortMinutes:e?.effortMinutes,timeLoggedMinutes:e?.timeLoggedMinutes,fullTask:e}),e&&t){let D=ju(e,i);console.log("\u{1F4E5} After normalizeToTask:",{taskId:D?.id,taskName:D?.name,soldEffortMinutes:D?.soldEffortMinutes,quotedMinutes:D?.quotedMinutes,effortMinutes:D?.effortMinutes,timeLoggedMinutes:D?.timeLoggedMinutes}),j(D),ke(D.description||""),De(D.name||"");}},[e?.id,e?.quotedMinutes,i,t]),useEffect(()=>{if(!t||!ie)return;let D=setTimeout(()=>{let Q=re.current;Q&&(Q.style.height="auto",Q.style.height=`${Math.max(100,Q.scrollHeight)}px`);},50);return ()=>clearTimeout(D)},[t,ie]),useEffect(()=>()=>{V.current&&clearTimeout(V.current),We.current&&clearTimeout(We.current);},[]),useEffect(()=>{t&&ft.current&&b.length>0&&setTimeout(()=>{ft.current&&(ft.current.scrollTop=ft.current.scrollHeight);},100);},[t,b.length]);let At=useCallback(D=>{j(D),ee&&o&&ze?o(th(D,ze)):r&&r(D);},[ee,ze,o,r]),Ge=useCallback(()=>{je(false),oe(false),Fe(false),Re(null),at(false),Ft(""),rt(false);},[]),Oe=useCallback((D,Q)=>{if(!O)return;let Ce={...O,[D]:Q};At(Ce);},[O,At]),pt=useCallback(()=>{let D=re.current;D&&(D.style.height="auto",D.style.height=`${Math.max(100,D.scrollHeight)}px`);},[]),le=useCallback(D=>{ke(D),setTimeout(pt,0),V.current&&clearTimeout(V.current),V.current=setTimeout(()=>{if(O){let Q={...O,description:D};At(Q);}},800);},[O,At,pt]),fe=useCallback(D=>{De(D),We.current&&clearTimeout(We.current),We.current=setTimeout(()=>{if(O&&D.trim()){let Q={...O,name:D.trim()};At(Q);}},800);},[O,At]),P=useCallback(D=>{let Q=D.map(Ce=>{let Ee={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:Ce};return Ce.type.startsWith("image/")&&(Ee.preview=URL.createObjectURL(Ce)),Ee});et(Ce=>[...Ce,...Q]);},[]),K=useCallback(D=>{et(Q=>{let Ce=Q.find(Ee=>Ee.id===D);return Ce?.preview&&URL.revokeObjectURL(Ce.preview),Q.filter(Ee=>Ee.id!==D)});},[]),q=useCallback(async()=>{if(!(!O||!Ne.trim()&&nt.length===0||!h)){dt(true);try{let D=Eu(Ne,f),Q=[];if(nt.length>0&&y){let Ce=nt.map(Ee=>Ee.file);Q=await y(Ce);}await h(O.id,Ne.trim(),D.length>0?D:void 0,Q.length>0?Q:void 0),Ke(""),nt.forEach(Ce=>{Ce.preview&&URL.revokeObjectURL(Ce.preview);}),et([]);}finally{dt(false);}}},[O,Ne,nt,h,f,y]),ce=useCallback(()=>{if(!O||!Lt.trim())return;let D=O.subtasks||[],Q={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:Lt.trim(),progress:0,startDate:new Date,endDate:new Date,position:D.length},Ce=[...D,Q],Ee={...O,subtasks:Ce};At(Ee),Pt(""),vt(false);},[O,Lt,At]),Se=useCallback(D=>{if(!O?.subtasks)return;let Q=O.subtasks.map(Ee=>Ee.id===D?{...Ee,progress:Ee.progress===100?0:100}:Ee),Ce={...O,subtasks:Q};At(Ce);},[O,At]),Xe=useCallback(D=>{if(!O?.subtasks)return;let Q=O.subtasks.filter(Ee=>Ee.id!==D),Ce={...O,subtasks:Q};At(Ce);},[O,At]),_e=useCallback(D=>{let Q=typeof D=="string"?new Date(D):D,Ee=new Date().getTime()-Q.getTime(),yt=Math.floor(Ee/6e4),st=Math.floor(Ee/36e5),ta=Math.floor(Ee/864e5);return yt<1?n==="es"?"Ahora":"Just now":yt<60?n==="es"?`Hace ${yt} min`:`${yt}m ago`:st<24?n==="es"?`Hace ${st}h`:`${st}h ago`:ta<7?n==="es"?`Hace ${ta}d`:`${ta}d ago`:Q.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),Be=useCallback(D=>{if(!O)return;let Q=O.progress||0;D==="completed"?Q=100:D==="in-progress"&&Q===0?Q=10:D==="todo"&&(Q=0);let Ce={...O,status:D,progress:Q};At(Ce),je(false);},[O,At]),M=useCallback((D,Q)=>{if(!O)return;let Ce={...O,startDate:D,endDate:Q};At(Ce);},[O,At]),J=useCallback(()=>{let D=Ue.getFullYear(),Q=Ue.getMonth(),Ce=new Date(D,Q,1),yt=new Date(D,Q+1,0).getDate(),st=Ce.getDay(),ta=[],oa=new Date(D,Q,0).getDate();for(let Ut=st-1;Ut>=0;Ut--)ta.push({date:new Date(D,Q-1,oa-Ut),isCurrentMonth:false});for(let Ut=1;Ut<=yt;Ut++)ta.push({date:new Date(D,Q,Ut),isCurrentMonth:true});let va=42-ta.length;for(let Ut=1;Ut<=va;Ut++)ta.push({date:new Date(D,Q+1,Ut),isCurrentMonth:false});return ta},[Ue]),ye=useCallback(async D=>{if(D.preventDefault(),D.stopPropagation(),de(false),!O||!d)return;let Q=Array.from(D.dataTransfer.files);if(Q.length!==0){Y(true);try{await d(O.id,Q);}finally{Y(false);}}},[O,d]),Ie=useCallback(async D=>{if(!O||!d||!D.target.files)return;let Q=Array.from(D.target.files);if(Q.length!==0){Y(true);try{await d(O.id,Q);}finally{Y(false);}D.target.value="";}},[O,d]),$e=useCallback(D=>{D.preventDefault(),D.stopPropagation(),de(true);},[]),B=useCallback(D=>{D.preventDefault(),D.stopPropagation(),de(false);},[]),z=useCallback(D=>D<1024?`${D} B`:D<1024*1024?`${(D/1024).toFixed(1)} KB`:`${(D/(1024*1024)).toFixed(1)} MB`,[]),ne=useCallback(D=>D.startsWith("image/")?Image:D.includes("pdf")||D.includes("document")?FileText:File,[]);return !t||!O?null:jsx(AnimatePresence,{children:t&&O&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:a,className:"fixed inset-0 bg-black/50 z-40"}),jsxs(motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:u("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",L?"bg-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxs("div",{className:u("px-6 py-3 border-b flex items-center gap-3 h-[49px]",L?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Circle,{className:u("w-4 h-4",L?"text-[#9CA3AF]":"text-gray-500")}),jsxs("span",{className:u("text-xs px-2 py-0.5 rounded",L?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsx("span",{className:u("text-xs font-mono",L?"text-[#6B7280]":"text-gray-400"),children:O.id.slice(0,8)})]}),jsx("div",{className:"flex-1"})]}),jsx("div",{className:"px-6 py-4",children:jsxs("div",{className:"flex items-start gap-3",children:[jsx("button",{onClick:()=>{let D=O.progress===100?0:100,Ce={...O,progress:D,status:D===100?"completed":"todo"};At(Ce);},className:u("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",O.progress===100?"bg-green-500 border-green-500":L?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:O.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("input",{type:"text",value:Ve,onChange:D=>fe(D.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:u("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",O.progress===100?"line-through text-[#6B7280]":L?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400")})]})}),jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CheckCircle2,{className:u("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsx("button",{onClick:()=>{Ge(),je(!he);},className:u("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",O.progress===100||O.status==="completed"?"bg-green-500/20 text-green-400":O.progress&&O.progress>0||O.status==="in-progress"?"bg-blue-500/20 text-blue-400":L?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:O.progress===100||O.status==="completed"?n==="es"?"COMPLETADO":"DONE":O.progress&&O.progress>0||O.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsx(AnimatePresence,{children:he&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>je(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label: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(D=>jsxs("button",{onClick:()=>Be(D.id),className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",O.status===D.id&&(L?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:u("w-2 h-2 rounded-full",D.color)}),jsx("span",{className:L?"text-white":"text-gray-900",children:D.label})]},D.id))})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(User,{className:u("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxs("button",{onClick:()=>{Ge(),Fe(!te);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[O.assignees&&O.assignees.length>0?jsxs("div",{className:"flex items-center gap-1",children:[O.assignees.slice(0,3).map((D,Q)=>jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:D.color||"#8B5CF6"},title:D.name,children:D.initials||D.name.slice(0,2).toUpperCase()},Q)),O.assignees.length>3&&jsxs("span",{className:u("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:["+",O.assignees.length-3]})]}):jsx("span",{className:u("text-sm",L?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsx(ChevronDown,{className:u("w-3 h-3",L?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:te&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Fe(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:i.length>0?i.map(D=>{let Q=O.assignees?.some(Ce=>Ce.name===D.name);return jsxs("button",{onClick:()=>{let Ce=O.assignees||[],Ee;Q?Ee=Ce.filter(yt=>yt.name!==D.name):Ee=[...Ce,D],Oe("assignees",Ee);},className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",Q&&(L?"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:D.color||"#8B5CF6"},children:D.initials||D.name.slice(0,2).toUpperCase()}),jsx("span",{className:u("flex-1",L?"text-white":"text-gray-900"),children:D.name}),Q&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},D.name)}):jsx("div",{className:u("px-3 py-4 text-sm text-center",L?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CalendarDays,{className:u("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxs("button",{onClick:()=>{Re(we?null:"start"),Qe(O.startDate||new Date);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[O.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsx("span",{className:u("mx-1",L?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),O.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsx(AnimatePresence,{children:we&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Re(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:u("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:D=>D.stopPropagation(),children:[jsxs("div",{className:u("w-44 py-2 border-r",L?"border-white/10":"border-gray-200"),children:[(()=>{let D=new Date,Q=new Date(D);Q.setDate(D.getDate()+1);let Ce=new Date(D);Ce.setDate(D.getDate()+((6-D.getDay()+7)%7||7));let Ee=new Date(D);Ee.setDate(D.getDate()+((1-D.getDay()+7)%7||7));let yt=new Date(D);yt.setDate(D.getDate()+(6-D.getDay()+7)%7+7);let st=new Date(D);st.setDate(D.getDate()+14);let ta=new Date(D);return ta.setDate(D.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:D,display:D.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:Q,display:Q.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:Ce,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:Ee,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:yt,display:yt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:st,display:st.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:ta,display:ta.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((va,Ut)=>jsxs("button",{className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",L?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(we==="start"){let pa=O.endDate&&va.date>O.endDate?va.date:O.endDate;M(va.date,pa),Re("end");}else {let pa=O.startDate&&va.date<O.startDate?va.date:O.startDate;M(pa,va.date),Re(null);}},children:[jsx("span",{children:va.label}),jsx("span",{className:u("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:va.display})]},Ut))})(),jsx("div",{className:u("border-t mt-2 pt-2",L?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{M(void 0,void 0),Re(null);},className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",L?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:n==="es"?"Quitar fechas":"Clear dates"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[jsx("div",{className:u("text-xs mb-3 px-2 py-1 rounded",L?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:we==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("span",{className:u("font-medium",L?"text-white":"text-gray-900"),children:Ue.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>Qe(new Date),className:u("p-1 rounded text-sm transition-colors",L?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>Qe(new Date(Ue.getFullYear(),Ue.getMonth()-1)),className:u("p-1 rounded",L?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),jsx("button",{onClick:()=>Qe(new Date(Ue.getFullYear(),Ue.getMonth()+1)),className:u("p-1 rounded",L?"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(D=>jsx("div",{className:u("w-8 h-8 flex items-center justify-center text-xs",L?"text-[#6B7280]":"text-gray-400"),children:D},D))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:J().map((D,Q)=>{let Ce=D.date.toDateString()===new Date().toDateString(),Ee=O.startDate?.toDateString()===D.date.toDateString(),yt=O.endDate?.toDateString()===D.date.toDateString(),st=Ee||yt,ta=O.startDate&&O.endDate&&D.date>=O.startDate&&D.date<=O.endDate;return jsx("button",{onClick:()=>{let oa=new Date(D.date);if(we==="start"){let va=O.endDate&&oa>O.endDate?oa:O.endDate;M(oa,va),Re("end");}else {let va=O.startDate&&oa<O.startDate?oa:O.startDate;M(va,oa),Re(null);}},className:u("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!D.isCurrentMonth&&(L?"text-[#4B5563]":"text-gray-300"),D.isCurrentMonth&&(L?"text-white":"text-gray-900"),Ce&&"ring-2 ring-[#2E94FF]",Ee&&"bg-[#2E94FF] text-white",yt&&!Ee&&"bg-[#7C3AED] text-white",ta&&!st&&(L?"bg-[#7C3AED]/20":"bg-purple-100"),!st&&(L?"hover:bg-white/10":"hover:bg-gray-100")),children:D.date.getDate()},Q)})})]})]})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Flag,{className:u("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsx("button",{onClick:()=>{Ge(),oe(!U);},className:u("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",O.priority==="high"||O.priority==="urgent"?"bg-red-500/20 text-red-400":O.priority==="medium"?"bg-yellow-500/20 text-yellow-400":O.priority==="low"?"bg-green-500/20 text-green-400":L?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:O.priority?O.priority==="high"||O.priority==="urgent"?n==="es"?"Alta":"High":O.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsx(AnimatePresence,{children:U&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>oe(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",L?"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(D=>jsxs("button",{onClick:()=>{Oe("priority",D.id),oe(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",O.priority===D.id&&(L?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:u("w-2 h-2 rounded-full",D.color)}),jsx("span",{className:L?"text-white":"text-gray-900",children:D.label})]},D.id||"none"))})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:u("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsx("span",{className:u("text-sm",L?"text-white":"text-gray-900"),children:O.startDate&&O.endDate?`${Math.ceil((O.endDate.getTime()-O.startDate.getTime())/(1e3*60*60*24))} ${n==="es"?"d\xEDas":"days"}`:n==="es"?"Sin definir":"Not set"})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:u("w-4 h-4 rounded-full border-2",L?"border-[#6B7280]":"border-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[ae?jsx("input",{type:"range",min:"0",max:"100",step:"5",value:O.progress||0,onChange:D=>{let Q=parseInt(D.target.value),Ce=O.status;Q===100?Ce="completed":Q>0?Ce="in-progress":Ce="todo";let Ee={...O,progress:Q,status:Ce};At(Ee);},onBlur:()=>tt(false),className:u("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",L?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#2E94FF] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsx("button",{onClick:()=>tt(true),className:u("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",L?"bg-white/10":"bg-gray-200"),children:jsx("div",{className:u("h-full rounded-full transition-all",O.progress===100?"bg-green-500":"bg-[#2E94FF]"),style:{width:`${O.progress||0}%`}})}),jsxs("span",{className:u("text-sm font-medium min-w-[40px]",L?"text-white":"text-gray-900"),children:[O.progress||0,"%"]})]})]}),w&&jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Hourglass,{className:u("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n estimada":"Estimated duration"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:O.status==="completed"||O.progress===100?jsx("span",{className:u("text-sm px-2 py-0.5 cursor-not-allowed",L?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:x?.estimateMinutes?nn(x.estimateMinutes):n==="es"?"Vac\xEDo":"Empty"}):x?.estimateMinutes?jsx("button",{type:"button",onClick:()=>Ze("estimate"),className:u("text-sm px-2 py-0.5 rounded",L?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:nn(x.estimateMinutes)}):jsx("button",{type:"button",onClick:()=>Ze("estimate"),className:u("text-sm",L?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:lt==="estimate"&&jsx(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsx($r,{mode:"estimate",locale:n,isDark:L,currentValue:x?.estimateMinutes||null,onSave:async D=>{await I?.(O.id,D),Ze(false);},onClose:()=>Ze(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(FileText,{className:u("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Tiempo ofertado":"Quoted time"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:me?jsx("span",{className:u("text-sm select-none blur-[4px] opacity-60 pointer-events-none",L?"text-[#94A3B8]":"text-gray-500"),title:n==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data","aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"}):O.status==="completed"||O.progress===100?jsx("span",{className:u("text-sm px-2 py-0.5 cursor-not-allowed",L?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:O.quotedMinutes?nn(O.quotedMinutes):n==="es"?"Vac\xEDo":"Empty"}):O.quotedMinutes?jsx("button",{type:"button",onClick:()=>Ze("quoted"),className:u("text-sm px-2 py-0.5 rounded",L?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:nn(O.quotedMinutes)}):jsx("button",{type:"button",onClick:()=>Ze("quoted"),className:u("text-sm",L?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:lt==="quoted"&&!me&&jsx(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsx($r,{mode:"quoted",locale:n,isDark:L,currentValue:O.quotedMinutes||null,onSave:async D=>{$?(await $(O.id,D),j(Q=>Q?{...Q,quotedMinutes:D}:null)):Oe("quotedMinutes",D),Ze(false);},onClose:()=>Ze(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Clock,{className:u("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Registrar tiempo":"Track time"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[O.status==="completed"||O.progress===100?jsx("div",{className:u("flex items-center gap-1.5 p-1.5 rounded-full cursor-not-allowed",L?"bg-white/5 text-gray-600":"bg-gray-50 text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:jsx(Play,{className:"w-3.5 h-3.5 fill-current"})}):k?jsxs("button",{type:"button",onClick:()=>_?.(O.id),className:u("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors","bg-red-500/10 text-red-500 hover:bg-red-500/20"),children:[jsx(Square,{className:"w-3.5 h-3.5 fill-current"}),eh(S||0)]}):jsx("button",{type:"button",onClick:()=>A?.(O.id),className:u("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",L?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),title:n==="es"?"Iniciar temporizador":"Start timer",children:jsx(Play,{className:"w-3.5 h-3.5 fill-current"})}),O.status==="completed"||O.progress===100?jsxs("div",{className:u("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",L?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:[jsx(Plus,{className:"w-3.5 h-3.5"}),n==="es"?"Agregar tiempo":"Add time"]}):jsxs("button",{type:"button",onClick:()=>Ze("log"),className:u("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors",L?"text-[#9CA3AF] hover:bg-white/10 hover:text-white":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),children:[jsx(Plus,{className:"w-3.5 h-3.5"}),n==="es"?"Agregar tiempo":"Add time"]}),x&&x.loggedMinutes>0&&jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:u("text-sm font-medium",x.health==="over-budget"?"text-red-500":x.health==="at-risk"?"text-yellow-500":L?"text-white":"text-gray-900"),children:[nn(x.loggedMinutes),x.estimateMinutes&&jsxs("span",{className:u("font-normal",L?"text-[#6B7280]":"text-gray-400"),children:[" / ",nn(x.estimateMinutes)]})]}),x.health!=="no-estimate"&&jsx("div",{className:"w-16 h-1.5 rounded-full overflow-hidden bg-gray-200 dark:bg-gray-700",children:jsx("div",{className:u("h-full rounded-full transition-all",x.health==="over-budget"?"bg-red-500":x.health==="at-risk"?"bg-yellow-500":"bg-green-500"),style:{width:`${Math.min(100,x.progressPercent||0)}%`}})})]})]}),jsx(AnimatePresence,{children:lt==="log"&&jsx(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsx($r,{mode:"log",locale:n,isDark:L,currentValue:null,onSave:async(D,Q)=>{D&&await C?.(O.id,{durationMinutes:D,note:Q,source:"manual"}),Ze(false);},onClose:()=>Ze(false)})})})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Tag,{className:u("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsx(lo,{selectedTags:O.tags||[],availableTags:c,onChange:D=>{Oe("tags",D);},onCreateTag:l,theme:X$1})]}),jsxs("div",{className:"flex items-start gap-3 relative",children:[jsx(Link2,{className:u("w-4 h-4 mt-1.5",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0 mt-1",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxs("div",{className:"flex-1",children:[O.dependencies&&O.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:O.dependencies.map(D=>{let Q=g.find(Ce=>Ce.id===D);return jsxs("span",{className:u("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",L?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[Q?.name||D.slice(0,8),jsx("button",{onClick:()=>{let Ce=(O.dependencies||[]).filter(Ee=>Ee!==D);Oe("dependencies",Ce);},className:u("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsx(X,{className:"w-3 h-3"})})]},D)})}),jsxs("button",{onClick:()=>{Ge(),at(!pe);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{className:u("text-sm",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsx(AnimatePresence,{children:pe&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{at(false),Ft("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsx("div",{className:u("p-2 border-b",L?"border-white/10":"border-gray-200"),children:jsx("input",{type:"text",value:mt,onChange:D=>Ft(D.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:u("w-full px-3 py-2 rounded-md text-sm outline-none",L?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsx("div",{className:"max-h-[240px] overflow-y-auto",children:g.length>0?g.filter(D=>D.id!==O.id).filter(D=>mt===""||D.name.toLowerCase().includes(mt.toLowerCase())).map(D=>{let Q=O.dependencies?.includes(D.id);return jsxs("button",{onClick:()=>{let Ce=O.dependencies||[],Ee;Q?Ee=Ce.filter(yt=>yt!==D.id):Ee=[...Ce,D.id],Oe("dependencies",Ee);},className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",Q&&(L?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:u("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",Q?"bg-blue-500 border-blue-500":L?"border-white/30":"border-gray-300"),children:Q&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:u("block truncate",L?"text-white":"text-gray-900"),children:D.name}),jsx("span",{className:u("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:D.id.slice(0,8)})]})]},D.id)}):jsx("div",{className:u("px-3 py-4 text-sm text-center",L?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Palette,{className:u("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxs("button",{onClick:()=>{Ge(),rt(!Te);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:O.color||"#6366F1"}}),jsx("span",{className:u("text-sm",L?"text-white":"text-gray-900"),children:Lo.find(D=>D.value===O.color)?.name||(n==="es"?"Azul":"Blue")}),jsx(ChevronDown,{className:u("w-3 h-3",L?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:Te&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>rt(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-6 gap-1.5",children:Lo.map(D=>{let Q=O.color===D.value;return jsx("button",{onClick:()=>{Oe("color",D.value),rt(false);},className:u("w-7 h-7 rounded-full flex items-center justify-center transition-all",Q&&"ring-2 ring-offset-2",L?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:D.value,outlineColor:Q?D.value:void 0},title:D.name,children:Q&&jsx(Check,{className:"w-3.5 h-3.5 text-white"})},D.value)})})})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Diamond,{className:u("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",L?"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:O.isMilestone||false,onChange:D=>Oe("isMilestone",D.target.checked),className:u("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",O.isMilestone?"bg-purple-500 border-purple-500":L?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsx("span",{className:u("text-sm",L?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxs("div",{className:u("mt-6 pt-4 border-t",L?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsx(FileText,{className:u("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("h3",{className:u("text-sm font-semibold",L?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsx("textarea",{ref:re,value:ie,onChange:D=>le(D.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:u("w-full min-h-[100px] max-h-[400px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors overflow-y-auto",L?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")})]}),jsxs("div",{className:u("mt-6 pt-4 border-t",L?"border-white/10":"border-gray-200"),children:[jsx("div",{className:"flex items-center justify-between mb-3",children:jsxs("h3",{className:u("text-sm font-semibold",L?"text-white":"text-gray-900"),children:[n==="es"?"Subtareas":"Subtasks",O.subtasks&&O.subtasks.length>0&&jsxs("span",{className:u("ml-2 text-xs font-normal",L?"text-[#6B7280]":"text-gray-400"),children:["(",O.subtasks.filter(D=>D.progress===100).length,"/",O.subtasks.length,")"]})]})}),O.subtasks&&O.subtasks.length>0&&jsx("div",{className:"space-y-2 mb-3",children:[...O.subtasks].sort((D,Q)=>(D.position??0)-(Q.position??0)).map(D=>jsxs("div",{className:u("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",L?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx("button",{onClick:()=>Se(D.id),className:u("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",D.progress===100?"bg-green-500 border-green-500":L?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:D.progress===100&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:u("text-sm flex-1",D.progress===100?"line-through text-[#6B7280]":L?"text-white":"text-gray-900"),children:D.name}),jsx("button",{onClick:()=>Xe(D.id),className:u("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",L?"hover:bg-white/10 text-[#6B7280] hover:text-red-400":"hover:bg-gray-100 text-gray-400 hover:text-red-500"),children:jsx(Trash2,{className:"w-3.5 h-3.5"})})]},D.id))}),gt?jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:Lt,onChange:D=>Pt(D.target.value),onKeyDown:D=>{D.key==="Enter"&&Lt.trim()?ce():D.key==="Escape"&&(vt(false),Pt(""));},placeholder:n==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:u("flex-1 px-3 py-2 rounded-lg text-sm outline-none transition-colors",L?"bg-white/5 border border-white/10 text-white placeholder:text-[#6B7280] focus:border-blue-500/50":"bg-gray-50 border border-gray-200 text-gray-900 placeholder:text-gray-400 focus:border-blue-500")}),jsx("button",{onClick:ce,disabled:!Lt.trim(),className:u("px-3 py-2 rounded-lg text-sm font-medium transition-colors",Lt.trim()?"bg-blue-500 hover:bg-blue-600 text-white":L?"bg-white/5 text-[#6B7280] cursor-not-allowed":"bg-gray-100 text-gray-400 cursor-not-allowed"),children:n==="es"?"Agregar":"Add"}),jsx("button",{onClick:()=>{vt(false),Pt("");},className:u("p-2 rounded-lg transition-colors",L?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:()=>vt(true),className:u("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsx(Plus,{className:"w-4 h-4"}),n==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxs("div",{className:u("mt-6 pt-4 border-t",L?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:u("text-sm font-semibold mb-3",L?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",p.length>0&&jsxs("span",{className:u("ml-2 text-xs font-normal",L?"text-[#6B7280]":"text-gray-400"),children:["(",p.length,")"]})]}),p.length>0&&jsx("div",{className:"space-y-2 mb-4",children:p.map(D=>{let Q=ne(D.type),Ce=D.type.startsWith("image/");return jsxs("div",{className:u("flex items-center gap-3 p-2 rounded-lg group transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[Ce&&D.thumbnailUrl?jsx("img",{src:D.thumbnailUrl,alt:D.name,className:"w-10 h-10 rounded object-cover"}):jsx("div",{className:u("w-10 h-10 rounded flex items-center justify-center",L?"bg-white/10":"bg-gray-200"),children:jsx(Q,{className:u("w-5 h-5",L?"text-[#9CA3AF]":"text-gray-500")})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("a",{href:D.url,target:"_blank",rel:"noopener noreferrer",className:u("text-sm font-medium truncate block hover:underline",L?"text-white":"text-gray-900"),children:D.name}),jsx("p",{className:u("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:z(D.size)})]}),m&&jsx("button",{onClick:()=>m(D.id),className:u("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",L?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:n==="es"?"Eliminar":"Delete",children:jsx(Trash2,{className:"w-4 h-4"})})]},D.id)})}),jsxs("div",{onDragOver:$e,onDragLeave:B,onDrop:ye,className:u("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",H?L?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":L?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",N&&"pointer-events-none opacity-50"),children:[jsx("input",{type:"file",multiple:true,onChange:Ie,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!d||N}),N?jsxs(Fragment,{children:[jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),jsx("p",{className:u("text-sm",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxs(Fragment,{children:[jsx(Upload,{className:u("w-6 h-6 mx-auto mb-2",H?"text-blue-500":L?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:u("text-sm",L?"text-[#9CA3AF]":"text-gray-500"),children:H?n==="es"?"Suelta los archivos aqu\xED":"Drop files here":n==="es"?jsxs(Fragment,{children:["Suelta tus archivos aqu\xED o ",jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxs(Fragment,{children:["Drop your files here or ",jsx("span",{className:"underline",children:"click to upload"})]})}),!d&&jsx("p",{className:u("text-xs mt-1",L?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxs("div",{className:u("w-96 border-l flex flex-col",L?"border-white/[0.08] bg-[#0A0A0A]":"border-gray-200 bg-gray-50"),children:[jsxs("div",{className:u("px-4 py-3 border-b flex items-center justify-between h-[49px]",L?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:u("text-sm font-semibold",L?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",b.length>0&&jsxs("span",{className:u("ml-2 text-xs font-normal",L?"text-[#6B7280]":"text-gray-400"),children:["(",b.length,")"]})]}),jsx("button",{onClick:a,className:u("p-1.5 rounded transition-colors",L?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-5 h-5"})})]}),jsx("style",{children:`
|
|
5
5
|
.activity-comments-scroll::-webkit-scrollbar {
|
|
6
6
|
width: 4px !important;
|
|
7
7
|
}
|
|
@@ -15,8 +15,8 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
15
15
|
.activity-comments-scroll:hover::-webkit-scrollbar-thumb {
|
|
16
16
|
background: ${L?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.15)"} !important;
|
|
17
17
|
}
|
|
18
|
-
`}),jsx("div",{ref:gt,className:u("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",L?"scrollbar-slim":"scrollbar-slim-light"),children:b.length>0?jsx("div",{className:"space-y-4",children:[...b].sort((S,oe)=>{let Te=typeof S.createdAt=="string"?new Date(S.createdAt):S.createdAt,We=typeof oe.createdAt=="string"?new Date(oe.createdAt):oe.createdAt;return Te.getTime()-We.getTime()}).map(S=>jsxs("div",{className:"flex gap-3",children:[jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:S.user?.color||"#8B5CF6"},children:S.user?.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsx("span",{className:u("text-sm font-medium",L?"text-white":"text-gray-900"),children:S.user?.name||(n==="es"?"Usuario":"User")}),jsx("span",{className:u("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:_e(S.createdAt)})]}),jsx("div",{className:u("text-sm",L?"text-[#9CA3AF]":"text-gray-600"),children:jsx(Fu,{content:S.content,theme:s})}),S.attachments&&S.attachments.length>0&&jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:S.attachments.map(oe=>{let Te=oe.type.startsWith("image/");return jsxs("a",{href:oe.url,target:"_blank",rel:"noopener noreferrer",className:u("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[Te?jsx(Image,{className:u("w-4 h-4",L?"text-[#9CA3AF]":"text-gray-500")}):jsx(File,{className:u("w-4 h-4",L?"text-[#9CA3AF]":"text-gray-500")}),jsx("span",{className:u("text-xs truncate max-w-[100px]",L?"text-white":"text-gray-900"),children:oe.name})]},oe.id)})})]})]},S.id))}):jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsx(MessageSquare,{className:u("w-10 h-10 mb-3",L?"text-[#3B4252]":"text-gray-300")}),jsx("p",{className:u("text-sm",L?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsx("div",{className:u("py-4 pl-4 pr-2 border-t",L?"border-white/10":"border-gray-200"),children:jsx(Eu,{value:Ne,onChange:Ke,onSubmit:q,users:f,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!h,isSubmitting:bt,theme:s,locale:n,currentUser:v,enableEmoji:true,enableAttachments:!!y,pendingFiles:nt,onFilesSelect:P,onRemoveFile:K})})]})]})]})})}function Cl(){let[e,t]=useState(()=>dragStore.getState());useEffect(()=>dragStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{dragStore.setState(r);},[]);return [e,a]}function po({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:i,isLoading:c,error:l,children:p,availableTags:d=[],onCreateTag:m,attachmentsByCard:g,onUploadAttachments:b,onDeleteAttachment:h,comments:v,onAddComment:f,currentUser:y,mentionableUsers:w,onTaskOpen:x,onUploadCommentAttachments:C,enableTimeTracking:k,timeTrackingSummary:D,timeEntries:T,timerState:I,onLogTime:$,onUpdateEstimate:A,onUpdateSoldEffort:_,onStartTimer:E,onStopTimer:me,onDiscardTimer:L,blurFinancials:X=false,sidePanel:Z,renderColumnMetrics:He,suppressDetailModal:O=false}){let[j,he]=Cl(),[je,U]=useState(null),[re,ee]=useState(false),Ee=useRef(null),we=useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),Be=o?.theme||"dark",ze=Be==="dark"||Be==="neutral",Qe=ze?"dark":"",te=useCallback((N,Y)=>{t.onCardUpdate?.(N,Y);},[t]),tt=useCallback((N,Y)=>{t.onColumnUpdate?.(N,{title:Y});},[t]),pe=useCallback(N=>{t.onColumnDelete?.(N);},[t]),at=["todo","in-progress","completed"],pt=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),Et=useMemo(()=>{let N=new Map;return e.columns.forEach(Y=>{let ie=Y.cardIds.map(ke=>e.cards.find(V=>V.id===ke)).filter(ke=>ke!==void 0).sort((ke,V)=>ke.position-V.position);N.set(Y.id,ie);}),N},[e.cards,e.columns]);useEffect(()=>{let N=Ee.current;if(!N)return;let Y=ae=>{let Ve=ae.target,De=ae.button===1,Ue=Ve===N||Ve.classList.contains("asakaa-column")&&!Ve.closest(".asakaa-card");(De||ae.button===0&&Ue&&!j.isDragging)&&(ae.preventDefault(),ee(true),we.current={x:ae.clientX,y:ae.clientY,scrollLeft:N.scrollLeft,scrollTop:N.scrollTop},N.style.cursor="grabbing",N.style.userSelect="none");},ie=ae=>{if(!re)return;let Ve=ae.clientX-we.current.x,De=ae.clientY-we.current.y;N.scrollLeft=we.current.scrollLeft-Ve,N.scrollTop=we.current.scrollTop-De;},ke=()=>{re&&(ee(false),N.style.cursor="",N.style.userSelect="");},V=()=>{re&&(ee(false),N.style.cursor="",N.style.userSelect="");};return N.addEventListener("mousedown",Y),document.addEventListener("mousemove",ie),document.addEventListener("mouseup",ke),N.addEventListener("mouseleave",V),()=>{N.removeEventListener("mousedown",Y),document.removeEventListener("mousemove",ie),document.removeEventListener("mouseup",ke),N.removeEventListener("mouseleave",V);}},[re,j.isDragging]);let Ce=useMemo(()=>e.cards.map(N=>({id:N.id,name:N.title,startDate:N.startDate?new Date(N.startDate):void 0,endDate:N.endDate?new Date(N.endDate):void 0,progress:N.progress||0,status:N.columnId,priority:N.priority?.toLowerCase(),dependencies:Array.isArray(N.dependencies)?N.dependencies.map(Y=>typeof Y=="string"?Y:Y.taskId):[]})),[e.cards]),rt=useCallback(N=>{let{active:Y}=N,ie=e.cards.find(ke=>ke.id===Y.id);ie&&he({isDragging:true,draggedCardId:ie.id,sourceColumnId:ie.columnId,targetColumnId:ie.columnId});},[e.cards,he]),it=useCallback(N=>{let{active:Y,over:ie}=N;if(!ie||!e.cards.find(ae=>ae.id===Y.id))return;let V=null;ie.data.current?.type==="column"?V=ie.id:ie.data.current?.type==="card"&&(V=e.cards.find(Ve=>Ve.id===ie.id)?.columnId||null),V&&V!==j.targetColumnId&&he({...j,targetColumnId:V});},[e.cards,j,he]),Ze=useCallback(async N=>{let{active:Y,over:ie}=N;if(he({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!ie)return;let ke=e.cards.find(De=>De.id===Y.id);if(!ke)return;let V,ae;if(ie.data.current?.type==="column"){V=ie.id;let De=Et.get(V)||[];ae=nl(De,0);}else {let De=e.cards.find(Ke=>Ke.id===ie.id);if(!De)return;V=De.columnId;let Ue=Et.get(V)||[],Ne=Ue.findIndex(Ke=>Ke.id===ie.id);ae=nl(Ue,Ne);}let Ve=e.columns.find(De=>De.id===V);if(Ve&&Ve.wipLimit&&Ve.wipLimitType==="hard"){let De=Et.get(V)||[];if(ke.columnId!==V&&De.length>=Ve.wipLimit){t.onWipLimitExceeded?.(Ve,ke);return}}(ke.columnId!==V||ke.position!==ae)&&await t.onCardMove?.(ke.id,V,ae);},[e.cards,e.columns,Et,t,he]),H=useCallback(N=>{O||U(N),a?.(N),x?.(N.id);},[a,x,O]),de=useCallback(N=>{t.onCardUpdate?.(N.id,N),U(N);},[t]);return c?jsx("div",{className:u("asakaa-board",Qe,n),style:i,children:jsx(ph,{columnCount:3})}):l?jsx("div",{className:u("asakaa-board",Qe,n),style:i,children:jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxs("div",{className:"text-center",children:[jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof l=="string"?l:l.message})]})})}):jsxs(ru,{themeName:Be,children:[jsxs("div",{className:u("flex h-full overflow-hidden",Z?"flex-row":""),children:[jsxs(DndContext,{sensors:pt,collisionDetection:closestCorners,onDragStart:rt,onDragOver:it,onDragEnd:Ze,children:[jsxs("div",{ref:Ee,className:u("asakaa-board",Z?"flex-1":"",Qe,n),style:{...i,cursor:re?"grabbing":void 0},"data-theme":Be,children:[e.columns.sort((N,Y)=>N.position-Y.position).map(N=>{let Y=Et.get(N.id)||[],ie=!at.includes(N.id),ke=r?.renderColumnFooter?.(N);return jsxs("div",{className:"asakaa-column-wrapper",children:[jsx(rn,{column:N,cards:Y,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,renderMetrics:He?(V,ae)=>He(V,ae):void 0,onCardClick:H,onCardUpdate:te,onColumnRename:t.onColumnUpdate?tt:void 0,onColumnDelete:t.onColumnDelete?pe:void 0,isDeletable:ie,locale:o?.locale==="es"?"es":"en",availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight}),ke]},N.id)}),p]}),jsx(DragOverlay,{children:j.draggedCardId?jsx(Kr,{card:e.cards.find(N=>N.id===j.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),Z]}),!O&&jsx(qr,{task:je,isOpen:!!je,onClose:()=>U(null),onCardUpdate:de,theme:ze?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:d,onCreateTag:m,attachments:je?g?.get(je.id)||[]:[],onUploadAttachments:b,onDeleteAttachment:h,availableTasks:Ce,comments:v,onAddComment:f,currentUser:y,mentionableUsers:w,onUploadCommentAttachments:C,enableTimeTracking:k,timeTrackingSummary:D,timeEntries:T,isTimerRunning:I?.isRunning,timerElapsedSeconds:I?.elapsedSeconds,onTimeLog:$,onEstimateUpdate:A,onSoldEffortUpdate:_,onTimerStart:E,onTimerStop:me,onTimerDiscard:L,blurFinancials:X})]})}function ph({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 hh={bgGrid:"#050505",bgSecondary:"#0A0A0A",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#007FFF",accentLight:"rgba(0, 127, 255, 0.15)",hoverBg:"rgba(255, 255, 255, 0.04)"},yh={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:"#2E94FF",accentLight:"rgba(59, 130, 246, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},xh={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},vh={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function wh({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=useState(false),i=useRef(null);useEffect(()=>{let l=p=>{i.current&&!i.current.contains(p.target)&&n(false);};return s&&document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[s]);let c=l=>{t(l),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:{background:"linear-gradient(135deg, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 127, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 127, 255, 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((l,p)=>l.position-p.position).map((l,p)=>jsxs(motion.button,{onClick:()=>c(l.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:l.color||a.accent}}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:l.title}),jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[l.cardIds.length," ",l.cardIds.length===1?"tarea":"tareas"]})]})]},l.id))]})})})]})}function kh({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=useState(false),[i,c]=useState(null),l=useRef(null);if(useEffect(()=>{let g=b=>{l.current&&!l.current.contains(b.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[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(g=>g.handler),m=async(g,b)=>{if(b){c(g);try{await b();}catch(h){console.error(`Export ${g} failed:`,h);}finally{c(null),n(false);}}};return jsxs("div",{ref:l,className:"relative",children:[jsxs(motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{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((g,b)=>jsxs(motion.button,{onClick:()=>m(g.id,g.handler),disabled:i!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:b<d.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:b*.03},children:[jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===g.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-4 h-4"})}):g.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:g.label}),jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:g.description})]})]},g.id))})})})]})}function Ch({onClick:e,label:t}){return jsxs(motion.button,{onClick:e,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 127, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 127, 255, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:t})]})}function Nl({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:i,onExportExcel:c,translations:l,toolbarRightContent:p}){let d=r==="dark"?hh:yh,m={...o==="es"?xh:vh,...l},g=n||i||c;return jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:d.bgGrid,borderColor:d.border},children:jsxs("div",{className:"flex items-center gap-3",children:[p&&jsxs(Fragment,{children:[p,jsx("div",{className:"w-px h-5",style:{backgroundColor:d.borderLight}})]}),g&&jsxs(Fragment,{children:[jsx(kh,{theme:d,t:m,onExportCSV:n,onExportJSON:i,onExportExcel:c}),t&&jsx("div",{className:"w-px h-6",style:{backgroundColor:d.borderLight}})]}),t&&(s?jsx(wh,{columns:e,onSelect:t,theme:d,t:m,createTaskLabel:a}):jsx(Ch,{onClick:()=>t(),label:a||m.newTask}))]})})}function Sl({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=useState(false),[i,c]=useState(""),l=useCallback(()=>{let m=i.trim();m&&(e(m),c(""),n(false));},[i,e]),p=useCallback(m=>{m.key==="Enter"?(m.preventDefault(),l()):m.key==="Escape"&&(c(""),n(false));},[l]),d=useCallback(()=>{setTimeout(()=>{i.trim()||n(false);},150);},[i]);return s?jsx("div",{className:u("asakaa-add-column asakaa-add-column--editing",t),children:jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsx("input",{type:"text",value:i,onChange:m=>c(m.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:l,disabled:!i.trim(),className:"asakaa-add-column__submit",type:"button",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsx("button",{onClick:()=>{c(""),n(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsx("div",{className:u("asakaa-add-column",t),children:jsxs("button",{onClick:()=>n(true),disabled:o,className:"asakaa-add-column__button",type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),r]})})}function Io({onSubmit:e,onCancel:t,availableUsers:a=[],isDark:r=true,locale:o="es",defaultDate:s,className:n,dropdownDirection:i="up"}){let[c,l]=useState(""),[p,d]=useState(void 0),[m,g]=useState(null),[b,h]=useState(null),[v,f]=useState(false),[y,w]=useState(false),[x,C]=useState(false),[k,D]=useState(s||new Date),T=useRef(null),I=o==="es",$=i==="up"?"bottom-full mb-1":"top-full mt-1";useEffect(()=>{T.current?.focus();},[]);let A=useCallback(()=>{f(false),w(false),C(false);},[]),_=useCallback(()=>{l(""),d(void 0),g(null),h(null),A(),t();},[t,A]),E=useCallback(()=>{let X=c.trim();if(!X)return;let Z=a.find(O=>O.id===m),He=b||s;e({name:X,priority:p,assignee:Z||void 0,assigneeId:m,startDate:He,endDate:He}),l(""),d(void 0),g(null),h(null),A(),T.current?.focus();},[c,p,m,b,s,a,e,A]),me=useCallback(X=>{X.key==="Enter"&&c.trim()&&(X.preventDefault(),E()),X.key==="Escape"&&_();},[E,_,c]),L=b||s||new Date;return jsxs("div",{className:u("quick-task-create",n),onClick:()=>A(),children:[jsx("div",{className:"p-2.5",children:jsx("input",{ref:T,type:"text",value:c,onChange:X=>l(X.target.value),placeholder:I?"Nombre de la tarea...":"Task name...",className:u("w-full bg-transparent text-sm outline-none font-mono",r?"text-white/90 placeholder:text-white/20":"text-gray-900 placeholder:text-gray-400"),autoFocus:true,onKeyDown:me})}),jsxs("div",{className:u("px-2.5 py-2 flex items-center justify-between border-t",r?"border-white/[0.08]":"border-gray-100"),children:[jsxs("div",{className:"flex items-center gap-1",children:[jsxs("div",{className:"relative",children:[jsx("button",{onClick:X=>{X.stopPropagation(),f(!v),w(false),C(false);},type:"button",className:u("p-1 rounded transition-colors",p?p==="urgent"||p==="high"?"text-red-400 bg-red-500/20":p==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:jsx(Flag,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:v&&jsx(motion.div,{initial:{opacity:0,y:i==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:i==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",$,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[{id:"urgent",label:I?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:I?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:I?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:I?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:I?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(X=>jsxs("button",{onClick:()=>{d(X.id),f(false);},type:"button",className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",p===X.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:u("w-2 h-2 rounded-full",X.color)}),jsx("span",{className:r?"text-white":"text-gray-900",children:X.label})]},X.id||"none"))})})]}),jsxs("div",{className:"relative",children:[jsxs("button",{onClick:X=>{X.stopPropagation(),C(!x),f(false),w(false),D(b||s||new Date);},type:"button",className:u("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors font-mono",b?r?"bg-[#007FFF]/20 text-[#007FFF]":"bg-blue-500/20 text-blue-600":r?"bg-white/5 text-white/30 hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsx(CalendarDays,{className:"w-3 h-3"}),L.toLocaleDateString(I?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsx(AnimatePresence,{children:x&&jsxs(motion.div,{initial:{opacity:0,y:i==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:i==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-xl shadow-2xl overflow-hidden flex",$,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[jsx("div",{className:u("w-40 py-2 border-r",r?"border-white/10":"border-gray-200"),children:(()=>{let X=new Date,Z=new Date(X);Z.setDate(X.getDate()+1);let He=new Date(X);He.setDate(X.getDate()+((6-X.getDay()+7)%7||7));let O=new Date(X);O.setDate(X.getDate()+((1-X.getDay()+7)%7||7));let j=new Date(X);j.setDate(X.getDate()+14);let he=new Date(X);he.setDate(X.getDate()+28);let je=I?"es-ES":"en-US";return [{label:I?"Hoy":"Today",date:X,display:X.toLocaleDateString(je,{weekday:"short"}).slice(0,3)+"."},{label:I?"Ma\xF1ana":"Tomorrow",date:Z,display:Z.toLocaleDateString(je,{weekday:"short"}).slice(0,3)+"."},{label:I?"Este fin de semana":"This weekend",date:He,display:I?"s\xE1b.":"sat."},{label:I?"Pr\xF3xima semana":"Next week",date:O,display:I?"lun.":"mon."},{label:I?"2 semanas":"2 weeks",date:j,display:j.toLocaleDateString(je,{day:"numeric",month:"short"})},{label:I?"4 semanas":"4 weeks",date:he,display:he.toLocaleDateString(je,{day:"numeric",month:"short"})}].map((re,ee)=>jsxs("button",{type:"button",className:u("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",r?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{h(re.date),C(false);},children:[jsx("span",{children:re.label}),jsx("span",{className:u("text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:re.display})]},ee))})()}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("span",{className:u("text-xs font-medium font-mono",r?"text-white":"text-gray-900"),children:k.toLocaleDateString(I?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{type:"button",onClick:()=>D(new Date),className:u("px-1.5 py-0.5 rounded text-[10px] transition-colors font-mono",r?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:I?"Hoy":"Today"}),jsx("button",{type:"button",onClick:()=>D(new Date(k.getFullYear(),k.getMonth()-1)),className:u("p-0.5 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-3.5 h-3.5"})}),jsx("button",{type:"button",onClick:()=>D(new Date(k.getFullYear(),k.getMonth()+1)),className:u("p-0.5 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:(I?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(X=>jsx("div",{className:u("w-6 h-6 flex items-center justify-center text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:X},X))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let X=k.getFullYear(),Z=k.getMonth(),He=new Date(X,Z,1).getDay(),O=new Date(X,Z+1,0).getDate(),j=new Date(X,Z,0).getDate(),he=new Date().toDateString(),je=[];for(let re=He-1;re>=0;re--)je.push({dayNum:j-re,isCurrent:false,date:new Date(X,Z-1,j-re)});for(let re=1;re<=O;re++)je.push({dayNum:re,isCurrent:true,date:new Date(X,Z,re)});let U=42-je.length;for(let re=1;re<=U;re++)je.push({dayNum:re,isCurrent:false,date:new Date(X,Z+1,re)});return je.map((re,ee)=>{let Ee=re.date.toDateString()===he,we=(b||s)?.toDateString()===re.date.toDateString();return jsx("button",{type:"button",className:u("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors font-mono",!re.isCurrent&&(r?"text-white/20":"text-gray-300"),re.isCurrent&&(r?"text-white":"text-gray-900"),Ee&&"ring-1 ring-[#007FFF]",we&&"bg-[#007FFF] text-white",!we&&(r?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{h(re.date),C(false);},children:re.dayNum},ee)})})()})]})]})})]}),jsxs("div",{className:"relative",children:[jsx("button",{onClick:X=>{X.stopPropagation(),w(!y),f(false),C(false);},type:"button",className:u("p-1 rounded transition-colors",m?"text-[#007FFF] bg-[#007FFF]/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:m?jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-mono font-bold",style:{backgroundColor:a.find(X=>X.id===m)?.color||"#007FFF"},children:a.find(X=>X.id===m)?.initials||a.find(X=>X.id===m)?.name?.slice(0,2).toUpperCase()}):jsx(User,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:y&&jsxs(motion.div,{initial:{opacity:0,y:i==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:i==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",$,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[jsxs("button",{type:"button",onClick:()=>{g(null),w(false);},className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",!m&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:u("w-5 h-5 rounded-full flex items-center justify-center",r?"bg-white/10":"bg-gray-200"),children:jsx(User,{className:"w-3 h-3 text-gray-400"})}),jsx("span",{className:r?"text-white/40":"text-gray-500",children:I?"Sin asignar":"Unassigned"})]}),a.map(X=>jsxs("button",{type:"button",onClick:()=>{g(X.id),w(false);},className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",m===X.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-white text-[9px] font-mono font-bold",style:{backgroundColor:X.color||"#007FFF"},children:X.initials||X.name?.slice(0,2).toUpperCase()}),jsx("span",{className:r?"text-white":"text-gray-900",children:X.name})]},X.id)),a.length===0&&jsx("div",{className:u("px-3 py-2 text-xs font-mono",r?"text-white/30":"text-gray-400"),children:I?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsx("button",{onClick:E,disabled:!c.trim(),type:"button",className:u("px-2.5 py-1 rounded text-xs font-mono font-medium transition-colors",c.trim()?"bg-[#007FFF] hover:bg-[#0066CC] text-white":r?"bg-white/5 text-white/20":"bg-gray-100 text-gray-400"),children:I?"Guardar":"Save"})]})]})}function Al({columnId:e,onAddCard:t,availableUsers:a=[],className:r,buttonLabel:o,disabled:s=false,theme:n="dark",locale:i="es"}){let[c,l]=useState(false),p=useRef(null),d=useRef(null),[m,g]=useState({}),[b,h]=useState(false),v=n==="dark",y={buttonLabel:o||(i==="es"?"Agregar Tarea":"Add Task")};useEffect(()=>{if(!c||!p.current)return;let x=90,C=()=>{let k=p.current.getBoundingClientRect(),T=window.innerHeight-k.bottom<x+8;h(T),g({position:"fixed",...T?{bottom:window.innerHeight-k.top+4}:{top:k.bottom+4},left:k.left,width:k.width,zIndex:9999});};return C(),window.addEventListener("scroll",C,true),window.addEventListener("resize",C),()=>{window.removeEventListener("scroll",C,true),window.removeEventListener("resize",C);}},[c]),useEffect(()=>{if(!c)return;let x=C=>{let k=C.target;d.current&&!d.current.contains(k)&&p.current&&!p.current.contains(k)&&l(false);};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[c]);let w=useCallback(x=>{t({name:x.name,columnId:e,assigneeIds:x.assigneeId?[x.assigneeId]:void 0,startDate:x.startDate,endDate:x.endDate,priority:x.priority});},[t,e]);return jsxs("div",{ref:p,className:u("asakaa-add-card",r),children:[jsxs("button",{onClick:()=>l(!c),disabled:s,className:"asakaa-add-card__button",type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),y.buttonLabel]}),createPortal(jsx(AnimatePresence,{children:c&&jsx(motion.div,{ref:d,initial:{opacity:0,y:b?4:-4,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:b?4:-4,scale:.97},transition:{duration:.12},style:m,className:u("rounded-lg shadow-2xl",v?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08] shadow-[0_8px_32px_rgba(0,0,0,0.6)]":"bg-white border border-gray-200 shadow-xl"),children:jsx(Io,{onSubmit:w,onCancel:()=>l(false),availableUsers:a,isDark:v,locale:i,dropdownDirection:"up"})})}),document.body)]})}var _n=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(po,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let o=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,o?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(o=>`"${o}"`).join(",")).join(`
|
|
19
|
-
`)}async exportToPDF(){throw new Error("PDF export not yet implemented in ViewAdapter")}async exportToPNG(){if(!this.container)throw new Error("View not mounted");let r=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((o,s)=>{r.toBlob(n=>{n?o(n):s(new Error("Failed to create PNG blob"));},"image/png");})}};function ip(e={}){return new _n(e)}var sn=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 Ll(e,t){let a=r=>jsx(sn,{...t,children:jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function Bl({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:i,onOpenAIUsage:c,shortcut:l="k",className:p=""}){let[d,m]=useState(false),[g,b]=useState(""),[h,v]=useState("home"),[f,y]=useState(""),[w,x]=useState("");useEffect(()=>{let T=I=>{(I.metaKey||I.ctrlKey)&&I.key===l&&(I.preventDefault(),m($=>!$)),I.key==="Escape"&&(m(false),v("home"),b(""));};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[l]),useEffect(()=>{d||(v("home"),b(""),y(""),x(""));},[d]);let C=useCallback(()=>{m(false);},[]),k=useCallback(T=>{let[I,$]=T.split(":");switch(I){case "create-card":v("create-card");break;case "create-card-in":y($||"");break;case "navigate":$?(a?.($),C()):v("navigate");break;case "search":r?.(g),C();break;case "priority":v("priority");break;case "set-priority":w&&$&&(o?.(w,$),C());break;case "assign":v("assign");break;case "assign-user":w&&$&&(s?.(w,$),C());break;case "ai":v("ai");break;case "ai-generate-plan":n?.(),C();break;case "ai-predict-risks":i?.(),C();break;case "ai-usage":c?.(),C();break;case "back":v("home");break;}},[g,w,t,a,r,o,s,n,i,c,C]),D=useCallback(()=>{f&&g.trim()&&(t?.(f,g.trim()),C());},[f,g,t,C]);return d?jsx(Ht,{children:jsx("div",{className:"command-palette-overlay",onClick:C,children:jsx("div",{className:`command-palette ${p}`,onClick:T=>T.stopPropagation(),children:jsxs(Command,{value:g,onValueChange:b,label:"Command Menu",children:[jsxs("div",{className:"command-palette-header",children:[jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("circle",{cx:"11",cy:"11",r:"8"}),jsx("path",{d:"m21 21-4.35-4.35"})]}),jsx(Command.Input,{placeholder:h==="create-card"&&f?"Type card title and press Enter...":h==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:T=>{T.key==="Enter"&&h==="create-card"&&f&&D();}}),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."}),h==="home"&&jsxs(Fragment,{children:[jsxs(Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxs(Command.Item,{value:"create-card",onSelect:k,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:k,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:k,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:k,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),jsx("span",{children:"AI Commands"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsx(Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(T=>jsxs(Command.Item,{value:`navigate:${T.id}`,onSelect:k,className:"command-palette-item",children:[jsx("div",{className:"command-palette-item-dot",style:{background:T.priority==="URGENT"?"#EF4444":T.priority==="HIGH"?"#F59E0B":T.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsx("span",{children:T.title}),T.labels&&T.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:T.labels.slice(0,2).map(I=>jsx("span",{className:"command-palette-item-label",children:I},I))})]},T.id))})]}),h==="create-card"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:k,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsx(Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(T=>jsxs(Command.Item,{value:`create-card-in:${T.id}`,onSelect:k,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"})}),jsx("span",{children:T.title}),jsxs("div",{className:"command-palette-item-count",children:[T.cardIds.length," cards"]})]},T.id))})]}),h==="navigate"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:k,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsx(Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(T=>{let I=e.columns.find($=>$.id===T.columnId);return jsxs(Command.Item,{value:`navigate:${T.id}`,onSelect:k,className:"command-palette-item",keywords:[T.title,T.description||"",...T.labels||[]],children:[jsx("div",{className:"command-palette-item-dot",style:{background:T.priority==="URGENT"?"#EF4444":T.priority==="HIGH"?"#F59E0B":T.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsxs("div",{className:"command-palette-item-content",children:[jsx("div",{children:T.title}),jsx("div",{className:"command-palette-item-meta",children:I?.title})]}),T.labels&&T.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:T.labels.slice(0,2).map($=>jsx("span",{className:"command-palette-item-label",children:$},$))})]},T.id)})})]}),h==="ai"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:k,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:k,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:k,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:k,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 cp(e,t,a,r,o){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let n=document.createElement("div");n.id="attachment-lightbox-native",n.className="attachment-lightbox",n.style.cssText=`
|
|
18
|
+
`}),jsx("div",{ref:ft,className:u("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",L?"scrollbar-slim":"scrollbar-slim-light"),children:b.length>0?jsx("div",{className:"space-y-4",children:[...b].sort((D,Q)=>{let Ce=typeof D.createdAt=="string"?new Date(D.createdAt):D.createdAt,Ee=typeof Q.createdAt=="string"?new Date(Q.createdAt):Q.createdAt;return Ce.getTime()-Ee.getTime()}).map(D=>jsxs("div",{className:"flex gap-3",children:[jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:D.user?.color||"#8B5CF6"},children:D.user?.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsx("span",{className:u("text-sm font-medium",L?"text-white":"text-gray-900"),children:D.user?.name||(n==="es"?"Usuario":"User")}),jsx("span",{className:u("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:_e(D.createdAt)})]}),jsx("div",{className:u("text-sm",L?"text-[#9CA3AF]":"text-gray-600"),children:jsx(Mu,{content:D.content,theme:s})}),D.attachments&&D.attachments.length>0&&jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:D.attachments.map(Q=>{let Ce=Q.type.startsWith("image/");return jsxs("a",{href:Q.url,target:"_blank",rel:"noopener noreferrer",className:u("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[Ce?jsx(Image,{className:u("w-4 h-4",L?"text-[#9CA3AF]":"text-gray-500")}):jsx(File,{className:u("w-4 h-4",L?"text-[#9CA3AF]":"text-gray-500")}),jsx("span",{className:u("text-xs truncate max-w-[100px]",L?"text-white":"text-gray-900"),children:Q.name})]},Q.id)})})]})]},D.id))}):jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsx(MessageSquare,{className:u("w-10 h-10 mb-3",L?"text-[#3B4252]":"text-gray-300")}),jsx("p",{className:u("text-sm",L?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsx("div",{className:u("py-4 pl-4 pr-2 border-t",L?"border-white/10":"border-gray-200"),children:jsx(Fu,{value:Ne,onChange:Ke,onSubmit:q,users:f,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!h,isSubmitting:ht,theme:s,locale:n,currentUser:v,enableEmoji:true,enableAttachments:!!y,pendingFiles:nt,onFilesSelect:P,onRemoveFile:K})})]})]})]})})}function Tl(){let[e,t]=useState(()=>dragStore.getState());useEffect(()=>dragStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{dragStore.setState(r);},[]);return [e,a]}function po({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:i,isLoading:c,error:l,children:p,availableTags:d=[],onCreateTag:m,attachmentsByCard:g,onUploadAttachments:b,onDeleteAttachment:h,comments:v,onAddComment:f,currentUser:y,mentionableUsers:w,onTaskOpen:x,onUploadCommentAttachments:T,enableTimeTracking:k,timeTrackingSummary:S,timeEntries:C,timerState:I,onLogTime:$,onUpdateEstimate:A,onUpdateSoldEffort:_,onStartTimer:E,onStopTimer:me,onDiscardTimer:L,blurFinancials:X=false,sidePanel:ee,renderColumnMetrics:ze,suppressDetailModal:O=false}){let[j,he]=Tl(),[je,U]=useState(null),[oe,te]=useState(false),Fe=useRef(null),we=useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),Re=o?.theme||"dark",Ue=Re==="dark"||Re==="neutral",Qe=Ue?"dark":"",ae=useCallback((N,Y)=>{t.onCardUpdate?.(N,Y);},[t]),tt=useCallback((N,Y)=>{t.onColumnUpdate?.(N,{title:Y});},[t]),pe=useCallback(N=>{t.onColumnDelete?.(N);},[t]),at=["todo","in-progress","completed"],mt=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),Ft=useMemo(()=>{let N=new Map;return e.columns.forEach(Y=>{let ie=Y.cardIds.map(ke=>e.cards.find(V=>V.id===ke)).filter(ke=>ke!==void 0).sort((ke,V)=>ke.position-V.position);N.set(Y.id,ie);}),N},[e.cards,e.columns]);useEffect(()=>{let N=Fe.current;if(!N)return;let Y=re=>{let Ve=re.target,De=re.button===1,We=Ve===N||Ve.classList.contains("asakaa-column")&&!Ve.closest(".asakaa-card");(De||re.button===0&&We&&!j.isDragging)&&(re.preventDefault(),te(true),we.current={x:re.clientX,y:re.clientY,scrollLeft:N.scrollLeft,scrollTop:N.scrollTop},N.style.cursor="grabbing",N.style.userSelect="none");},ie=re=>{if(!oe)return;let Ve=re.clientX-we.current.x,De=re.clientY-we.current.y;N.scrollLeft=we.current.scrollLeft-Ve,N.scrollTop=we.current.scrollTop-De;},ke=()=>{oe&&(te(false),N.style.cursor="",N.style.userSelect="");},V=()=>{oe&&(te(false),N.style.cursor="",N.style.userSelect="");};return N.addEventListener("mousedown",Y),document.addEventListener("mousemove",ie),document.addEventListener("mouseup",ke),N.addEventListener("mouseleave",V),()=>{N.removeEventListener("mousedown",Y),document.removeEventListener("mousemove",ie),document.removeEventListener("mouseup",ke),N.removeEventListener("mouseleave",V);}},[oe,j.isDragging]);let Te=useMemo(()=>e.cards.map(N=>({id:N.id,name:N.title,startDate:N.startDate?new Date(N.startDate):void 0,endDate:N.endDate?new Date(N.endDate):void 0,progress:N.progress||0,status:N.columnId,priority:N.priority?.toLowerCase(),dependencies:Array.isArray(N.dependencies)?N.dependencies.map(Y=>typeof Y=="string"?Y:Y.taskId):[]})),[e.cards]),rt=useCallback(N=>{let{active:Y}=N,ie=e.cards.find(ke=>ke.id===Y.id);ie&&he({isDragging:true,draggedCardId:ie.id,sourceColumnId:ie.columnId,targetColumnId:ie.columnId});},[e.cards,he]),lt=useCallback(N=>{let{active:Y,over:ie}=N;if(!ie||!e.cards.find(re=>re.id===Y.id))return;let V=null;ie.data.current?.type==="column"?V=ie.id:ie.data.current?.type==="card"&&(V=e.cards.find(Ve=>Ve.id===ie.id)?.columnId||null),V&&V!==j.targetColumnId&&he({...j,targetColumnId:V});},[e.cards,j,he]),Ze=useCallback(async N=>{let{active:Y,over:ie}=N;if(he({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!ie)return;let ke=e.cards.find(De=>De.id===Y.id);if(!ke)return;let V,re;if(ie.data.current?.type==="column"){V=ie.id;let De=Ft.get(V)||[];re=sl(De,0);}else {let De=e.cards.find(Ke=>Ke.id===ie.id);if(!De)return;V=De.columnId;let We=Ft.get(V)||[],Ne=We.findIndex(Ke=>Ke.id===ie.id);re=sl(We,Ne);}let Ve=e.columns.find(De=>De.id===V);if(Ve&&Ve.wipLimit&&Ve.wipLimitType==="hard"){let De=Ft.get(V)||[];if(ke.columnId!==V&&De.length>=Ve.wipLimit){t.onWipLimitExceeded?.(Ve,ke);return}}(ke.columnId!==V||ke.position!==re)&&await t.onCardMove?.(ke.id,V,re);},[e.cards,e.columns,Ft,t,he]),H=useCallback(N=>{O||U(N),a?.(N),x?.(N.id);},[a,x,O]),de=useCallback(N=>{t.onCardUpdate?.(N.id,N),U(N);},[t]);return c?jsx("div",{className:u("asakaa-board",Qe,n),style:i,children:jsx(mh,{columnCount:3})}):l?jsx("div",{className:u("asakaa-board",Qe,n),style:i,children:jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxs("div",{className:"text-center",children:[jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof l=="string"?l:l.message})]})})}):jsxs(ou,{themeName:Re,children:[jsxs("div",{className:u("flex h-full overflow-hidden",ee?"flex-row":""),children:[jsxs(DndContext,{sensors:mt,collisionDetection:closestCorners,onDragStart:rt,onDragOver:lt,onDragEnd:Ze,children:[jsxs("div",{ref:Fe,className:u("asakaa-board",ee?"flex-1":"",Qe,n),style:{...i,cursor:oe?"grabbing":void 0},"data-theme":Re,children:[e.columns.sort((N,Y)=>N.position-Y.position).map(N=>{let Y=Ft.get(N.id)||[],ie=!at.includes(N.id),ke=r?.renderColumnFooter?.(N);return jsxs("div",{className:"asakaa-column-wrapper",children:[jsx(rn,{column:N,cards:Y,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,renderMetrics:ze?(V,re)=>ze(V,re):void 0,onCardClick:H,onCardUpdate:ae,onColumnRename:t.onColumnUpdate?tt:void 0,onColumnDelete:t.onColumnDelete?pe:void 0,isDeletable:ie,locale:o?.locale==="es"?"es":"en",availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight}),ke]},N.id)}),p]}),jsx(DragOverlay,{children:j.draggedCardId?jsx(Kr,{card:e.cards.find(N=>N.id===j.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),ee]}),!O&&jsx(qr,{task:je,isOpen:!!je,onClose:()=>U(null),onCardUpdate:de,theme:Ue?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:d,onCreateTag:m,attachments:je?g?.get(je.id)||[]:[],onUploadAttachments:b,onDeleteAttachment:h,availableTasks:Te,comments:v,onAddComment:f,currentUser:y,mentionableUsers:w,onUploadCommentAttachments:T,enableTimeTracking:k,timeTrackingSummary:S,timeEntries:C,isTimerRunning:I?.isRunning,timerElapsedSeconds:I?.elapsedSeconds,onTimeLog:$,onEstimateUpdate:A,onSoldEffortUpdate:_,onTimerStart:E,onTimerStop:me,onTimerDiscard:L,blurFinancials:X})]})}function mh({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 yh={bgGrid:"#050505",bgSecondary:"#0A0A0A",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#007FFF",accentLight:"rgba(0, 127, 255, 0.15)",hoverBg:"rgba(255, 255, 255, 0.04)"},xh={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:"#2E94FF",accentLight:"rgba(59, 130, 246, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},vh={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},wh={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function kh({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=useState(false),i=useRef(null);useEffect(()=>{let l=p=>{i.current&&!i.current.contains(p.target)&&n(false);};return s&&document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[s]);let c=l=>{t(l),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:{background:"linear-gradient(135deg, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 127, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 127, 255, 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((l,p)=>l.position-p.position).map((l,p)=>jsxs(motion.button,{onClick:()=>c(l.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:l.color||a.accent}}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:l.title}),jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[l.cardIds.length," ",l.cardIds.length===1?"tarea":"tareas"]})]})]},l.id))]})})})]})}function Ch({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=useState(false),[i,c]=useState(null),l=useRef(null);if(useEffect(()=>{let g=b=>{l.current&&!l.current.contains(b.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[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(g=>g.handler),m=async(g,b)=>{if(b){c(g);try{await b();}catch(h){console.error(`Export ${g} failed:`,h);}finally{c(null),n(false);}}};return jsxs("div",{ref:l,className:"relative",children:[jsxs(motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{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((g,b)=>jsxs(motion.button,{onClick:()=>m(g.id,g.handler),disabled:i!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:b<d.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:b*.03},children:[jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===g.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-4 h-4"})}):g.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:g.label}),jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:g.description})]})]},g.id))})})})]})}function Th({onClick:e,label:t}){return jsxs(motion.button,{onClick:e,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 127, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 127, 255, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:t})]})}function Dl({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:i,onExportExcel:c,translations:l,toolbarRightContent:p}){let d=r==="dark"?yh:xh,m={...o==="es"?vh:wh,...l},g=n||i||c;return jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:d.bgGrid,borderColor:d.border},children:jsxs("div",{className:"flex items-center gap-3",children:[p&&jsxs(Fragment,{children:[p,jsx("div",{className:"w-px h-5",style:{backgroundColor:d.borderLight}})]}),g&&jsxs(Fragment,{children:[jsx(Ch,{theme:d,t:m,onExportCSV:n,onExportJSON:i,onExportExcel:c}),t&&jsx("div",{className:"w-px h-6",style:{backgroundColor:d.borderLight}})]}),t&&(s?jsx(kh,{columns:e,onSelect:t,theme:d,t:m,createTaskLabel:a}):jsx(Th,{onClick:()=>t(),label:a||m.newTask}))]})})}function El({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=useState(false),[i,c]=useState(""),l=useCallback(()=>{let m=i.trim();m&&(e(m),c(""),n(false));},[i,e]),p=useCallback(m=>{m.key==="Enter"?(m.preventDefault(),l()):m.key==="Escape"&&(c(""),n(false));},[l]),d=useCallback(()=>{setTimeout(()=>{i.trim()||n(false);},150);},[i]);return s?jsx("div",{className:u("asakaa-add-column asakaa-add-column--editing",t),children:jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsx("input",{type:"text",value:i,onChange:m=>c(m.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:l,disabled:!i.trim(),className:"asakaa-add-column__submit",type:"button",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsx("button",{onClick:()=>{c(""),n(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsx("div",{className:u("asakaa-add-column",t),children:jsxs("button",{onClick:()=>n(true),disabled:o,className:"asakaa-add-column__button",type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),r]})})}function Io({onSubmit:e,onCancel:t,availableUsers:a=[],isDark:r=true,locale:o="es",defaultDate:s,className:n,dropdownDirection:i="up"}){let[c,l]=useState(""),[p,d]=useState(void 0),[m,g]=useState(null),[b,h]=useState(null),[v,f]=useState(false),[y,w]=useState(false),[x,T]=useState(false),[k,S]=useState(s||new Date),C=useRef(null),I=o==="es",$=i==="up"?"bottom-full mb-1":"top-full mt-1";useEffect(()=>{C.current?.focus();},[]);let A=useCallback(()=>{f(false),w(false),T(false);},[]),_=useCallback(()=>{l(""),d(void 0),g(null),h(null),A(),t();},[t,A]),E=useCallback(()=>{let X=c.trim();if(!X)return;let ee=a.find(O=>O.id===m),ze=b||s;e({name:X,priority:p,assignee:ee||void 0,assigneeId:m,startDate:ze,endDate:ze}),l(""),d(void 0),g(null),h(null),A(),C.current?.focus();},[c,p,m,b,s,a,e,A]),me=useCallback(X=>{X.key==="Enter"&&c.trim()&&(X.preventDefault(),E()),X.key==="Escape"&&_();},[E,_,c]),L=b||s||new Date;return jsxs("div",{className:u("quick-task-create",n),onClick:()=>A(),children:[jsx("div",{className:"p-2.5",children:jsx("input",{ref:C,type:"text",value:c,onChange:X=>l(X.target.value),placeholder:I?"Nombre de la tarea...":"Task name...",className:u("w-full bg-transparent text-sm outline-none font-mono",r?"text-white/90 placeholder:text-white/20":"text-gray-900 placeholder:text-gray-400"),autoFocus:true,onKeyDown:me})}),jsxs("div",{className:u("px-2.5 py-2 flex items-center justify-between border-t",r?"border-white/[0.08]":"border-gray-100"),children:[jsxs("div",{className:"flex items-center gap-1",children:[jsxs("div",{className:"relative",children:[jsx("button",{onClick:X=>{X.stopPropagation(),f(!v),w(false),T(false);},type:"button",className:u("p-1 rounded transition-colors",p?p==="urgent"||p==="high"?"text-red-400 bg-red-500/20":p==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:jsx(Flag,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:v&&jsx(motion.div,{initial:{opacity:0,y:i==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:i==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",$,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[{id:"urgent",label:I?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:I?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:I?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:I?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:I?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(X=>jsxs("button",{onClick:()=>{d(X.id),f(false);},type:"button",className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",p===X.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:u("w-2 h-2 rounded-full",X.color)}),jsx("span",{className:r?"text-white":"text-gray-900",children:X.label})]},X.id||"none"))})})]}),jsxs("div",{className:"relative",children:[jsxs("button",{onClick:X=>{X.stopPropagation(),T(!x),f(false),w(false),S(b||s||new Date);},type:"button",className:u("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors font-mono",b?r?"bg-[#007FFF]/20 text-[#007FFF]":"bg-blue-500/20 text-blue-600":r?"bg-white/5 text-white/30 hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsx(CalendarDays,{className:"w-3 h-3"}),L.toLocaleDateString(I?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsx(AnimatePresence,{children:x&&jsxs(motion.div,{initial:{opacity:0,y:i==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:i==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-xl shadow-2xl overflow-hidden flex",$,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[jsx("div",{className:u("w-40 py-2 border-r",r?"border-white/10":"border-gray-200"),children:(()=>{let X=new Date,ee=new Date(X);ee.setDate(X.getDate()+1);let ze=new Date(X);ze.setDate(X.getDate()+((6-X.getDay()+7)%7||7));let O=new Date(X);O.setDate(X.getDate()+((1-X.getDay()+7)%7||7));let j=new Date(X);j.setDate(X.getDate()+14);let he=new Date(X);he.setDate(X.getDate()+28);let je=I?"es-ES":"en-US";return [{label:I?"Hoy":"Today",date:X,display:X.toLocaleDateString(je,{weekday:"short"}).slice(0,3)+"."},{label:I?"Ma\xF1ana":"Tomorrow",date:ee,display:ee.toLocaleDateString(je,{weekday:"short"}).slice(0,3)+"."},{label:I?"Este fin de semana":"This weekend",date:ze,display:I?"s\xE1b.":"sat."},{label:I?"Pr\xF3xima semana":"Next week",date:O,display:I?"lun.":"mon."},{label:I?"2 semanas":"2 weeks",date:j,display:j.toLocaleDateString(je,{day:"numeric",month:"short"})},{label:I?"4 semanas":"4 weeks",date:he,display:he.toLocaleDateString(je,{day:"numeric",month:"short"})}].map((oe,te)=>jsxs("button",{type:"button",className:u("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",r?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{h(oe.date),T(false);},children:[jsx("span",{children:oe.label}),jsx("span",{className:u("text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:oe.display})]},te))})()}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("span",{className:u("text-xs font-medium font-mono",r?"text-white":"text-gray-900"),children:k.toLocaleDateString(I?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{type:"button",onClick:()=>S(new Date),className:u("px-1.5 py-0.5 rounded text-[10px] transition-colors font-mono",r?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:I?"Hoy":"Today"}),jsx("button",{type:"button",onClick:()=>S(new Date(k.getFullYear(),k.getMonth()-1)),className:u("p-0.5 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-3.5 h-3.5"})}),jsx("button",{type:"button",onClick:()=>S(new Date(k.getFullYear(),k.getMonth()+1)),className:u("p-0.5 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:(I?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(X=>jsx("div",{className:u("w-6 h-6 flex items-center justify-center text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:X},X))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let X=k.getFullYear(),ee=k.getMonth(),ze=new Date(X,ee,1).getDay(),O=new Date(X,ee+1,0).getDate(),j=new Date(X,ee,0).getDate(),he=new Date().toDateString(),je=[];for(let oe=ze-1;oe>=0;oe--)je.push({dayNum:j-oe,isCurrent:false,date:new Date(X,ee-1,j-oe)});for(let oe=1;oe<=O;oe++)je.push({dayNum:oe,isCurrent:true,date:new Date(X,ee,oe)});let U=42-je.length;for(let oe=1;oe<=U;oe++)je.push({dayNum:oe,isCurrent:false,date:new Date(X,ee+1,oe)});return je.map((oe,te)=>{let Fe=oe.date.toDateString()===he,we=(b||s)?.toDateString()===oe.date.toDateString();return jsx("button",{type:"button",className:u("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors font-mono",!oe.isCurrent&&(r?"text-white/20":"text-gray-300"),oe.isCurrent&&(r?"text-white":"text-gray-900"),Fe&&"ring-1 ring-[#007FFF]",we&&"bg-[#007FFF] text-white",!we&&(r?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{h(oe.date),T(false);},children:oe.dayNum},te)})})()})]})]})})]}),jsxs("div",{className:"relative",children:[jsx("button",{onClick:X=>{X.stopPropagation(),w(!y),f(false),T(false);},type:"button",className:u("p-1 rounded transition-colors",m?"text-[#007FFF] bg-[#007FFF]/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:m?jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-mono font-bold",style:{backgroundColor:a.find(X=>X.id===m)?.color||"#007FFF"},children:a.find(X=>X.id===m)?.initials||a.find(X=>X.id===m)?.name?.slice(0,2).toUpperCase()}):jsx(User,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:y&&jsxs(motion.div,{initial:{opacity:0,y:i==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:i==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",$,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[jsxs("button",{type:"button",onClick:()=>{g(null),w(false);},className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",!m&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:u("w-5 h-5 rounded-full flex items-center justify-center",r?"bg-white/10":"bg-gray-200"),children:jsx(User,{className:"w-3 h-3 text-gray-400"})}),jsx("span",{className:r?"text-white/40":"text-gray-500",children:I?"Sin asignar":"Unassigned"})]}),a.map(X=>jsxs("button",{type:"button",onClick:()=>{g(X.id),w(false);},className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",m===X.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-white text-[9px] font-mono font-bold",style:{backgroundColor:X.color||"#007FFF"},children:X.initials||X.name?.slice(0,2).toUpperCase()}),jsx("span",{className:r?"text-white":"text-gray-900",children:X.name})]},X.id)),a.length===0&&jsx("div",{className:u("px-3 py-2 text-xs font-mono",r?"text-white/30":"text-gray-400"),children:I?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsx("button",{onClick:E,disabled:!c.trim(),type:"button",className:u("px-2.5 py-1 rounded text-xs font-mono font-medium transition-colors",c.trim()?"bg-[#007FFF] hover:bg-[#0066CC] text-white":r?"bg-white/5 text-white/20":"bg-gray-100 text-gray-400"),children:I?"Guardar":"Save"})]})]})}function Ll({columnId:e,onAddCard:t,availableUsers:a=[],className:r,buttonLabel:o,disabled:s=false,theme:n="dark",locale:i="es"}){let[c,l]=useState(false),p=useRef(null),d=useRef(null),[m,g]=useState({}),[b,h]=useState(false),v=n==="dark",y={buttonLabel:o||(i==="es"?"Agregar Tarea":"Add Task")};useEffect(()=>{if(!c||!p.current)return;let x=90,T=()=>{let k=p.current.getBoundingClientRect(),C=window.innerHeight-k.bottom<x+8;h(C),g({position:"fixed",...C?{bottom:window.innerHeight-k.top+4}:{top:k.bottom+4},left:k.left,width:k.width,zIndex:9999});};return T(),window.addEventListener("scroll",T,true),window.addEventListener("resize",T),()=>{window.removeEventListener("scroll",T,true),window.removeEventListener("resize",T);}},[c]),useEffect(()=>{if(!c)return;let x=T=>{let k=T.target;d.current&&!d.current.contains(k)&&p.current&&!p.current.contains(k)&&l(false);};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[c]);let w=useCallback(x=>{t({name:x.name,columnId:e,assigneeIds:x.assigneeId?[x.assigneeId]:void 0,startDate:x.startDate,endDate:x.endDate,priority:x.priority});},[t,e]);return jsxs("div",{ref:p,className:u("asakaa-add-card",r),children:[jsxs("button",{onClick:()=>l(!c),disabled:s,className:"asakaa-add-card__button",type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),y.buttonLabel]}),createPortal(jsx(AnimatePresence,{children:c&&jsx(motion.div,{ref:d,initial:{opacity:0,y:b?4:-4,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:b?4:-4,scale:.97},transition:{duration:.12},style:m,className:u("rounded-lg shadow-2xl",v?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08] shadow-[0_8px_32px_rgba(0,0,0,0.6)]":"bg-white border border-gray-200 shadow-xl"),children:jsx(Io,{onSubmit:w,onCancel:()=>l(false),availableUsers:a,isDark:v,locale:i,dropdownDirection:"up"})})}),document.body)]})}var _n=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(po,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let o=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,o?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(o=>`"${o}"`).join(",")).join(`
|
|
19
|
+
`)}async exportToPDF(){throw new Error("PDF export not yet implemented in ViewAdapter")}async exportToPNG(){if(!this.container)throw new Error("View not mounted");let r=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((o,s)=>{r.toBlob(n=>{n?o(n):s(new Error("Failed to create PNG blob"));},"image/png");})}};function lp(e={}){return new _n(e)}var sn=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 Il(e,t){let a=r=>jsx(sn,{...t,children:jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function Rl({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:i,onOpenAIUsage:c,shortcut:l="k",className:p=""}){let[d,m]=useState(false),[g,b]=useState(""),[h,v]=useState("home"),[f,y]=useState(""),[w,x]=useState("");useEffect(()=>{let C=I=>{(I.metaKey||I.ctrlKey)&&I.key===l&&(I.preventDefault(),m($=>!$)),I.key==="Escape"&&(m(false),v("home"),b(""));};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[l]),useEffect(()=>{d||(v("home"),b(""),y(""),x(""));},[d]);let T=useCallback(()=>{m(false);},[]),k=useCallback(C=>{let[I,$]=C.split(":");switch(I){case "create-card":v("create-card");break;case "create-card-in":y($||"");break;case "navigate":$?(a?.($),T()):v("navigate");break;case "search":r?.(g),T();break;case "priority":v("priority");break;case "set-priority":w&&$&&(o?.(w,$),T());break;case "assign":v("assign");break;case "assign-user":w&&$&&(s?.(w,$),T());break;case "ai":v("ai");break;case "ai-generate-plan":n?.(),T();break;case "ai-predict-risks":i?.(),T();break;case "ai-usage":c?.(),T();break;case "back":v("home");break;}},[g,w,t,a,r,o,s,n,i,c,T]),S=useCallback(()=>{f&&g.trim()&&(t?.(f,g.trim()),T());},[f,g,t,T]);return d?jsx(Ht,{children:jsx("div",{className:"command-palette-overlay",onClick:T,children:jsx("div",{className:`command-palette ${p}`,onClick:C=>C.stopPropagation(),children:jsxs(Command,{value:g,onValueChange:b,label:"Command Menu",children:[jsxs("div",{className:"command-palette-header",children:[jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("circle",{cx:"11",cy:"11",r:"8"}),jsx("path",{d:"m21 21-4.35-4.35"})]}),jsx(Command.Input,{placeholder:h==="create-card"&&f?"Type card title and press Enter...":h==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:C=>{C.key==="Enter"&&h==="create-card"&&f&&S();}}),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."}),h==="home"&&jsxs(Fragment,{children:[jsxs(Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxs(Command.Item,{value:"create-card",onSelect:k,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:k,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:k,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:k,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(C=>jsxs(Command.Item,{value:`navigate:${C.id}`,onSelect:k,className:"command-palette-item",children:[jsx("div",{className:"command-palette-item-dot",style:{background:C.priority==="URGENT"?"#EF4444":C.priority==="HIGH"?"#F59E0B":C.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsx("span",{children:C.title}),C.labels&&C.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:C.labels.slice(0,2).map(I=>jsx("span",{className:"command-palette-item-label",children:I},I))})]},C.id))})]}),h==="create-card"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:k,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(C=>jsxs(Command.Item,{value:`create-card-in:${C.id}`,onSelect:k,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:C.title}),jsxs("div",{className:"command-palette-item-count",children:[C.cardIds.length," cards"]})]},C.id))})]}),h==="navigate"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:k,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(C=>{let I=e.columns.find($=>$.id===C.columnId);return jsxs(Command.Item,{value:`navigate:${C.id}`,onSelect:k,className:"command-palette-item",keywords:[C.title,C.description||"",...C.labels||[]],children:[jsx("div",{className:"command-palette-item-dot",style:{background:C.priority==="URGENT"?"#EF4444":C.priority==="HIGH"?"#F59E0B":C.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsxs("div",{className:"command-palette-item-content",children:[jsx("div",{children:C.title}),jsx("div",{className:"command-palette-item-meta",children:I?.title})]}),C.labels&&C.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:C.labels.slice(0,2).map($=>jsx("span",{className:"command-palette-item-label",children:$},$))})]},C.id)})})]}),h==="ai"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:k,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:k,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:k,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:k,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 up(e,t,a,r,o){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let n=document.createElement("div");n.id="attachment-lightbox-native",n.className="attachment-lightbox",n.style.cssText=`
|
|
20
20
|
position: fixed !important;
|
|
21
21
|
inset: 0 !important;
|
|
22
22
|
z-index: 2147483647 !important;
|
|
@@ -82,7 +82,7 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
82
82
|
border: none !important;
|
|
83
83
|
cursor: pointer !important;
|
|
84
84
|
opacity: 0.5 !important;
|
|
85
|
-
`,g.onmouseenter=()=>{g.style.opacity="1";},g.onmouseleave=()=>{g.style.opacity="0.5";},g.onclick=b=>{b.stopPropagation();let h=r<a.length-1?r+1:0;l(),o(h);},n.appendChild(d),n.appendChild(m),n.appendChild(g);}n.appendChild(i),n.appendChild(c),document.body.appendChild(n),setTimeout(()=>{c.style.transition="opacity 0.5s ease",c.style.opacity="0";},2e3);}function $h(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 Hh(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 Ol(e){return e.startsWith("image/")}function Ur({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,i]=useState(false),[c,l]=useState(false),[p,d]=useState(null),m=useRef(null),g=useRef(e);g.current=e;let b=useCallback((T,I)=>{I.preventDefault(),I.stopPropagation();let $=g.current.filter(E=>Ol(E.type)),A=$.findIndex(E=>E.id===T.id),_=E=>{let me=g.current.filter(X=>Ol(X.type)),L=me[E];L&&cp(L.url,L.name,me,E,_);};cp(T.url,T.name,$,A,_);},[]),h=useCallback(T=>{let I=[],$=[];return e.length+T.length>s?($.push(`Maximum ${s} files allowed`),{valid:I,errors:$}):(T.forEach(A=>{if(A.size/1048576>r){$.push(`${A.name} is too large (max ${r}MB)`);return}if(o&&!o.some(E=>A.type.match(E))){$.push(`${A.name} has invalid file type`);return}I.push(A);}),{valid:I,errors:$})},[e.length,s,r,o]),v=useCallback(async T=>{let{valid:I,errors:$}=h(T);if($.length>0){d($.join(", ")),setTimeout(()=>d(null),5e3);return}if(I.length!==0){l(true),d(null);try{await t?.(I);}catch(A){d(A instanceof Error?A.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{l(false);}}},[h,t]),f=useCallback(T=>{T.preventDefault(),T.stopPropagation(),i(true);},[]),y=useCallback(T=>{T.preventDefault(),T.stopPropagation(),i(false);},[]),w=useCallback(T=>{T.preventDefault(),T.stopPropagation();},[]),x=useCallback(T=>{T.preventDefault(),T.stopPropagation(),i(false);let I=Array.from(T.dataTransfer.files);v(I);},[v]),C=useCallback(T=>{let I=T.target.files?Array.from(T.target.files):[];v(I),m.current&&(m.current.value="");},[v]),k=useCallback(()=>{m.current?.click();},[]),D=useCallback(T=>{confirm("Are you sure you want to delete this attachment?")&&a?.(T);},[a]);return jsxs("div",{className:"attachment-uploader",children:[jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${c?"uploading":""}`,onDragEnter:f,onDragLeave:y,onDragOver:w,onDrop:x,onClick:k,children:[jsx("input",{ref:m,type:"file",multiple:true,onChange:C,style:{display:"none"},accept:o?.join(",")}),jsx("div",{className:"attachment-dropzone-content",children:c?jsxs(Fragment,{children:[jsx("div",{className:"attachment-spinner"}),jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxs(Fragment,{children:[jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsx("p",{className:"attachment-dropzone-text",children:n?"Drop files here":"Drag & drop files here"}),jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),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(T=>jsxs("div",{className:"attachment-item",children:[jsx("div",{className:"attachment-preview",children:Ol(T.type)&&T.url?jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:I=>b(T,I),title:"Click to view full size",children:[jsx("img",{src:T.thumbnailUrl||T.url,alt:T.name,className:"attachment-thumbnail"}),jsx("div",{className:"attachment-thumbnail-overlay",children:jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M9 21H3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M21 3L14 10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M3 21L10 14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})]}):jsx("div",{className:"attachment-icon",children:Hh(T.type)})}),jsxs("div",{className:"attachment-info",children:[jsx("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:T.name,children:T.name}),jsxs("div",{className:"attachment-meta",children:[jsx("span",{className:"attachment-size",children:$h(T.size)}),jsx("span",{className:"attachment-separator",children:"\u2022"}),jsx("span",{className:"attachment-date",children:new Date(T.uploadedAt).toLocaleDateString()})]})]}),jsx("button",{onClick:()=>D(T.id),className:"attachment-delete",title:"Delete attachment",type:"button",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},T.id))})]})}function $l({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:i=[],aiInsights:c=[],attachments:l=[],onAddComment:p,onDeleteComment:d,onUploadAttachments:m,onDeleteAttachment:g,onSuggestAssignee:b,onGenerateSubtasks:h,onEstimateEffort:v,currentUserId:f="user-1"}){let[y,w]=useState("details"),[x,C]=useState(false),[k,D]=useState({}),[T,I]=useState(""),[$,A]=useState(false),[_,E]=useState({});if(!t||!e)return null;let me=useCallback(()=>{C(false),D({}),w("details"),I(""),E({}),a();},[a]),L=useCallback(()=>{r&&Object.keys(k).length>0&&(r(e.id,k),D({}),C(false));},[e.id,k,r]),X=useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),me());},[e.id,o,me]),Z=useCallback(()=>{p&&T.trim()&&(p(e.id,T.trim()),I(""));},[e.id,T,p]),He=useCallback(async()=>{if(b){A(true);try{let U=await b(e);E(re=>({...re,assignees:U}));}catch(U){console.error("Failed to suggest assignee:",U);}finally{A(false);}}},[e,b]),O=useCallback(async()=>{if(h){A(true);try{let U=await h(e);E(re=>({...re,subtasks:U}));}catch(U){console.error("Failed to generate subtasks:",U);}finally{A(false);}}},[e,h]),j=useCallback(async()=>{if(v){A(true);try{let U=await v(e);E(re=>({...re,effort:U}));}catch(U){console.error("Failed to estimate effort:",U);}finally{A(false);}}},[e,v]),he={...e,...k},je=s.filter(U=>he.assignedUserIds?.includes(U.id));return jsx(Ht,{children:jsx("div",{className:"card-detail-overlay",onClick:me,children:jsxs("div",{className:"card-detail-modal",onClick:U=>U.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:he.priority==="URGENT"?"#EF4444":he.priority==="HIGH"?"#F59E0B":he.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),x?jsx("input",{type:"text",value:k.title??he.title,onChange:U=>D({...k,title:U.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsx("h2",{className:"card-detail-title",children:he.title})]}),jsxs("div",{className:"card-detail-header-actions",children:[x?jsxs(Fragment,{children:[jsx("button",{onClick:L,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsx("button",{onClick:()=>{C(false),D({});},className:"card-detail-btn",children:"Cancel"})]}):jsxs("button",{onClick:()=>C(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:X,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:me,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:()=>w("details"),className:`card-detail-tab ${y==="details"?"active":""}`,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Details"]}),jsxs("button",{onClick:()=>w("comments"),className:`card-detail-tab ${y==="comments"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",n.length>0&&jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxs("button",{onClick:()=>w("activity"),className:`card-detail-tab ${y==="activity"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",i.length>0&&jsx("span",{className:"card-detail-tab-badge",children:i.length})]}),jsxs("button",{onClick:()=>w("attachments"),className:`card-detail-tab ${y==="attachments"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",l.length>0&&jsx("span",{className:"card-detail-tab-badge",children:l.length})]}),jsxs("button",{onClick:()=>w("ai"),className:`card-detail-tab ${y==="ai"?"active":""}`,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),"AI Insights",jsx("span",{className:"card-detail-tab-badge card-detail-tab-badge-ai",children:"AI"})]})]}),jsxs("div",{className:"card-detail-content",children:[y==="details"&&jsxs("div",{className:"card-detail-details",children:[jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Description"}),x?jsx("textarea",{value:k.description??he.description??"",onChange:U=>D({...k,description:U.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsx("p",{className:"card-detail-text",children:he.description||"No description"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Assigned To"}),x?jsx("select",{multiple:true,value:k.assignedUserIds??he.assignedUserIds??[],onChange:U=>{let re=Array.from(U.target.selectedOptions,ee=>ee.value);D({...k,assignedUserIds:re});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(U=>jsx("option",{value:U.id,children:U.name},U.id))}):jsx("div",{className:"card-detail-users",children:je.length>0?je.map(U=>jsxs("div",{className:"card-detail-user",children:[jsx("div",{className:"card-detail-user-avatar",style:{background:U.color},children:U.initials}),jsx("span",{children:U.name})]},U.id)):jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Priority"}),x?jsxs("select",{value:k.priority??he.priority??"",onChange:U=>D({...k,priority:U.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:he.priority==="URGENT"?"#EF4444":he.priority==="HIGH"?"#F59E0B":he.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsx("span",{children:he.priority||"None"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Labels"}),jsx("div",{className:"card-detail-labels",children:he.labels&&he.labels.length>0?he.labels.map(U=>jsx("span",{className:"card-detail-label-tag",children:U},U)):jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxs("div",{className:"card-detail-section-row",children:[jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Start Date"}),x?jsx("input",{type:"date",value:k.startDate?new Date(k.startDate).toISOString().split("T")[0]:he.startDate?new Date(he.startDate).toISOString().split("T")[0]:"",onChange:U=>D({...k,startDate:U.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:he.startDate?new Date(he.startDate).toLocaleDateString():"Not set"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"End Date"}),x?jsx("input",{type:"date",value:k.endDate?new Date(k.endDate).toISOString().split("T")[0]:he.endDate?new Date(he.endDate).toISOString().split("T")[0]:"",onChange:U=>D({...k,endDate:U.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:he.endDate?new Date(he.endDate).toLocaleDateString():"Not set"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),x?jsx("input",{type:"number",min:"0",step:"0.5",value:k.estimatedTime??he.estimatedTime??"",onChange:U=>D({...k,estimatedTime:U.target.value?parseFloat(U.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsx("span",{className:"card-detail-text",children:he.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:he.dependencies&&he.dependencies.length>0?he.dependencies.map(U=>{let re=typeof U=="string"?U:U.taskId;return jsxs("span",{className:"card-detail-dependency",children:["Card #",re.slice(-4)]},re)}):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:he.createdAt?new Date(he.createdAt).toLocaleString():"Unknown"})]})]}),y==="comments"&&jsxs("div",{className:"card-detail-comments",children:[jsxs("div",{className:"card-detail-comment-form",children:[jsx("textarea",{value:T,onChange:U=>I(U.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsx("button",{onClick:Z,disabled:!T.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(U=>{let re=s.find(ee=>ee.id===U.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:[re&&jsx("div",{className:"card-detail-user-avatar",style:{background:re.color},children:re.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-comment-author-name",children:re?.name||"Unknown"}),jsx("div",{className:"card-detail-comment-time",children:new Date(U.createdAt).toLocaleString()})]})]}),d&&jsx("button",{onClick:()=>d(U.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:U.content})]},U.id)}):jsxs("div",{className:"card-detail-empty-state",children:[jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsx("p",{children:"No comments yet"}),jsx("span",{children:"Be the first to comment"})]})})]}),y==="activity"&&jsx("div",{className:"card-detail-activity",children:i.length>0?jsx("div",{className:"card-detail-activity-list",children:i.map(U=>{let re=s.find(ee=>ee.id===U.userId);return jsxs("div",{className:"card-detail-activity-item",children:[jsxs("div",{className:"card-detail-activity-icon",children:[U.type.includes("CREATED")&&"\u2795",U.type.includes("UPDATED")&&"\u270F\uFE0F",U.type.includes("MOVED")&&"\u27A1\uFE0F",U.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",U.type.includes("COMMENT")&&"\u{1F4AC}",U.type.includes("ASSIGNED")&&"\u{1F464}",U.type.includes("PRIORITY")&&"\u{1F3AF}",U.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",U.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxs("div",{className:"card-detail-activity-content",children:[jsxs("div",{className:"card-detail-activity-text",children:[jsx("strong",{children:re?.name||"Unknown"})," ",U.type.replace(/_/g," ").toLowerCase(),U.newValue&&jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsx("strong",{children:U.newValue})]})]}),jsx("div",{className:"card-detail-activity-time",children:new Date(U.timestamp).toLocaleString()})]})]},U.id)})}):jsxs("div",{className:"card-detail-empty-state",children:[jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),jsx("p",{children:"No activity yet"}),jsx("span",{children:"Activity will appear here"})]})}),y==="attachments"&&jsx("div",{className:"card-detail-attachments",children:jsx(Ur,{cardId:e.id,attachments:l,onUpload:m?U=>m(e.id,U):void 0,onDelete:g,currentUserId:f,maxSizeMB:10,maxFiles:20})}),y==="ai"&&jsxs("div",{className:"card-detail-ai",children:[jsxs("div",{className:"card-detail-ai-actions",children:[jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxs("button",{onClick:He,disabled:$||!b,className:"card-detail-ai-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxs("button",{onClick:O,disabled:$||!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("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),jsx("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),jsx("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),jsx("line",{x1:"3",y1:"6",x2:"3.01",y2:"6"}),jsx("line",{x1:"3",y1:"12",x2:"3.01",y2:"12"}),jsx("line",{x1:"3",y1:"18",x2:"3.01",y2:"18"})]}),"Generate Subtasks"]}),jsxs("button",{onClick:j,disabled:$||!v,className:"card-detail-ai-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),_.assignees&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Assignee Suggestions"}),_.assignees.map((U,re)=>{let ee=s.find(Ee=>Ee.id===U.userId);return jsxs("div",{className:"card-detail-ai-suggestion",children:[ee&&jsx("div",{className:"card-detail-user-avatar",style:{background:ee.color},children:ee.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-ai-suggestion-name",children:ee?.name}),jsx("div",{className:"card-detail-ai-suggestion-reason",children:U.reasoning}),jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(U.confidence*100).toFixed(0),"%"]})]})]},re)})]}),_.subtasks&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Suggested Subtasks"}),_.subtasks.map((U,re)=>jsxs("div",{className:"card-detail-ai-subtask",children:[jsx("div",{className:"card-detail-ai-subtask-title",children:U.title}),U.description&&jsx("div",{className:"card-detail-ai-subtask-desc",children:U.description}),U.estimatedTime&&jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",U.estimatedTime,"h"]})]},re))]}),_.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:[_.effort.hours," hours"]}),jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(_.effort.confidence*100).toFixed(0),"%"]})]})]}),c.length>0&&jsxs("div",{className:"card-detail-ai-insights",children:[jsx("h4",{children:"AI Insights"}),c.map(U=>jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${U.severity.toLowerCase()}`,children:[jsxs("div",{className:"card-detail-ai-insight-header",children:[jsx("span",{className:"card-detail-ai-insight-title",children:U.title}),jsx("span",{className:"card-detail-ai-insight-severity",children:U.severity})]}),jsx("p",{className:"card-detail-ai-insight-desc",children:U.description}),U.suggestedAction&&jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",U.suggestedAction]})]},U.id))]}),!_.assignees&&!_.subtasks&&!_.effort&&c.length===0&&jsxs("div",{className:"card-detail-empty-state",children:[jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),jsx("p",{children:"AI Suggestions"}),jsx("span",{children:"Click a button above to get AI-powered insights"})]})]})]})]})})})}function Kn({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[i,c]=useState({top:0,left:0}),l=useRef(null),p=useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),m=window.innerHeight,g=window.innerWidth,b=4,h=d.left;h+o>g-10&&(h=g-o-10),h<10&&(h=10);let v=m-d.bottom,f=d.top,y;return v>=s+b?y=d.bottom+b:f>=s+b?y=d.top-s-b:v>=f?y=d.bottom+b:y=Math.max(10,d.top-s-b),{top:y,left:h}},[e,o,s]);return useEffect(()=>{t&&c(p());},[t,p]),useEffect(()=>{if(!t)return;let d=g=>{let b=g.target;l.current&&!l.current.contains(b)&&e.current&&!e.current.contains(b)&&a();},m=setTimeout(()=>{document.addEventListener("mousedown",d);},0);return ()=>{clearTimeout(m),document.removeEventListener("mousedown",d);}},[t,a,e]),useEffect(()=>{if(!t)return;let d=m=>{m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),a());};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),t?jsx(Ht,{children:jsx("div",{ref:l,className:`smart-popover ${n}`,style:{position:"fixed",top:`${i.top}px`,left:`${i.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 dt={dark:{bgPrimary:"#050505",bgSecondary:"#0A0A0A",bgGrid:"rgba(255, 255, 255, 0.02)",bgWeekend:"rgba(17, 17, 17, 0.4)",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#2E94FF",accentHover:"#5AADFF",accentLight:"rgba(46, 148, 255, 0.12)",taskBarPrimary:"#2E94FF",taskBarProgress:"#5AADFF",taskBarHandle:"#FFFFFF",dependency:"#444444",dependencyHover:"#FFFFFF",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.15)",today:"#EF4444",todayLight:"rgba(239, 68, 68, 0.08)",milestone:"#FFFFFF",milestoneLight:"rgba(255, 255, 255, 0.1)",statusTodo:"#666666",statusInProgress:"#2E94FF",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.04)",focusRing:"#2E94FF",dotGrid:"rgba(255, 255, 255, 0.05)",glassHeader:"#0A0A0A",glassToolbar:"rgba(0, 0, 0, 0.4)",forecastHud:"rgba(15, 15, 15, 0.9)",neonRedGlow:"0 0 8px rgba(239, 68, 68, 0.25)",executionBarBg:"rgba(46, 148, 255, 0.12)"},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:"#2E94FF",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2E94FF",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"#6B7280",dependencyHover:"#2E94FF",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:"#2E94FF",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2E94FF",dotGrid:"rgba(0, 0, 0, 0.04)",glassHeader:"#F8FAFC",glassToolbar:"rgba(255, 255, 255, 0.85)",forecastHud:"rgba(248, 250, 252, 0.95)",neonRedGlow:"0 0 10px rgba(220, 38, 38, 0.3)",executionBarBg:"rgba(37, 99, 235, 0.28)"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"#78716C",dependencyHover:"#A8A29E",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.06)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.08)",statusTodo:"#78716C",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.035)",focusRing:"#292524",dotGrid:"rgba(0, 0, 0, 0.03)",glassHeader:"#F5F5F4",glassToolbar:"rgba(250, 250, 249, 0.85)",forecastHud:"rgba(245, 245, 244, 0.95)",neonRedGlow:"0 0 10px rgba(68, 64, 60, 0.3)",executionBarBg:"rgba(41, 37, 36, 0.25)"}};var Kh=["LOW","MEDIUM","HIGH","URGENT"],Yh=["todo","in-progress","review","done"];function Ul({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:i=[],onAddComment:c,onDeleteComment:l,currentUser:p,onAIGenerateDescription:d,onAICreateSubtasks:m,onAIFindSimilar:g,availableColumns:b=[],availableLabels:h=[],availableTags:v=[],onCreateTag:f,onUploadCoverImage:y,unsplashAccessKey:w,theme:x,onSubtasksChange:C,attachments:k=[],onUploadAttachments:D,onDeleteAttachment:T}){let I=en(),$=x||I?.themeName||"dark",[A,_]=useState(e),[E,me]=useState(false),[L,X]=useState(()=>[...e?.subtasks||[]].sort((K,q)=>(K.position??0)-(q.position??0))),[Z,He]=useState(false),[O,j]=useState(""),[he,je]=useState(""),[U,re]=useState("all"),[ee,Ee]=useState(false),[we,Be]=useState(false),[ze,Qe]=useState(false),[te,tt]=useState(false),[pe,at]=useState(false),[pt,Et]=useState(false),Ce=useRef(null),rt=useRef(null),it=useRef(null),Ze=useRef(null),H=useRef(null),de=useRef(null),N=useRef(null),Y=useRef(null),ie=useRef(null),ke=useRef(null),V=useRef(null),ae=useRef(null);useEffect(()=>{if(e&&!A){_({...e});let P=[...e.subtasks||[]].sort((K,q)=>(K.position??0)-(q.position??0));X(P);}else if(e&&A&&e.id!==A.id){_({...e});let P=[...e.subtasks||[]].sort((K,q)=>(K.position??0)-(q.position??0));X(P);}},[e,A]),useEffect(()=>{let P=K=>{let q=K.target;Ze.current&&!Ze.current.contains(q)&&Ee(false),H.current&&!H.current.contains(q)&&Be(false),de.current&&!de.current.contains(q)&&Qe(false),N.current&&!N.current.contains(q)&&tt(false);};if(ee||we||ze||te)return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[ee,we,ze,te]),useEffect(()=>{if(!t)return;let P=K=>{let q=K.target,ce=q.tagName==="INPUT"||q.tagName==="TEXTAREA"||q.isContentEditable;if(K.key==="Escape"){K.preventDefault(),ee||we||ze||te||pe||pt?(Ee(false),Be(false),Qe(false),tt(false),at(false),Et(false)):ce||a();return}if(ce&&K.key!=="Escape")return;let Se=K.metaKey||K.ctrlKey;switch(K.key.toLowerCase()){case "s":K.preventDefault(),Ee(true);break;case "a":K.preventDefault(),Qe(true);break;case "p":K.preventDefault(),Be(true);break;case "l":K.preventDefault(),tt(true);break;case "d":Se||(K.preventDefault(),at(true),setTimeout(()=>Y.current?.focus(),0));break;case "e":Se||(K.preventDefault(),Et(true));break;case "i":K.preventDefault(),me(true),setTimeout(()=>rt.current?.focus(),0);break;case "t":K.preventDefault(),He(true);break;case "c":K.preventDefault(),it.current?.focus();break}};return window.addEventListener("keydown",P),()=>window.removeEventListener("keydown",P)},[t,a,ee,we,ze,te,pe,pt]);let Ve=useCallback(P=>{let K=P.currentTarget.textContent?.trim()||"";if(A&&K!==A.title){let q={...A,title:K};_(q),r?.(A.id,{title:K});}},[A,r]),De=useCallback(P=>{P.key==="Enter"&&(P.preventDefault(),P.currentTarget.blur()),P.key==="Escape"&&(P.preventDefault(),P.currentTarget.textContent=A?.title||"",P.currentTarget.blur());},[A]),Ue=useCallback(()=>{A&&e&&A.description!==e.description&&r?.(A.id,{description:A.description}),me(false);},[A,e,r]),Ne=useCallback(P=>{if(A){let K={...A,columnId:P};_(K),r?.(A.id,{columnId:P}),Ee(false);}},[A,r]),Ke=useCallback(P=>{if(A){let K={...A,priority:P};_(K),r?.(A.id,{priority:P}),Be(false);}},[A,r]),bt=useCallback(P=>{if(A){let K=A.assignedUserIds||[],q=K.includes(P)?K.filter(Se=>Se!==P):[...K,P],ce={...A,assignedUserIds:q};_(ce),r?.(A.id,{assignedUserIds:q});}},[A,r]),lt=useCallback(P=>{if(A){let K=A.labels||[],q=K.includes(P)?K.filter(Se=>Se!==P):[...K,P],ce={...A,labels:q};_(ce),r?.(A.id,{labels:q});}},[A,r]),nt=useCallback(P=>{if(A){let K={...A,tags:P};_(K),r?.(A.id,{tags:P});}},[A,r]),et=useCallback(P=>{if(A){let K=P.target.value,q={...A,endDate:K};_(q),r?.(A.id,{endDate:K}),at(false);}},[A,r]),At=useCallback(P=>{if(A){let K={...A,estimatedTime:parseFloat(P)||0};_(K),r?.(A.id,{estimatedTime:parseFloat(P)||0});}},[A,r]),Mt=useCallback(()=>{if(O.trim()&&A){let P={id:`subtask-${Date.now()}`,title:O.trim(),completed:false,position:L.length,createdAt:new Date},K=[...L,P];X(K),j(""),He(false),C?.(A.id,K);}},[O,L,A,C]),mt=useCallback(P=>{let K=L.map(q=>q.id===P?{...q,completed:!q.completed,updatedAt:new Date}:q);X(K),A&&C?.(A.id,K);},[L,A,C]),yt=useCallback(P=>{let K=L.filter(q=>q.id!==P);X(K),A&&C?.(A.id,K);},[L,A,C]),gt=useCallback(()=>{he.trim()&&A&&c&&(c(A.id,he.trim()),je(""));},[he,A,c]),Pt=useCallback(P=>{(P.metaKey||P.ctrlKey)&&P.key==="Enter"&&(P.preventDefault(),gt());},[gt]),Ge=P=>jsx(Gh,{remarkPlugins:[_h],rehypePlugins:[jh],components:{a:({node:K,...q})=>jsx("a",{...q,target:"_blank",rel:"noopener noreferrer"})},children:P}),Re=i.filter(P=>U==="comments"?P.type.includes("COMMENT"):U==="history"?!P.type.includes("COMMENT"):true);if(!t||!e)return null;let ut=A||e,le=s.filter(P=>ut.assignedUserIds?.includes(P.id)),fe=L.filter(P=>P.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:P=>P.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":$,children:[jsxs("header",{className:"modal-v2-header",children:[jsx("h1",{id:"modal-title",ref:Ce,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:Ve,onKeyDown:De,children:ut.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:Ze,children:[jsxs("button",{ref:ie,className:"modal-v2-field",onClick:()=>Ee(!ee),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M12 6v6l4 2"})]}),jsx("span",{children:"Status"}),jsx("kbd",{className:"modal-v2-shortcut",children:"S"})]}),jsx("div",{className:"modal-v2-field-value",children:ut.columnId||"No status"})]}),jsx(Kn,{triggerRef:ie,isOpen:ee,onClose:()=>Ee(false),width:250,estimatedHeight:200,children:(b.length>0?b:Yh.map(P=>({id:P,title:P}))).map(P=>jsx("button",{className:`modal-v2-popover-item ${ut.columnId===P.id?"active":""}`,onClick:()=>Ne(P.id),children:P.title},P.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:de,children:[jsxs("button",{ref:ke,className:"modal-v2-field",onClick:()=>Qe(!ze),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:le.length>0?jsx("div",{className:"modal-v2-avatars",children:le.map(P=>jsx("div",{className:"modal-v2-avatar",style:{background:P.color},title:P.name,children:P.initials},P.id))}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(Kn,{triggerRef:ke,isOpen:ze,onClose:()=>Qe(false),width:280,estimatedHeight:300,children:s.map(P=>jsxs("button",{className:`modal-v2-popover-item ${ut.assignedUserIds?.includes(P.id)?"active":""}`,onClick:()=>bt(P.id),children:[jsx("div",{className:"modal-v2-avatar-small",style:{background:P.color},children:P.initials}),P.name,ut.assignedUserIds?.includes(P.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"})})]},P.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:H,children:[jsxs("button",{ref:V,className:"modal-v2-field",onClick:()=>Be(!we),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:ut.priority||"None"})]}),jsxs(Kn,{triggerRef:V,isOpen:we,onClose:()=>Be(false),width:180,estimatedHeight:220,children:[Kh.map(P=>jsx("button",{className:`modal-v2-popover-item priority-${P.toLowerCase()} ${ut.priority===P?"active":""}`,onClick:()=>Ke(P),children:P},P)),jsx("button",{className:"modal-v2-popover-item",onClick:()=>Ke(""),children:"None"})]})]}),v.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(lo,{selectedTags:ut.tags||[],availableTags:v,onChange:nt,onCreateTag:f,theme:dt[$]||dt.dark})})]})}):jsxs("div",{className:"modal-v2-field-wrapper",ref:N,children:[jsxs("button",{ref:ae,className:"modal-v2-field",onClick:()=>tt(!te),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:ut.labels&&ut.labels.length>0?jsx("span",{children:ut.labels.join(", ")}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(Kn,{triggerRef:ae,isOpen:te,onClose:()=>tt(false),width:220,estimatedHeight:200,children:(h.length>0?h:["Bug","Feature","Enhancement","Documentation"]).map(P=>jsxs("button",{className:`modal-v2-popover-item ${ut.labels?.includes(P)?"active":""}`,onClick:()=>lt(P),children:[P,ut.labels?.includes(P)&&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"})})]},P))})]}),jsxs("button",{className:"modal-v2-field",onClick:()=>{at(!pe),setTimeout(()=>Y.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:ut.endDate?new Date(ut.endDate).toLocaleDateString():"Not set"}),jsx("input",{ref:Y,type:"date",value:typeof ut.endDate=="string"?ut.endDate.split("T")[0]:ut.endDate?(()=>{let P=new Date(ut.endDate),K=P.getUTCFullYear(),q=String(P.getUTCMonth()+1).padStart(2,"0"),ce=String(P.getUTCDate()).padStart(2,"0");return `${K}-${q}-${ce}`})():"",onChange:et,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxs("button",{className:"modal-v2-field",onClick:()=>Et(!pt),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:ut.estimatedTime?`${ut.estimatedTime}h`:"Not set"})]}),pt&&jsx("div",{className:"modal-v2-popover",children:jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:ut.estimatedTime||"",onChange:P=>At(P.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>Et(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"})]}),E?jsx("textarea",{className:"modal-v2-textarea",value:ut.description||"",onChange:P=>{if(A){let K={...A,description:P.target.value};_(K);}},onBlur:Ue,placeholder:"Add a detailed description...",autoFocus:true}):jsx("div",{className:"modal-v2-content",onClick:()=>me(true),children:ut.description?jsx("div",{className:"modal-v2-markdown",children:Ge(ut.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"}),L.length>0&&jsxs("span",{className:"modal-v2-count",children:[fe,"/",L.length]}),jsxs("button",{className:"modal-v2-add-button",onClick:()=>He(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:[L.map(P=>jsxs("div",{className:`modal-v2-subtask ${P.completed?"completed":""}`,children:[jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>mt(P.id),children:P.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:P.title}),jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>yt(P.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"})]})})]},P.id)),Z&&jsx("div",{className:"modal-v2-subtask-input-row",children:jsx("input",{type:"text",placeholder:"Subtask title...",value:O,onChange:P=>j(P.target.value),onKeyDown:P=>{P.key==="Enter"&&Mt(),P.key==="Escape"&&(He(false),j(""));},onBlur:Mt,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(D||k.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"}),k.length>0&&jsx("span",{className:"modal-v2-count",children:k.length})]}),jsx(Ur,{cardId:ut.id,attachments:k,onUpload:D?P=>D(ut.id,P):void 0,onDelete:T,maxSizeMB:10,maxFiles:20})]}),jsxs("section",{className:"modal-v2-section",children:[jsxs("div",{className:"modal-v2-section-header",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsx("h2",{children:"Activity"}),jsxs("div",{className:"modal-v2-filters",children:[jsx("button",{className:`modal-v2-filter ${U==="all"?"active":""}`,onClick:()=>re("all"),children:"All"}),jsx("button",{className:`modal-v2-filter ${U==="comments"?"active":""}`,onClick:()=>re("comments"),children:"Comments"}),jsx("button",{className:`modal-v2-filter ${U==="history"?"active":""}`,onClick:()=>re("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:it,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:he,onChange:P=>je(P.target.value),onKeyDown:Pt,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:gt,disabled:!he.trim(),children:"Send"})]})]})]}),jsxs("div",{className:"modal-v2-timeline",children:[Re.map(P=>{let K=s.find(ce=>ce.id===P.userId);if(P.type.includes("COMMENT")){let ce=n.find(Se=>Se.id===P.metadata?.commentId);return ce?jsxs("div",{className:"modal-v2-activity-item comment-item",children:[K&&jsx("div",{className:"modal-v2-avatar",style:{background:K.color},children:K.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:K?.name||"Unknown"}),jsx("span",{className:"modal-v2-activity-time",children:new Date(P.timestamp).toLocaleString()})]}),jsx("div",{className:"modal-v2-comment-body",children:ce.content})]})]},P.id):null}return jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxs("div",{className:"modal-v2-history-icon",children:[P.type.includes("CREATED")&&"\u2795",P.type.includes("UPDATED")&&"\u270F\uFE0F",P.type.includes("MOVED")&&"\u27A1\uFE0F",P.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",P.type.includes("ASSIGNED")&&"\u{1F464}",P.type.includes("PRIORITY")&&"\u{1F3AF}",P.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:K?.name||"Unknown"})," ",P.type.replace(/_/g," ").toLowerCase(),P.newValue&&jsxs(Fragment,{children:[" to ",jsx("strong",{children:P.newValue})]})]}),jsx("span",{className:"modal-v2-activity-time",children:new Date(P.timestamp).toLocaleString()})]})]},P.id)}),Re.length===0&&jsxs("div",{className:"modal-v2-empty",children:[jsx("p",{children:"No activity yet"}),jsx("span",{children:"Activity will appear here"})]})]})]})]})})})}function ry({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 Vl({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((i,c)=>i+c.completed,0)/e.length}));return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:a,children:jsxs(LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(ry,{})}),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:"#2E94FF",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#2E94FF",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,i)=>n+i.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,i)=>n+i.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:"#2E94FF"},children:e.reduce((n,i)=>n+(i.planned||0),0)})]})]})]})}function py({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 Gl({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,i=e[e.length-1]?.ideal||0,c=s>0?(s-n)/s*100:0,l=n<=i;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(py,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?jsxs(Fragment,{children:[jsx(Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsx(Area,{type:"monotone",dataKey:"remaining",stroke:l?"#10B981":"#EF4444",fill:l?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxs(Fragment,{children:[jsx(Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsx(Line,{type:"monotone",dataKey:"remaining",stroke:l?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:l?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxs("span",{className:"chart-stat-value",style:{color:c>=50?"#10B981":"#F59E0B"},children:[c.toFixed(0),"%"]})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsx("span",{className:"chart-stat-value",style:{color:l?"#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:l?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:l?"#10B981":"#EF4444"},children:l?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var wy={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#2E94FF",LOW:"#10B981"},xp=["#2E94FF","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function ky({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,i=e+n*Math.cos(-a*(Math.PI/180)),c=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsx("text",{x:i,y:c,fill:"white",textAnchor:i>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function vp({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 _l({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((c,l)=>c+l.value,0),n=e.map(c=>({...c,totalValue:s,color:c.color||wy[c.name]||xp[e.indexOf(c)%xp.length]})),i=n.map(c=>c.color);return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxs(PieChart,{children:[jsx(Pie,{data:n,cx:"50%",cy:"50%",labelLine:false,label:o?ky:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((c,l)=>jsx(Cell,{fill:i[l]},`cell-${l}`))}),jsx(Tooltip,{content:jsx(vp,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(c,l)=>{let p=l.payload,d=s>0?(p.value/s*100).toFixed(0):"0";return `${c} (${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(vp,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:n.map((c,l)=>jsx(Cell,{fill:i[l]},`cell-${l}`))})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsx("span",{className:"chart-stat-value",style:{color:"#2E94FF"},children:s})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Categories"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((c,l)=>l.value>c.value?l:c).name})]})]})]})}var Xs=memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,i]=useState(false),[c,l]=useState(false),[p,d]=useState(false),[m,g]=useState(false);if(e.length===0)return null;let b=e.map(x=>x.id),h=x=>{r.onBulkUpdate?.(b,{priority:x}),i(false);},v=x=>{r.onBulkMove?.(b,x),l(false),a();},f=x=>{r.onBulkUpdate?.(b,{assignedUserIds:x}),d(false);},y=x=>{let C=new Set;e.forEach(D=>{D.labels?.forEach(T=>C.add(T));});let k=Array.from(new Set([...C,...x]));r.onBulkUpdate?.(b,{labels:k}),g(false);},w=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(b),a());};return jsx("div",{className:"asakaa-bulk-toolbar",children:jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!n),title:"Update priority",children:jsx("span",{className:"text-sm",children:"Priority"})}),n&&jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(x=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>h(x),children:[jsx("span",{className:u("asakaa-priority-dot",x==="LOW"&&"bg-asakaa-priority-low",x==="MEDIUM"&&"bg-asakaa-priority-medium",x==="HIGH"&&"bg-asakaa-priority-high",x==="URGENT"&&"bg-asakaa-priority-urgent")}),x]},x))})]}),o.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!c),title:"Move to column",children:jsx("span",{className:"text-sm",children:"Move"})}),c&&jsx("div",{className:"asakaa-bulk-menu",children:o.map(x=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>v(x.id),children:x.title},x.id))})]}),t.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!p),title:"Assign users",children:jsx("span",{className:"text-sm",children:"Assign"})}),p&&jsx("div",{className:"asakaa-bulk-menu",children:t.map(x=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>f([x.id]),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:x.color},children:x.initials}),x.name]},x.id))})]}),s.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>g(!m),title:"Add labels",children:jsx("span",{className:"text-sm",children:"Labels"})}),m&&jsx("div",{className:"asakaa-bulk-menu",children:s.map(x=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>y([x]),children:x},x))})]}),jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:w,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"})})]})]})})});Xs.displayName="BulkOperationsToolbar";function Sy(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,i,c,l;switch(t){case "assignee":let p=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);p.length>0?p.forEach(g=>{let b=a?.find(h=>h.id===g);n=`assignee-${g}`,i=b?.name||`User ${g}`,c=b?.color,l=b?.avatar,r.has(n)||r.set(n,{id:n,title:i,groupValue:g,cardIds:[],color:c,icon:l}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",i="Unassigned",c="#6b7280",l="\u{1F464}",r.has(n)||r.set(n,{id:n,title:i,groupValue:null,cardIds:[],color:c,icon:l}),r.get(n).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",n=`priority-${s}`;let m={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];i=m.title,c=m.color,r.has(n)||r.set(n,{id:n,title:i,groupValue:s,cardIds:[],color:c}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(g=>{n=`label-${g}`,i=g,c="#6b7280",r.has(n)||r.set(n,{id:n,title:i,groupValue:g,cardIds:[],color:c}),r.get(n).cardIds.push(o.id);}):(n="label-none",i="No Labels",c="#6b7280",r.has(n)||r.set(n,{id:n,title:i,groupValue:null,cardIds:[],color:c}),r.get(n).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function jl({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=useState(new Set),i=useMemo(()=>Sy(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),c=useCallback(l=>{n(p=>{let d=new Set(p);return d.has(l)?d.delete(l):d.add(l),d});},[]);return t.groupBy==="none"||i.length===0?jsx(po,{board:e,callbacks:r,availableUsers:a,className:o}):jsxs("div",{className:u("asakaa-swimlane-view",o),children:[i.map(l=>{let p=s.has(l.id),d=e.cards.filter(g=>l.cardIds.includes(g.id)),m={...e,cards:d};return jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&c(l.id),style:{borderLeft:l.color?`4px solid ${l.color}`:void 0},children:[jsxs("div",{className:"flex items-center gap-3",children:[l.icon&&jsx("span",{className:"text-2xl leading-none",children:l.icon}),jsx("h3",{className:"text-lg font-semibold",style:{color:l.color},children:l.title}),jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",l.cardIds.length," ",l.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":p?"Expand lane":"Collapse lane",children:p?"\u25B6":"\u25BC"})]}),!p&&jsx("div",{className:"asakaa-swimlane-content p-4",children:jsx(po,{board:m,callbacks:r,availableUsers:a})})]},l.id)}),i.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 Kl=[{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 Yl({value:e,onChange:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null),i=Kl.find(l=>l.value===e)||Kl[0];useEffect(()=>{function l(p){s.current&&!s.current.contains(p.target)&&n.current&&!n.current.contains(p.target)&&o(false);}if(r)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]);let c=l=>{t(l),o(false);};return jsxs("div",{className:u("relative inline-block",a),children:[jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsx("span",{className:"text-base leading-none",children:i.icon}),jsx("span",{children:i.label}),jsx("svg",{className:u("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[280px] rounded-lg bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl border border-white/20 shadow-2xl z-50 overflow-hidden",children:[jsx("div",{className:"px-3 py-2 border-b border-white/10",children:jsx("span",{className:"text-[10px] font-bold text-white/70 uppercase tracking-wider",children:"Group By"})}),jsx("div",{className:"py-1",children:Kl.map(l=>jsxs("button",{onClick:()=>c(l.value),className:u("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===l.value&&"bg-white/5"),children:[jsx("span",{className:"text-xl leading-none mt-0.5",children:l.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"font-semibold text-sm text-white",children:l.label}),e===l.value&&jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsx("p",{className:"text-xs text-white/60 mt-0.5",children:l.description})]})]},l.value))})]})]})}var Yn=[{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 My(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(l=>e.key===l||e.code===l))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,n=o.shift?e.shiftKey:!e.shiftKey,i=o.alt?e.altKey:!e.altKey,c=o.meta?e.metaKey:true;return s&&n&&i&&c}function Np(e={}){let{shortcuts:t=Yn,enabled:a=true,preventDefault:r=true}=e,o=useRef(t),s=useRef(a);useEffect(()=>{o.current=t,s.current=a;},[t,a]);let n=useCallback(c=>{o.current=[...o.current,c];},[]),i=useCallback(c=>{o.current=o.current.filter(l=>l.action!==c);},[]);return useEffect(()=>{function c(l){if(!s.current)return;let p=l.target;if(!((p.tagName==="INPUT"||p.tagName==="TEXTAREA"||p.isContentEditable)&&l.key!=="Escape"&&!l.ctrlKey&&!l.metaKey)){for(let d of o.current)if(My(l,d)){r&&l.preventDefault();let m=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(m);break}}}return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[r]),{registerShortcut:n,unregisterShortcut:i,isEnabled:a}}function Ay(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Ly(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 Iy(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Ly(e),r=t?Ay(t):"";return a?`${a} + ${r}`:r}function By(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 ql({shortcuts:e=Yn,isOpen:t,onClose:a,className:r}){let[o,s]=useState(false);if(useEffect(()=>{s(true);},[]),useEffect(()=>{function i(c){c.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[t,a]),!o||!t)return null;let n=By(e);return jsxs("div",{className:u("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsx("div",{className:"absolute inset-0 backdrop-blur-sm bg-black/40 dark:bg-black/60",onClick:a}),jsxs("div",{className:"relative backdrop-blur-xl rounded-2xl border shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden bg-white dark:bg-gradient-to-br dark:from-gray-900/95 dark:to-gray-800/95 border-gray-200 dark:border-white/20",children:[jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between border-gray-200 dark:border-white/10",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold flex items-center gap-3 text-gray-900 dark:text-white",children:[jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsx("p",{className:"text-sm mt-1 text-gray-500 dark:text-white/60",children:"Speed up your workflow with these shortcuts"})]}),jsx("button",{onClick:a,className:"transition-colors text-2xl leading-none p-2 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:text-white/50 dark:hover:text-white dark:hover:bg-white/10","aria-label":"Close",children:"\xD7"})]}),jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(n).map(([i,c])=>c.length===0?null:jsxs("div",{children:[jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white/90",children:[jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),i]}),jsx("div",{className:"space-y-3",children:c.map(l=>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:l.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:Iy(l)})]},l.action))})]},i))})}),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 Xl=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
|
|
85
|
+
`,g.onmouseenter=()=>{g.style.opacity="1";},g.onmouseleave=()=>{g.style.opacity="0.5";},g.onclick=b=>{b.stopPropagation();let h=r<a.length-1?r+1:0;l(),o(h);},n.appendChild(d),n.appendChild(m),n.appendChild(g);}n.appendChild(i),n.appendChild(c),document.body.appendChild(n),setTimeout(()=>{c.style.transition="opacity 0.5s ease",c.style.opacity="0";},2e3);}function Hh(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 zh(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 $l(e){return e.startsWith("image/")}function Ur({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,i]=useState(false),[c,l]=useState(false),[p,d]=useState(null),m=useRef(null),g=useRef(e);g.current=e;let b=useCallback((C,I)=>{I.preventDefault(),I.stopPropagation();let $=g.current.filter(E=>$l(E.type)),A=$.findIndex(E=>E.id===C.id),_=E=>{let me=g.current.filter(X=>$l(X.type)),L=me[E];L&&up(L.url,L.name,me,E,_);};up(C.url,C.name,$,A,_);},[]),h=useCallback(C=>{let I=[],$=[];return e.length+C.length>s?($.push(`Maximum ${s} files allowed`),{valid:I,errors:$}):(C.forEach(A=>{if(A.size/1048576>r){$.push(`${A.name} is too large (max ${r}MB)`);return}if(o&&!o.some(E=>A.type.match(E))){$.push(`${A.name} has invalid file type`);return}I.push(A);}),{valid:I,errors:$})},[e.length,s,r,o]),v=useCallback(async C=>{let{valid:I,errors:$}=h(C);if($.length>0){d($.join(", ")),setTimeout(()=>d(null),5e3);return}if(I.length!==0){l(true),d(null);try{await t?.(I);}catch(A){d(A instanceof Error?A.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{l(false);}}},[h,t]),f=useCallback(C=>{C.preventDefault(),C.stopPropagation(),i(true);},[]),y=useCallback(C=>{C.preventDefault(),C.stopPropagation(),i(false);},[]),w=useCallback(C=>{C.preventDefault(),C.stopPropagation();},[]),x=useCallback(C=>{C.preventDefault(),C.stopPropagation(),i(false);let I=Array.from(C.dataTransfer.files);v(I);},[v]),T=useCallback(C=>{let I=C.target.files?Array.from(C.target.files):[];v(I),m.current&&(m.current.value="");},[v]),k=useCallback(()=>{m.current?.click();},[]),S=useCallback(C=>{confirm("Are you sure you want to delete this attachment?")&&a?.(C);},[a]);return jsxs("div",{className:"attachment-uploader",children:[jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${c?"uploading":""}`,onDragEnter:f,onDragLeave:y,onDragOver:w,onDrop:x,onClick:k,children:[jsx("input",{ref:m,type:"file",multiple:true,onChange:T,style:{display:"none"},accept:o?.join(",")}),jsx("div",{className:"attachment-dropzone-content",children:c?jsxs(Fragment,{children:[jsx("div",{className:"attachment-spinner"}),jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxs(Fragment,{children:[jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsx("p",{className:"attachment-dropzone-text",children:n?"Drop files here":"Drag & drop files here"}),jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),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(C=>jsxs("div",{className:"attachment-item",children:[jsx("div",{className:"attachment-preview",children:$l(C.type)&&C.url?jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:I=>b(C,I),title:"Click to view full size",children:[jsx("img",{src:C.thumbnailUrl||C.url,alt:C.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:zh(C.type)})}),jsxs("div",{className:"attachment-info",children:[jsx("a",{href:C.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:C.name,children:C.name}),jsxs("div",{className:"attachment-meta",children:[jsx("span",{className:"attachment-size",children:Hh(C.size)}),jsx("span",{className:"attachment-separator",children:"\u2022"}),jsx("span",{className:"attachment-date",children:new Date(C.uploadedAt).toLocaleDateString()})]})]}),jsx("button",{onClick:()=>S(C.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"})})})]},C.id))})]})}function Hl({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:i=[],aiInsights:c=[],attachments:l=[],onAddComment:p,onDeleteComment:d,onUploadAttachments:m,onDeleteAttachment:g,onSuggestAssignee:b,onGenerateSubtasks:h,onEstimateEffort:v,currentUserId:f="user-1"}){let[y,w]=useState("details"),[x,T]=useState(false),[k,S]=useState({}),[C,I]=useState(""),[$,A]=useState(false),[_,E]=useState({});if(!t||!e)return null;let me=useCallback(()=>{T(false),S({}),w("details"),I(""),E({}),a();},[a]),L=useCallback(()=>{r&&Object.keys(k).length>0&&(r(e.id,k),S({}),T(false));},[e.id,k,r]),X=useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),me());},[e.id,o,me]),ee=useCallback(()=>{p&&C.trim()&&(p(e.id,C.trim()),I(""));},[e.id,C,p]),ze=useCallback(async()=>{if(b){A(true);try{let U=await b(e);E(oe=>({...oe,assignees:U}));}catch(U){console.error("Failed to suggest assignee:",U);}finally{A(false);}}},[e,b]),O=useCallback(async()=>{if(h){A(true);try{let U=await h(e);E(oe=>({...oe,subtasks:U}));}catch(U){console.error("Failed to generate subtasks:",U);}finally{A(false);}}},[e,h]),j=useCallback(async()=>{if(v){A(true);try{let U=await v(e);E(oe=>({...oe,effort:U}));}catch(U){console.error("Failed to estimate effort:",U);}finally{A(false);}}},[e,v]),he={...e,...k},je=s.filter(U=>he.assignedUserIds?.includes(U.id));return jsx(Ht,{children:jsx("div",{className:"card-detail-overlay",onClick:me,children:jsxs("div",{className:"card-detail-modal",onClick:U=>U.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:he.priority==="URGENT"?"#EF4444":he.priority==="HIGH"?"#F59E0B":he.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),x?jsx("input",{type:"text",value:k.title??he.title,onChange:U=>S({...k,title:U.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsx("h2",{className:"card-detail-title",children:he.title})]}),jsxs("div",{className:"card-detail-header-actions",children:[x?jsxs(Fragment,{children:[jsx("button",{onClick:L,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsx("button",{onClick:()=>{T(false),S({});},className:"card-detail-btn",children:"Cancel"})]}):jsxs("button",{onClick:()=>T(true),className:"card-detail-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit"]}),jsxs("button",{onClick:X,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:me,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:()=>w("details"),className:`card-detail-tab ${y==="details"?"active":""}`,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Details"]}),jsxs("button",{onClick:()=>w("comments"),className:`card-detail-tab ${y==="comments"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",n.length>0&&jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxs("button",{onClick:()=>w("activity"),className:`card-detail-tab ${y==="activity"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",i.length>0&&jsx("span",{className:"card-detail-tab-badge",children:i.length})]}),jsxs("button",{onClick:()=>w("attachments"),className:`card-detail-tab ${y==="attachments"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",l.length>0&&jsx("span",{className:"card-detail-tab-badge",children:l.length})]}),jsxs("button",{onClick:()=>w("ai"),className:`card-detail-tab ${y==="ai"?"active":""}`,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),"AI Insights",jsx("span",{className:"card-detail-tab-badge card-detail-tab-badge-ai",children:"AI"})]})]}),jsxs("div",{className:"card-detail-content",children:[y==="details"&&jsxs("div",{className:"card-detail-details",children:[jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Description"}),x?jsx("textarea",{value:k.description??he.description??"",onChange:U=>S({...k,description:U.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsx("p",{className:"card-detail-text",children:he.description||"No description"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Assigned To"}),x?jsx("select",{multiple:true,value:k.assignedUserIds??he.assignedUserIds??[],onChange:U=>{let oe=Array.from(U.target.selectedOptions,te=>te.value);S({...k,assignedUserIds:oe});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(U=>jsx("option",{value:U.id,children:U.name},U.id))}):jsx("div",{className:"card-detail-users",children:je.length>0?je.map(U=>jsxs("div",{className:"card-detail-user",children:[jsx("div",{className:"card-detail-user-avatar",style:{background:U.color},children:U.initials}),jsx("span",{children:U.name})]},U.id)):jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Priority"}),x?jsxs("select",{value:k.priority??he.priority??"",onChange:U=>S({...k,priority:U.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:he.priority==="URGENT"?"#EF4444":he.priority==="HIGH"?"#F59E0B":he.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsx("span",{children:he.priority||"None"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Labels"}),jsx("div",{className:"card-detail-labels",children:he.labels&&he.labels.length>0?he.labels.map(U=>jsx("span",{className:"card-detail-label-tag",children:U},U)):jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxs("div",{className:"card-detail-section-row",children:[jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Start Date"}),x?jsx("input",{type:"date",value:k.startDate?new Date(k.startDate).toISOString().split("T")[0]:he.startDate?new Date(he.startDate).toISOString().split("T")[0]:"",onChange:U=>S({...k,startDate:U.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:he.startDate?new Date(he.startDate).toLocaleDateString():"Not set"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"End Date"}),x?jsx("input",{type:"date",value:k.endDate?new Date(k.endDate).toISOString().split("T")[0]:he.endDate?new Date(he.endDate).toISOString().split("T")[0]:"",onChange:U=>S({...k,endDate:U.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:he.endDate?new Date(he.endDate).toLocaleDateString():"Not set"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),x?jsx("input",{type:"number",min:"0",step:"0.5",value:k.estimatedTime??he.estimatedTime??"",onChange:U=>S({...k,estimatedTime:U.target.value?parseFloat(U.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsx("span",{className:"card-detail-text",children:he.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:he.dependencies&&he.dependencies.length>0?he.dependencies.map(U=>{let oe=typeof U=="string"?U:U.taskId;return jsxs("span",{className:"card-detail-dependency",children:["Card #",oe.slice(-4)]},oe)}):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:he.createdAt?new Date(he.createdAt).toLocaleString():"Unknown"})]})]}),y==="comments"&&jsxs("div",{className:"card-detail-comments",children:[jsxs("div",{className:"card-detail-comment-form",children:[jsx("textarea",{value:C,onChange:U=>I(U.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsx("button",{onClick:ee,disabled:!C.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(U=>{let oe=s.find(te=>te.id===U.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:[oe&&jsx("div",{className:"card-detail-user-avatar",style:{background:oe.color},children:oe.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-comment-author-name",children:oe?.name||"Unknown"}),jsx("div",{className:"card-detail-comment-time",children:new Date(U.createdAt).toLocaleString()})]})]}),d&&jsx("button",{onClick:()=>d(U.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:U.content})]},U.id)}):jsxs("div",{className:"card-detail-empty-state",children:[jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsx("p",{children:"No comments yet"}),jsx("span",{children:"Be the first to comment"})]})})]}),y==="activity"&&jsx("div",{className:"card-detail-activity",children:i.length>0?jsx("div",{className:"card-detail-activity-list",children:i.map(U=>{let oe=s.find(te=>te.id===U.userId);return jsxs("div",{className:"card-detail-activity-item",children:[jsxs("div",{className:"card-detail-activity-icon",children:[U.type.includes("CREATED")&&"\u2795",U.type.includes("UPDATED")&&"\u270F\uFE0F",U.type.includes("MOVED")&&"\u27A1\uFE0F",U.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",U.type.includes("COMMENT")&&"\u{1F4AC}",U.type.includes("ASSIGNED")&&"\u{1F464}",U.type.includes("PRIORITY")&&"\u{1F3AF}",U.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",U.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxs("div",{className:"card-detail-activity-content",children:[jsxs("div",{className:"card-detail-activity-text",children:[jsx("strong",{children:oe?.name||"Unknown"})," ",U.type.replace(/_/g," ").toLowerCase(),U.newValue&&jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsx("strong",{children:U.newValue})]})]}),jsx("div",{className:"card-detail-activity-time",children:new Date(U.timestamp).toLocaleString()})]})]},U.id)})}):jsxs("div",{className:"card-detail-empty-state",children:[jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),jsx("p",{children:"No activity yet"}),jsx("span",{children:"Activity will appear here"})]})}),y==="attachments"&&jsx("div",{className:"card-detail-attachments",children:jsx(Ur,{cardId:e.id,attachments:l,onUpload:m?U=>m(e.id,U):void 0,onDelete:g,currentUserId:f,maxSizeMB:10,maxFiles:20})}),y==="ai"&&jsxs("div",{className:"card-detail-ai",children:[jsxs("div",{className:"card-detail-ai-actions",children:[jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxs("button",{onClick:ze,disabled:$||!b,className:"card-detail-ai-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxs("button",{onClick:O,disabled:$||!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("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),jsx("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),jsx("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),jsx("line",{x1:"3",y1:"6",x2:"3.01",y2:"6"}),jsx("line",{x1:"3",y1:"12",x2:"3.01",y2:"12"}),jsx("line",{x1:"3",y1:"18",x2:"3.01",y2:"18"})]}),"Generate Subtasks"]}),jsxs("button",{onClick:j,disabled:$||!v,className:"card-detail-ai-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),_.assignees&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Assignee Suggestions"}),_.assignees.map((U,oe)=>{let te=s.find(Fe=>Fe.id===U.userId);return jsxs("div",{className:"card-detail-ai-suggestion",children:[te&&jsx("div",{className:"card-detail-user-avatar",style:{background:te.color},children:te.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-ai-suggestion-name",children:te?.name}),jsx("div",{className:"card-detail-ai-suggestion-reason",children:U.reasoning}),jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(U.confidence*100).toFixed(0),"%"]})]})]},oe)})]}),_.subtasks&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Suggested Subtasks"}),_.subtasks.map((U,oe)=>jsxs("div",{className:"card-detail-ai-subtask",children:[jsx("div",{className:"card-detail-ai-subtask-title",children:U.title}),U.description&&jsx("div",{className:"card-detail-ai-subtask-desc",children:U.description}),U.estimatedTime&&jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",U.estimatedTime,"h"]})]},oe))]}),_.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:[_.effort.hours," hours"]}),jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(_.effort.confidence*100).toFixed(0),"%"]})]})]}),c.length>0&&jsxs("div",{className:"card-detail-ai-insights",children:[jsx("h4",{children:"AI Insights"}),c.map(U=>jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${U.severity.toLowerCase()}`,children:[jsxs("div",{className:"card-detail-ai-insight-header",children:[jsx("span",{className:"card-detail-ai-insight-title",children:U.title}),jsx("span",{className:"card-detail-ai-insight-severity",children:U.severity})]}),jsx("p",{className:"card-detail-ai-insight-desc",children:U.description}),U.suggestedAction&&jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",U.suggestedAction]})]},U.id))]}),!_.assignees&&!_.subtasks&&!_.effort&&c.length===0&&jsxs("div",{className:"card-detail-empty-state",children:[jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),jsx("p",{children:"AI Suggestions"}),jsx("span",{children:"Click a button above to get AI-powered insights"})]})]})]})]})})})}function Kn({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[i,c]=useState({top:0,left:0}),l=useRef(null),p=useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),m=window.innerHeight,g=window.innerWidth,b=4,h=d.left;h+o>g-10&&(h=g-o-10),h<10&&(h=10);let v=m-d.bottom,f=d.top,y;return v>=s+b?y=d.bottom+b:f>=s+b?y=d.top-s-b:v>=f?y=d.bottom+b:y=Math.max(10,d.top-s-b),{top:y,left:h}},[e,o,s]);return useEffect(()=>{t&&c(p());},[t,p]),useEffect(()=>{if(!t)return;let d=g=>{let b=g.target;l.current&&!l.current.contains(b)&&e.current&&!e.current.contains(b)&&a();},m=setTimeout(()=>{document.addEventListener("mousedown",d);},0);return ()=>{clearTimeout(m),document.removeEventListener("mousedown",d);}},[t,a,e]),useEffect(()=>{if(!t)return;let d=m=>{m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),a());};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),t?jsx(Ht,{children:jsx("div",{ref:l,className:`smart-popover ${n}`,style:{position:"fixed",top:`${i.top}px`,left:`${i.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 ct={dark:{bgPrimary:"#050505",bgSecondary:"#0A0A0A",bgGrid:"rgba(255, 255, 255, 0.02)",bgWeekend:"rgba(17, 17, 17, 0.4)",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#2E94FF",accentHover:"#5AADFF",accentLight:"rgba(46, 148, 255, 0.12)",taskBarPrimary:"#2E94FF",taskBarProgress:"#5AADFF",taskBarHandle:"#FFFFFF",dependency:"#444444",dependencyHover:"#FFFFFF",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.15)",today:"#EF4444",todayLight:"rgba(239, 68, 68, 0.08)",milestone:"#FFFFFF",milestoneLight:"rgba(255, 255, 255, 0.1)",statusTodo:"#666666",statusInProgress:"#2E94FF",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.04)",focusRing:"#2E94FF",dotGrid:"rgba(255, 255, 255, 0.05)",glassHeader:"#0A0A0A",glassToolbar:"rgba(0, 0, 0, 0.4)",forecastHud:"rgba(15, 15, 15, 0.9)",neonRedGlow:"0 0 8px rgba(239, 68, 68, 0.25)",executionBarBg:"rgba(46, 148, 255, 0.12)"},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:"#2E94FF",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2E94FF",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"#6B7280",dependencyHover:"#2E94FF",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:"#2E94FF",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2E94FF",dotGrid:"rgba(0, 0, 0, 0.04)",glassHeader:"#F8FAFC",glassToolbar:"rgba(255, 255, 255, 0.85)",forecastHud:"rgba(248, 250, 252, 0.95)",neonRedGlow:"0 0 10px rgba(220, 38, 38, 0.3)",executionBarBg:"rgba(37, 99, 235, 0.28)"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"#78716C",dependencyHover:"#A8A29E",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.06)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.08)",statusTodo:"#78716C",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.035)",focusRing:"#292524",dotGrid:"rgba(0, 0, 0, 0.03)",glassHeader:"#F5F5F4",glassToolbar:"rgba(250, 250, 249, 0.85)",forecastHud:"rgba(245, 245, 244, 0.95)",neonRedGlow:"0 0 10px rgba(68, 64, 60, 0.3)",executionBarBg:"rgba(41, 37, 36, 0.25)"}};var Yh=["LOW","MEDIUM","HIGH","URGENT"],qh=["todo","in-progress","review","done"];function Wl({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:i=[],onAddComment:c,onDeleteComment:l,currentUser:p,onAIGenerateDescription:d,onAICreateSubtasks:m,onAIFindSimilar:g,availableColumns:b=[],availableLabels:h=[],availableTags:v=[],onCreateTag:f,onUploadCoverImage:y,unsplashAccessKey:w,theme:x,onSubtasksChange:T,attachments:k=[],onUploadAttachments:S,onDeleteAttachment:C}){let I=en(),$=x||I?.themeName||"dark",[A,_]=useState(e),[E,me]=useState(false),[L,X]=useState(()=>[...e?.subtasks||[]].sort((K,q)=>(K.position??0)-(q.position??0))),[ee,ze]=useState(false),[O,j]=useState(""),[he,je]=useState(""),[U,oe]=useState("all"),[te,Fe]=useState(false),[we,Re]=useState(false),[Ue,Qe]=useState(false),[ae,tt]=useState(false),[pe,at]=useState(false),[mt,Ft]=useState(false),Te=useRef(null),rt=useRef(null),lt=useRef(null),Ze=useRef(null),H=useRef(null),de=useRef(null),N=useRef(null),Y=useRef(null),ie=useRef(null),ke=useRef(null),V=useRef(null),re=useRef(null);useEffect(()=>{if(e&&!A){_({...e});let P=[...e.subtasks||[]].sort((K,q)=>(K.position??0)-(q.position??0));X(P);}else if(e&&A&&e.id!==A.id){_({...e});let P=[...e.subtasks||[]].sort((K,q)=>(K.position??0)-(q.position??0));X(P);}},[e,A]),useEffect(()=>{let P=K=>{let q=K.target;Ze.current&&!Ze.current.contains(q)&&Fe(false),H.current&&!H.current.contains(q)&&Re(false),de.current&&!de.current.contains(q)&&Qe(false),N.current&&!N.current.contains(q)&&tt(false);};if(te||we||Ue||ae)return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[te,we,Ue,ae]),useEffect(()=>{if(!t)return;let P=K=>{let q=K.target,ce=q.tagName==="INPUT"||q.tagName==="TEXTAREA"||q.isContentEditable;if(K.key==="Escape"){K.preventDefault(),te||we||Ue||ae||pe||mt?(Fe(false),Re(false),Qe(false),tt(false),at(false),Ft(false)):ce||a();return}if(ce&&K.key!=="Escape")return;let Se=K.metaKey||K.ctrlKey;switch(K.key.toLowerCase()){case "s":K.preventDefault(),Fe(true);break;case "a":K.preventDefault(),Qe(true);break;case "p":K.preventDefault(),Re(true);break;case "l":K.preventDefault(),tt(true);break;case "d":Se||(K.preventDefault(),at(true),setTimeout(()=>Y.current?.focus(),0));break;case "e":Se||(K.preventDefault(),Ft(true));break;case "i":K.preventDefault(),me(true),setTimeout(()=>rt.current?.focus(),0);break;case "t":K.preventDefault(),ze(true);break;case "c":K.preventDefault(),lt.current?.focus();break}};return window.addEventListener("keydown",P),()=>window.removeEventListener("keydown",P)},[t,a,te,we,Ue,ae,pe,mt]);let Ve=useCallback(P=>{let K=P.currentTarget.textContent?.trim()||"";if(A&&K!==A.title){let q={...A,title:K};_(q),r?.(A.id,{title:K});}},[A,r]),De=useCallback(P=>{P.key==="Enter"&&(P.preventDefault(),P.currentTarget.blur()),P.key==="Escape"&&(P.preventDefault(),P.currentTarget.textContent=A?.title||"",P.currentTarget.blur());},[A]),We=useCallback(()=>{A&&e&&A.description!==e.description&&r?.(A.id,{description:A.description}),me(false);},[A,e,r]),Ne=useCallback(P=>{if(A){let K={...A,columnId:P};_(K),r?.(A.id,{columnId:P}),Fe(false);}},[A,r]),Ke=useCallback(P=>{if(A){let K={...A,priority:P};_(K),r?.(A.id,{priority:P}),Re(false);}},[A,r]),ht=useCallback(P=>{if(A){let K=A.assignedUserIds||[],q=K.includes(P)?K.filter(Se=>Se!==P):[...K,P],ce={...A,assignedUserIds:q};_(ce),r?.(A.id,{assignedUserIds:q});}},[A,r]),dt=useCallback(P=>{if(A){let K=A.labels||[],q=K.includes(P)?K.filter(Se=>Se!==P):[...K,P],ce={...A,labels:q};_(ce),r?.(A.id,{labels:q});}},[A,r]),nt=useCallback(P=>{if(A){let K={...A,tags:P};_(K),r?.(A.id,{tags:P});}},[A,r]),et=useCallback(P=>{if(A){let K=P.target.value,q={...A,endDate:K};_(q),r?.(A.id,{endDate:K}),at(false);}},[A,r]),Lt=useCallback(P=>{if(A){let K={...A,estimatedTime:parseFloat(P)||0};_(K),r?.(A.id,{estimatedTime:parseFloat(P)||0});}},[A,r]),Pt=useCallback(()=>{if(O.trim()&&A){let P={id:`subtask-${Date.now()}`,title:O.trim(),completed:false,position:L.length,createdAt:new Date},K=[...L,P];X(K),j(""),ze(false),T?.(A.id,K);}},[O,L,A,T]),gt=useCallback(P=>{let K=L.map(q=>q.id===P?{...q,completed:!q.completed,updatedAt:new Date}:q);X(K),A&&T?.(A.id,K);},[L,A,T]),vt=useCallback(P=>{let K=L.filter(q=>q.id!==P);X(K),A&&T?.(A.id,K);},[L,A,T]),ft=useCallback(()=>{he.trim()&&A&&c&&(c(A.id,he.trim()),je(""));},[he,A,c]),At=useCallback(P=>{(P.metaKey||P.ctrlKey)&&P.key==="Enter"&&(P.preventDefault(),ft());},[ft]),Ge=P=>jsx(_h,{remarkPlugins:[jh],rehypePlugins:[Kh],components:{a:({node:K,...q})=>jsx("a",{...q,target:"_blank",rel:"noopener noreferrer"})},children:P}),Oe=i.filter(P=>U==="comments"?P.type.includes("COMMENT"):U==="history"?!P.type.includes("COMMENT"):true);if(!t||!e)return null;let pt=A||e,le=s.filter(P=>pt.assignedUserIds?.includes(P.id)),fe=L.filter(P=>P.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:P=>P.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":$,children:[jsxs("header",{className:"modal-v2-header",children:[jsx("h1",{id:"modal-title",ref:Te,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:Ve,onKeyDown:De,children:pt.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:Ze,children:[jsxs("button",{ref:ie,className:"modal-v2-field",onClick:()=>Fe(!te),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:pt.columnId||"No status"})]}),jsx(Kn,{triggerRef:ie,isOpen:te,onClose:()=>Fe(false),width:250,estimatedHeight:200,children:(b.length>0?b:qh.map(P=>({id:P,title:P}))).map(P=>jsx("button",{className:`modal-v2-popover-item ${pt.columnId===P.id?"active":""}`,onClick:()=>Ne(P.id),children:P.title},P.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:de,children:[jsxs("button",{ref:ke,className:"modal-v2-field",onClick:()=>Qe(!Ue),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"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:le.length>0?jsx("div",{className:"modal-v2-avatars",children:le.map(P=>jsx("div",{className:"modal-v2-avatar",style:{background:P.color},title:P.name,children:P.initials},P.id))}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(Kn,{triggerRef:ke,isOpen:Ue,onClose:()=>Qe(false),width:280,estimatedHeight:300,children:s.map(P=>jsxs("button",{className:`modal-v2-popover-item ${pt.assignedUserIds?.includes(P.id)?"active":""}`,onClick:()=>ht(P.id),children:[jsx("div",{className:"modal-v2-avatar-small",style:{background:P.color},children:P.initials}),P.name,pt.assignedUserIds?.includes(P.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"})})]},P.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:H,children:[jsxs("button",{ref:V,className:"modal-v2-field",onClick:()=>Re(!we),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:pt.priority||"None"})]}),jsxs(Kn,{triggerRef:V,isOpen:we,onClose:()=>Re(false),width:180,estimatedHeight:220,children:[Yh.map(P=>jsx("button",{className:`modal-v2-popover-item priority-${P.toLowerCase()} ${pt.priority===P?"active":""}`,onClick:()=>Ke(P),children:P},P)),jsx("button",{className:"modal-v2-popover-item",onClick:()=>Ke(""),children:"None"})]})]}),v.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(lo,{selectedTags:pt.tags||[],availableTags:v,onChange:nt,onCreateTag:f,theme:ct[$]||ct.dark})})]})}):jsxs("div",{className:"modal-v2-field-wrapper",ref:N,children:[jsxs("button",{ref:re,className:"modal-v2-field",onClick:()=>tt(!ae),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:pt.labels&&pt.labels.length>0?jsx("span",{children:pt.labels.join(", ")}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(Kn,{triggerRef:re,isOpen:ae,onClose:()=>tt(false),width:220,estimatedHeight:200,children:(h.length>0?h:["Bug","Feature","Enhancement","Documentation"]).map(P=>jsxs("button",{className:`modal-v2-popover-item ${pt.labels?.includes(P)?"active":""}`,onClick:()=>dt(P),children:[P,pt.labels?.includes(P)&&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"})})]},P))})]}),jsxs("button",{className:"modal-v2-field",onClick:()=>{at(!pe),setTimeout(()=>Y.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:pt.endDate?new Date(pt.endDate).toLocaleDateString():"Not set"}),jsx("input",{ref:Y,type:"date",value:typeof pt.endDate=="string"?pt.endDate.split("T")[0]:pt.endDate?(()=>{let P=new Date(pt.endDate),K=P.getUTCFullYear(),q=String(P.getUTCMonth()+1).padStart(2,"0"),ce=String(P.getUTCDate()).padStart(2,"0");return `${K}-${q}-${ce}`})():"",onChange:et,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxs("button",{className:"modal-v2-field",onClick:()=>Ft(!mt),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("polyline",{points:"12 6 12 12 16 14"})]}),jsx("span",{children:"Estimated Time"}),jsx("kbd",{className:"modal-v2-shortcut",children:"E"})]}),jsx("div",{className:"modal-v2-field-value",children:pt.estimatedTime?`${pt.estimatedTime}h`:"Not set"})]}),mt&&jsx("div",{className:"modal-v2-popover",children:jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:pt.estimatedTime||"",onChange:P=>Lt(P.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>Ft(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"})]}),E?jsx("textarea",{className:"modal-v2-textarea",value:pt.description||"",onChange:P=>{if(A){let K={...A,description:P.target.value};_(K);}},onBlur:We,placeholder:"Add a detailed description...",autoFocus:true}):jsx("div",{className:"modal-v2-content",onClick:()=>me(true),children:pt.description?jsx("div",{className:"modal-v2-markdown",children:Ge(pt.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"}),L.length>0&&jsxs("span",{className:"modal-v2-count",children:[fe,"/",L.length]}),jsxs("button",{className:"modal-v2-add-button",onClick:()=>ze(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:[L.map(P=>jsxs("div",{className:`modal-v2-subtask ${P.completed?"completed":""}`,children:[jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>gt(P.id),children:P.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:P.title}),jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>vt(P.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"})]})})]},P.id)),ee&&jsx("div",{className:"modal-v2-subtask-input-row",children:jsx("input",{type:"text",placeholder:"Subtask title...",value:O,onChange:P=>j(P.target.value),onKeyDown:P=>{P.key==="Enter"&&Pt(),P.key==="Escape"&&(ze(false),j(""));},onBlur:Pt,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(S||k.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"}),k.length>0&&jsx("span",{className:"modal-v2-count",children:k.length})]}),jsx(Ur,{cardId:pt.id,attachments:k,onUpload:S?P=>S(pt.id,P):void 0,onDelete:C,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 ${U==="all"?"active":""}`,onClick:()=>oe("all"),children:"All"}),jsx("button",{className:`modal-v2-filter ${U==="comments"?"active":""}`,onClick:()=>oe("comments"),children:"Comments"}),jsx("button",{className:`modal-v2-filter ${U==="history"?"active":""}`,onClick:()=>oe("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:lt,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:he,onChange:P=>je(P.target.value),onKeyDown:At,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:ft,disabled:!he.trim(),children:"Send"})]})]})]}),jsxs("div",{className:"modal-v2-timeline",children:[Oe.map(P=>{let K=s.find(ce=>ce.id===P.userId);if(P.type.includes("COMMENT")){let ce=n.find(Se=>Se.id===P.metadata?.commentId);return ce?jsxs("div",{className:"modal-v2-activity-item comment-item",children:[K&&jsx("div",{className:"modal-v2-avatar",style:{background:K.color},children:K.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:K?.name||"Unknown"}),jsx("span",{className:"modal-v2-activity-time",children:new Date(P.timestamp).toLocaleString()})]}),jsx("div",{className:"modal-v2-comment-body",children:ce.content})]})]},P.id):null}return jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxs("div",{className:"modal-v2-history-icon",children:[P.type.includes("CREATED")&&"\u2795",P.type.includes("UPDATED")&&"\u270F\uFE0F",P.type.includes("MOVED")&&"\u27A1\uFE0F",P.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",P.type.includes("ASSIGNED")&&"\u{1F464}",P.type.includes("PRIORITY")&&"\u{1F3AF}",P.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:K?.name||"Unknown"})," ",P.type.replace(/_/g," ").toLowerCase(),P.newValue&&jsxs(Fragment,{children:[" to ",jsx("strong",{children:P.newValue})]})]}),jsx("span",{className:"modal-v2-activity-time",children:new Date(P.timestamp).toLocaleString()})]})]},P.id)}),Oe.length===0&&jsxs("div",{className:"modal-v2-empty",children:[jsx("p",{children:"No activity yet"}),jsx("span",{children:"Activity will appear here"})]})]})]})]})})})}function oy({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 Gl({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((i,c)=>i+c.completed,0)/e.length}));return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:a,children:jsxs(LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(oy,{})}),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:"#2E94FF",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#2E94FF",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,i)=>n+i.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,i)=>n+i.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:"#2E94FF"},children:e.reduce((n,i)=>n+(i.planned||0),0)})]})]})]})}function my({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 _l({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,i=e[e.length-1]?.ideal||0,c=s>0?(s-n)/s*100:0,l=n<=i;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(my,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?jsxs(Fragment,{children:[jsx(Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsx(Area,{type:"monotone",dataKey:"remaining",stroke:l?"#10B981":"#EF4444",fill:l?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxs(Fragment,{children:[jsx(Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsx(Line,{type:"monotone",dataKey:"remaining",stroke:l?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:l?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxs("span",{className:"chart-stat-value",style:{color:c>=50?"#10B981":"#F59E0B"},children:[c.toFixed(0),"%"]})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsx("span",{className:"chart-stat-value",style:{color:l?"#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:l?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:l?"#10B981":"#EF4444"},children:l?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var ky={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#2E94FF",LOW:"#10B981"},vp=["#2E94FF","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Cy({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,i=e+n*Math.cos(-a*(Math.PI/180)),c=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsx("text",{x:i,y:c,fill:"white",textAnchor:i>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function wp({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 jl({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((c,l)=>c+l.value,0),n=e.map(c=>({...c,totalValue:s,color:c.color||ky[c.name]||vp[e.indexOf(c)%vp.length]})),i=n.map(c=>c.color);return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxs(PieChart,{children:[jsx(Pie,{data:n,cx:"50%",cy:"50%",labelLine:false,label:o?Cy:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((c,l)=>jsx(Cell,{fill:i[l]},`cell-${l}`))}),jsx(Tooltip,{content:jsx(wp,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(c,l)=>{let p=l.payload,d=s>0?(p.value/s*100).toFixed(0):"0";return `${c} (${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(wp,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:n.map((c,l)=>jsx(Cell,{fill:i[l]},`cell-${l}`))})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsx("span",{className:"chart-stat-value",style:{color:"#2E94FF"},children:s})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Categories"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((c,l)=>l.value>c.value?l:c).name})]})]})]})}var Js=memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,i]=useState(false),[c,l]=useState(false),[p,d]=useState(false),[m,g]=useState(false);if(e.length===0)return null;let b=e.map(x=>x.id),h=x=>{r.onBulkUpdate?.(b,{priority:x}),i(false);},v=x=>{r.onBulkMove?.(b,x),l(false),a();},f=x=>{r.onBulkUpdate?.(b,{assignedUserIds:x}),d(false);},y=x=>{let T=new Set;e.forEach(S=>{S.labels?.forEach(C=>T.add(C));});let k=Array.from(new Set([...T,...x]));r.onBulkUpdate?.(b,{labels:k}),g(false);},w=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(b),a());};return jsx("div",{className:"asakaa-bulk-toolbar",children:jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!n),title:"Update priority",children:jsx("span",{className:"text-sm",children:"Priority"})}),n&&jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(x=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>h(x),children:[jsx("span",{className:u("asakaa-priority-dot",x==="LOW"&&"bg-asakaa-priority-low",x==="MEDIUM"&&"bg-asakaa-priority-medium",x==="HIGH"&&"bg-asakaa-priority-high",x==="URGENT"&&"bg-asakaa-priority-urgent")}),x]},x))})]}),o.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!c),title:"Move to column",children:jsx("span",{className:"text-sm",children:"Move"})}),c&&jsx("div",{className:"asakaa-bulk-menu",children:o.map(x=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>v(x.id),children:x.title},x.id))})]}),t.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!p),title:"Assign users",children:jsx("span",{className:"text-sm",children:"Assign"})}),p&&jsx("div",{className:"asakaa-bulk-menu",children:t.map(x=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>f([x.id]),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:x.color},children:x.initials}),x.name]},x.id))})]}),s.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>g(!m),title:"Add labels",children:jsx("span",{className:"text-sm",children:"Labels"})}),m&&jsx("div",{className:"asakaa-bulk-menu",children:s.map(x=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>y([x]),children:x},x))})]}),jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:w,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"})})]})]})})});Js.displayName="BulkOperationsToolbar";function Ey(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,i,c,l;switch(t){case "assignee":let p=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);p.length>0?p.forEach(g=>{let b=a?.find(h=>h.id===g);n=`assignee-${g}`,i=b?.name||`User ${g}`,c=b?.color,l=b?.avatar,r.has(n)||r.set(n,{id:n,title:i,groupValue:g,cardIds:[],color:c,icon:l}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",i="Unassigned",c="#6b7280",l="\u{1F464}",r.has(n)||r.set(n,{id:n,title:i,groupValue:null,cardIds:[],color:c,icon:l}),r.get(n).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",n=`priority-${s}`;let m={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];i=m.title,c=m.color,r.has(n)||r.set(n,{id:n,title:i,groupValue:s,cardIds:[],color:c}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(g=>{n=`label-${g}`,i=g,c="#6b7280",r.has(n)||r.set(n,{id:n,title:i,groupValue:g,cardIds:[],color:c}),r.get(n).cardIds.push(o.id);}):(n="label-none",i="No Labels",c="#6b7280",r.has(n)||r.set(n,{id:n,title:i,groupValue:null,cardIds:[],color:c}),r.get(n).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function Kl({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=useState(new Set),i=useMemo(()=>Ey(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),c=useCallback(l=>{n(p=>{let d=new Set(p);return d.has(l)?d.delete(l):d.add(l),d});},[]);return t.groupBy==="none"||i.length===0?jsx(po,{board:e,callbacks:r,availableUsers:a,className:o}):jsxs("div",{className:u("asakaa-swimlane-view",o),children:[i.map(l=>{let p=s.has(l.id),d=e.cards.filter(g=>l.cardIds.includes(g.id)),m={...e,cards:d};return jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&c(l.id),style:{borderLeft:l.color?`4px solid ${l.color}`:void 0},children:[jsxs("div",{className:"flex items-center gap-3",children:[l.icon&&jsx("span",{className:"text-2xl leading-none",children:l.icon}),jsx("h3",{className:"text-lg font-semibold",style:{color:l.color},children:l.title}),jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",l.cardIds.length," ",l.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":p?"Expand lane":"Collapse lane",children:p?"\u25B6":"\u25BC"})]}),!p&&jsx("div",{className:"asakaa-swimlane-content p-4",children:jsx(po,{board:m,callbacks:r,availableUsers:a})})]},l.id)}),i.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 Yl=[{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 ql({value:e,onChange:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null),i=Yl.find(l=>l.value===e)||Yl[0];useEffect(()=>{function l(p){s.current&&!s.current.contains(p.target)&&n.current&&!n.current.contains(p.target)&&o(false);}if(r)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]);let c=l=>{t(l),o(false);};return jsxs("div",{className:u("relative inline-block",a),children:[jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsx("span",{className:"text-base leading-none",children:i.icon}),jsx("span",{children:i.label}),jsx("svg",{className:u("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[280px] rounded-lg bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl border border-white/20 shadow-2xl z-50 overflow-hidden",children:[jsx("div",{className:"px-3 py-2 border-b border-white/10",children:jsx("span",{className:"text-[10px] font-bold text-white/70 uppercase tracking-wider",children:"Group By"})}),jsx("div",{className:"py-1",children:Yl.map(l=>jsxs("button",{onClick:()=>c(l.value),className:u("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===l.value&&"bg-white/5"),children:[jsx("span",{className:"text-xl leading-none mt-0.5",children:l.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"font-semibold text-sm text-white",children:l.label}),e===l.value&&jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsx("p",{className:"text-xs text-white/60 mt-0.5",children:l.description})]})]},l.value))})]})]})}var Yn=[{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 Py(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(l=>e.key===l||e.code===l))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,n=o.shift?e.shiftKey:!e.shiftKey,i=o.alt?e.altKey:!e.altKey,c=o.meta?e.metaKey:true;return s&&n&&i&&c}function Dp(e={}){let{shortcuts:t=Yn,enabled:a=true,preventDefault:r=true}=e,o=useRef(t),s=useRef(a);useEffect(()=>{o.current=t,s.current=a;},[t,a]);let n=useCallback(c=>{o.current=[...o.current,c];},[]),i=useCallback(c=>{o.current=o.current.filter(l=>l.action!==c);},[]);return useEffect(()=>{function c(l){if(!s.current)return;let p=l.target;if(!((p.tagName==="INPUT"||p.tagName==="TEXTAREA"||p.isContentEditable)&&l.key!=="Escape"&&!l.ctrlKey&&!l.metaKey)){for(let d of o.current)if(Py(l,d)){r&&l.preventDefault();let m=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(m);break}}}return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[r]),{registerShortcut:n,unregisterShortcut:i,isEnabled:a}}function Ly(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Iy(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 By(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Iy(e),r=t?Ly(t):"";return a?`${a} + ${r}`:r}function Ry(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 Xl({shortcuts:e=Yn,isOpen:t,onClose:a,className:r}){let[o,s]=useState(false);if(useEffect(()=>{s(true);},[]),useEffect(()=>{function i(c){c.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[t,a]),!o||!t)return null;let n=Ry(e);return jsxs("div",{className:u("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsx("div",{className:"absolute inset-0 backdrop-blur-sm bg-black/40 dark:bg-black/60",onClick:a}),jsxs("div",{className:"relative backdrop-blur-xl rounded-2xl border shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden bg-white dark:bg-gradient-to-br dark:from-gray-900/95 dark:to-gray-800/95 border-gray-200 dark:border-white/20",children:[jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between border-gray-200 dark:border-white/10",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold flex items-center gap-3 text-gray-900 dark:text-white",children:[jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsx("p",{className:"text-sm mt-1 text-gray-500 dark:text-white/60",children:"Speed up your workflow with these shortcuts"})]}),jsx("button",{onClick:a,className:"transition-colors text-2xl leading-none p-2 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:text-white/50 dark:hover:text-white dark:hover:bg-white/10","aria-label":"Close",children:"\xD7"})]}),jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(n).map(([i,c])=>c.length===0?null:jsxs("div",{children:[jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white/90",children:[jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),i]}),jsx("div",{className:"space-y-3",children:c.map(l=>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:l.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:By(l)})]},l.action))})]},i))})}),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 Jl=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
|
|
86
86
|
1.
|
|
87
87
|
|
|
88
88
|
**Expected behavior:**
|
|
@@ -122,13 +122,13 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
122
122
|
1.
|
|
123
123
|
|
|
124
124
|
**Action items:**
|
|
125
|
-
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Jl({templates:e,onSelectTemplate:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null);useEffect(()=>{function l(p){s.current&&!s.current.contains(p.target)&&n.current&&!n.current.contains(p.target)&&o(false);}if(r)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]);let i=l=>{t(l),o(false);},c=e.reduce((l,p)=>{let d=p.category||"Other";return l[d]||(l[d]=[]),l[d].push(p),l},{});return jsxs("div",{className:u("relative inline-block",a),children:[jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",l.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",l.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsx("span",{children:"Templates"}),jsx("svg",{className:u("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(c).map(([l,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:l})}),jsx("div",{children:p.map(d=>jsxs("button",{onClick:()=>i(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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.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))})]},l)),e.length===0&&jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function Zl({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,i]=useState("export"),[c,l]=useState("json"),[p,d]=useState(null),m=useRef(null);if(!t)return null;let g=async()=>{let h=o?.current||void 0,v=await Xc(e,c,h);Jc(v,c);},b=async h=>{let v=h.target.files?.[0];if(v){try{let f=await eu(v),y=v.name.endsWith(".json")?"json":"csv",w=Zc(f,y);d(w),w.success&&r&&r(w,f);}catch(f){d({success:false,errors:[`Failed to read file: ${f instanceof Error?f.message:"Unknown error"}`]});}m.current&&(m.current.value="");}};return jsxs("div",{className:u("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxs("div",{className:"flex border-b border-white/10",children:[jsx("button",{onClick:()=>i("export"),className:u("flex-1 px-6 py-4 font-semibold transition-colors",n==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsx("button",{onClick:()=>i("import"),className:u("flex-1 px-6 py-4 font-semibold transition-colors",n==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxs("div",{className:"p-6",children:[n==="export"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(h=>jsxs("button",{onClick:()=>l(h),className:u("p-4 rounded-lg border-2 transition-all text-center",c===h?"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:[h==="json"&&"\u{1F4C4}",h==="csv"&&"\u{1F4CA}",h==="pdf"&&"\u{1F4DD}"]}),jsx("div",{className:"font-semibold uppercase text-xs",children:h})]},h))})]}),jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxs("div",{className:"text-xs text-white/60",children:[jsxs("div",{children:["Board: ",jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxs("div",{children:["Columns: ",jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxs("div",{children:["Cards: ",jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsx("button",{onClick:g,className:"w-full py-3 px-4 bg-gradient-to-r from-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:m,type:"file",accept:".json,.csv",onChange:b,className:"hidden"}),jsxs("button",{onClick:()=>m.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:u("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:u("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((h,v)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",h]},v))})]})]})]})]})]})}var zy=["URGENT","HIGH","MEDIUM","LOW"],Uy=[{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"}],Wy=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function ed({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:i,availableUsers:c=[],availableLabels:l=[],availableColumns:p=[],showQuickFilters:d=true,compact:m=false,groupBy:g="none",onGroupByChange:b}){let[h,v]=useState(true),f=useCallback(k=>{a({search:k.target.value});},[a]),y=useCallback(k=>{a({dateFilter:k.target.value});},[a]),w=useCallback(k=>{r({by:k.target.value});},[r]),x=useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),C=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 ${m?"filter-bar--compact":""} ${h?"filter-bar--collapsed":""}`,children:[jsxs("div",{className:"filter-bar__header",onClick:()=>v(!h),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:h?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:k=>{k.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:k=>{k.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:h?"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"}),C&&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)"]})]}),!h&&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"}),i&&jsx("button",{onClick:i,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:y,className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Dates"}),jsx("option",{value:"overdue",children:"Overdue"}),jsx("option",{value:"today",children:"Today"}),jsx("option",{value:"this-week",children:"This Week"})]})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.priorities[0]||"all",onChange:k=>{let D=k.target.value;a({priorities:D==="all"?[]:[D]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Priorities"}),zy.map(k=>jsx("option",{value:k,children:k},k))]})}),c.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.assignees[0]||"all",onChange:k=>{let D=k.target.value;a({assignees:D==="all"?[]:[D]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Assignees"}),c.map(k=>jsx("option",{value:k.id,children:k.name},k.id))]})}),l.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.labels[0]||"all",onChange:k=>{let D=k.target.value;a({labels:D==="all"?[]:[D]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Labels"}),l.map(k=>jsx("option",{value:k,children:k},k))]})}),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:w,className:"filter-bar__select filter-bar__select--sm",children:Uy.map(k=>jsx("option",{value:k.value,children:k.label},k.value))}),t.by!=="none"&&jsx("button",{onClick:x,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),b&&jsx("div",{className:"filter-bar__field",children:jsx("select",{value:g,onChange:k=>b(k.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Wy.map(k=>jsx("option",{value:k.value,children:k.label},k.value))})}),C&&jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function td({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:i,onExportGanttCSV:c}){let[l,p]=useState(false),d=useRef(null);useEffect(()=>{let g=b=>{d.current&&!d.current.contains(b.target)&&p(false);};return l&&document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g);}},[l]);let m=g=>{g(),p(false);};return jsxs("div",{className:u("relative",r),ref:d,children:[jsxs("button",{onClick:()=>p(!l),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",g.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",g.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":l,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"3"}),jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsx("span",{children:"Config"})]}),l&&jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxs("button",{onClick:()=>m(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxs(Fragment,{children:[jsxs("button",{onClick:()=>m(async()=>await s?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxs("button",{onClick:()=>m(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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxs("button",{onClick:()=>m(async()=>await i?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxs("button",{onClick:()=>m(()=>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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxs("button",{onClick:()=>m(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"5"}),jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxs("button",{onClick:()=>m(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var ad={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:"#2E94FF",danger:"#ef4444",dangerBorder:"rgba(239, 68, 68, 0.3)",dangerBackground:"rgba(239, 68, 68, 0.1)",dangerBackgroundHover:"rgba(239, 68, 68, 0.2)"},shadows:{sm:"0 1px 2px rgba(0, 0, 0, 0.3)",md:"0 4px 12px rgba(0, 0, 0, 0.4)",lg:"0 12px 32px rgba(0, 0, 0, 0.5)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},rd={name:"light",displayName:"Light (Standard)",emoji:"\u2600\uFE0F",colors:{bgPrimary:"#FFFFFF",bgSecondary:"#F7F7F8",bgTertiary:"#EEEFF1",bgCard:"#ffffff",bgHover:"#f3f4f6",bgActive:"#e5e7eb",bgInput:"#f9fafb",textPrimary:"#1A1A1A",textSecondary:"#5A5A5A",textTertiary:"#8A8A8A",textDisabled:"#d1d5db",textInverse:"#ffffff",borderPrimary:"rgba(0, 0, 0, 0.1)",borderSecondary:"rgba(0, 0, 0, 0.05)",borderDefault:"#e5e7eb",borderHover:"#d1d5db",borderSubtle:"#f3f4f6",accentPrimary:"#5E6AD2",accentHover:"#4A56B8",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.08)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.15)",success:"#059669",warning:"#D97706",error:"#DC2626",info:"#2E94FF",danger:"#dc2626",dangerBorder:"rgba(220, 38, 38, 0.3)",dangerBackground:"rgba(220, 38, 38, 0.08)",dangerBackgroundHover:"rgba(220, 38, 38, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.12)",md:"0 4px 12px rgba(0, 0, 0, 0.15)",lg:"0 12px 32px rgba(0, 0, 0, 0.2)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},od={name:"neutral",emoji:"\u26AA",displayName:"Neutral (Zen)",colors:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgTertiary:"#E7E5E4",bgCard:"#FEFEFE",bgHover:"#F0EFEE",bgActive:"#E7E5E4",bgInput:"#FAFAF9",textPrimary:"#1C1917",textSecondary:"#57534E",textTertiary:"#A8A29E",textDisabled:"#D6D3D1",textInverse:"#FAFAF9",borderPrimary:"#E7E5E4",borderSecondary:"#F0EFEE",borderDefault:"#E7E5E4",borderHover:"#D6D3D1",borderSubtle:"#F5F5F4",accentPrimary:"#292524",accentHover:"#44403C",interactivePrimary:"#292524",interactivePrimaryHover:"#44403C",interactivePrimaryBorder:"rgba(41, 37, 36, 0.3)",interactivePrimaryBackground:"rgba(41, 37, 36, 0.06)",interactivePrimaryBackgroundHover:"rgba(41, 37, 36, 0.12)",success:"#15803D",warning:"#CA8A04",error:"#B91C1C",info:"#1D4ED8",danger:"#B91C1C",dangerBorder:"rgba(185, 28, 28, 0.3)",dangerBackground:"rgba(185, 28, 28, 0.08)",dangerBackgroundHover:"rgba(185, 28, 28, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.1)",md:"0 4px 12px rgba(0, 0, 0, 0.12)",lg:"0 12px 32px rgba(0, 0, 0, 0.15)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},Oo={dark:ad,light:rd,neutral:od},Qs="dark";var Zs=createContext(void 0),Qy="asakaa-theme";function Ep({children:e,defaultTheme:t=Qs,storageKey:a=Qy}){let[r,o]=useState(()=>{if(typeof window<"u"){let i=localStorage.getItem(a);if(i&&(i==="dark"||i==="light"||i==="neutral"))return i}return t}),s=useCallback(i=>{o(i),typeof window<"u"&&localStorage.setItem(a,i);},[a]);useEffect(()=>{if(typeof window>"u")return;let i=document.documentElement,c=Oo[r];Object.entries(c.colors).forEach(([p,d])=>{d&&i.style.setProperty(`--theme-${Zy(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 m=c.colors[p];m&&i.style.setProperty(d,m);}),i.setAttribute("data-theme",r),i.classList.remove("theme-dark","theme-light","theme-neutral"),i.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:Oo};return jsx(Zs.Provider,{value:n,children:e})}function un(){let e=useContext(Zs);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Zy(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function nd({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=un();return e?jsxs("div",{className:u("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsx("div",{className:"p-6 space-y-3",children:Object.entries(Oo).map(([s,n])=>jsxs("button",{onClick:()=>{o(s),t();},className:u("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsx("div",{className:"text-3xl",children:n.emoji}),jsxs("div",{className:"text-left flex-1",children:[jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:n.displayName}),jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),r===s&&jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}function Fp(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return dt[e]||dt.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",dt[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",dt[e].bgSecondary),bgGrid:r("--theme-bg-card",dt[e].bgGrid),bgWeekend:r("--theme-bg-hover",dt[e].bgWeekend),border:r("--theme-border-primary",dt[e].border),borderLight:r("--theme-border-subtle",dt[e].borderLight),textPrimary:r("--theme-text-primary",dt[e].textPrimary),textSecondary:r("--theme-text-secondary",dt[e].textSecondary),textTertiary:r("--theme-text-tertiary",dt[e].textTertiary),accent:r("--theme-accent-primary",dt[e].accent),accentHover:r("--theme-accent-hover",dt[e].accentHover),accentLight:r("--theme-accent-primary",dt[e].accentLight),taskBarPrimary:r("--theme-accent-primary",dt[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",dt[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",dt[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",dt[e].dependency),dependencyHover:r("--theme-border-secondary",dt[e].dependencyHover),criticalPath:r("--theme-error",dt[e].criticalPath),criticalPathLight:r("--theme-error",dt[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",dt[e].today):e==="neutral"?r("--theme-text-primary",dt[e].today):r("--theme-error",dt[e].today),todayLight:e==="light"?r("--theme-accent-primary",dt[e].todayLight):e==="neutral"?r("--theme-text-primary",dt[e].todayLight):r("--theme-error",dt[e].todayLight),milestone:r("--theme-warning",dt[e].milestone),milestoneLight:r("--theme-warning",dt[e].milestoneLight),statusTodo:r("--theme-text-tertiary",dt[e].statusTodo),statusInProgress:r("--theme-accent-primary",dt[e].statusInProgress),statusCompleted:r("--theme-success",dt[e].statusCompleted),hoverBg:r("--theme-bg-hover",dt[e].hoverBg),focusRing:r("--theme-accent-primary",dt[e].focusRing),...dt[e].dotGrid&&{dotGrid:dt[e].dotGrid},...dt[e].glassHeader&&{glassHeader:dt[e].glassHeader},...dt[e].glassToolbar&&{glassToolbar:dt[e].glassToolbar},...dt[e].forecastHud&&{forecastHud:dt[e].forecastHud},...dt[e].neonRedGlow&&{neonRedGlow:dt[e].neonRedGlow},...dt[e].executionBarBg&&{executionBarBg:dt[e].executionBarBg}}}var ei={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious",filterAll:"All",filterIncomplete:"Incomplete",filterInProgress:"In Progress",filterCompleted:"Completed",filter:"Filters",filterBy:"FILTER BY STATUS",filterAllDesc:"Show all tasks",filterIncompleteDesc:"Hide completed tasks",filterInProgressDesc:"Tasks currently being worked on",filterCompletedDesc:"Only show finished tasks",clearFilter:"Clear filter",hideCompleted:"Hide Completed Tasks",toDo:"To Do / Pending",wbsLevel:"Level",wbsAllLevels:"All",viewExecution:"Execution",viewOracle:"Pulse View",simulateScenario:"Simulate Scenario",projectForecast:"PROJECT FORECAST",expectedFinish:"Expected Finish",confidence:"Confidence",costAtCompletion:"Cost at Completion",delayLabel:"Delay",earlyLabel:"Early",onTimeLabel:"On Time",budgetOver:"Over",budgetUnder:"Under",baselines:"Baselines",visibility:"Visibility",share:"Share",copySnapshotLink:"Copy Snapshot Link",copied:"Copied!"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",duplicateTask:"Duplicate Task",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today",week:"Week",clickToSetDates:"Click to set dates..."},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},Mp={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso",filterAll:"Todas",filterIncomplete:"Sin completar",filterInProgress:"En progreso",filterCompleted:"Completadas",filter:"Filtros",filterBy:"FILTRAR POR ESTADO",filterAllDesc:"Mostrar todas las tareas",filterIncompleteDesc:"Ocultar tareas completadas",filterInProgressDesc:"Tareas en las que se est\xE1 trabajando",filterCompletedDesc:"Solo mostrar tareas terminadas",clearFilter:"Limpiar filtro",hideCompleted:"Ocultar Tareas Completadas",toDo:"Por Hacer / Pendiente",wbsLevel:"Nivel",wbsAllLevels:"Todos",viewExecution:"Ejecuci\xF3n",viewOracle:"Vista Pulse",simulateScenario:"Simular Escenario",projectForecast:"PRON\xD3STICO DEL PROYECTO",expectedFinish:"Fin Estimado",confidence:"Confianza",costAtCompletion:"Costo al Completar",delayLabel:"Retraso",earlyLabel:"Adelanto",onTimeLabel:"A Tiempo",budgetOver:"Excedido",budgetUnder:"Bajo",baselines:"L\xEDneas Base",visibility:"Visibilidad",share:"Compartir",copySnapshotLink:"Copiar enlace de vista",copied:"\xA1Copiado!"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",duplicateTask:"Duplicar Tarea",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy",week:"Semana",clickToSetDates:"Clic para establecer fechas..."},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},sd={en:ei,es:Mp};function Pp(e){return sd[e]||sd.en}function id(e,t){let a=Pp(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 mn=createContext(ei);function Er(){return useContext(mn)}function ri(e,t,a="left",r=208){let[o,s]=useState({top:0,left:0});return useEffect(()=>{if(!t||!e.current)return;let n=e.current.getBoundingClientRect(),i=n.bottom+4,c;a==="right"?c=n.right-r:c=n.left;let l=8;c+r>window.innerWidth-l&&(c=window.innerWidth-l-r),c<l&&(c=l),s({top:i,left:c});},[t,a,e,r]),o}function Lp({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportMSProject:o,onCopySnapshotLink:s}){let[n,i]=useState(false),[c,l]=useState(null),[p,d]=useState(false),m=useRef(null),g=useRef(null),b=Er(),h=ri(m,n,"right",224),v=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",f=b.toolbar.visibility==="Visibilidad";useEffect(()=>{if(!n)return;let C=k=>{let D=k.target;m.current&&!m.current.contains(D)&&g.current&&!g.current.contains(D)&&i(false);};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[n]);let y=[{id:"png",label:b.toolbar.exportPng,icon:jsx(FileImage,{className:"w-3.5 h-3.5"}),handler:t},{id:"pdf",label:b.toolbar.exportPdf,icon:jsx(FileText,{className:"w-3.5 h-3.5"}),handler:a},{id:"excel",label:b.toolbar.exportExcel,icon:jsx(FileSpreadsheet,{className:"w-3.5 h-3.5"}),handler:r},{id:"msproject",label:b.toolbar.exportMsProject,icon:jsx(FolderKanban,{className:"w-3.5 h-3.5"}),handler:o}].filter(C=>C.handler),w=async(C,k)=>{if(k){l(C);try{await k();}catch(D){console.error(`Export ${C} failed:`,D);}finally{l(null),i(false);}}},x=()=>{s?.(),d(true),setTimeout(()=>d(false),2e3);};return jsxs(Fragment,{children:[jsx(motion.button,{ref:m,onClick:()=>i(!n),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:n?e.accent:e.textTertiary,backgroundColor:n?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:b.toolbar.share,children:jsx(Share2,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:n&&jsxs(motion.div,{ref:g,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:h.top,left:h.left,zIndex:99999,backgroundColor:v?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${v?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:v?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[y.length>0&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:v?"rgba(255,255,255,0.35)":e.textTertiary},children:f?"EXPORTAR":"EXPORT"})}),jsx("div",{className:"py-0.5",children:y.map((C,k)=>jsxs(motion.button,{onClick:()=>w(C.id,C.handler),disabled:c!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:v?"rgba(255,255,255,0.85)":"#111827"},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-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:e.accentLight,color:e.accent},children:c===C.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-3.5 h-3.5"})}):C.icon}),jsx("span",{className:"flex-1 text-left",children:C.label})]},C.id))})]}),y.length>0&&s&&jsx("div",{className:"mx-3 h-px",style:{backgroundColor:v?"rgba(255,255,255,0.06)":e.borderLight}}),s&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:v?"rgba(255,255,255,0.35)":e.textTertiary},children:f?"COMPARTIR":"SHARE"})}),jsx("div",{className:"py-0.5 pb-1.5",children:jsxs(motion.button,{onClick:x,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:v?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:y.length*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:p?"rgba(34,197,94,0.15)":e.accentLight,color:p?"#22C55E":e.accent},children:p?jsx(Check,{className:"w-3.5 h-3.5"}):jsx(Link2,{className:"w-3.5 h-3.5"})}),jsx("span",{className:"flex-1 text-left",children:p?b.toolbar.copied:b.toolbar.copySnapshotLink})]})})]})]})}),document.body)]})}function Nx({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-[11px] 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 Dx({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-[11px] transition-all",style:{color:s?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsx("span",{children: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 Ip({theme:e,value:t,onChange:a,maxDepth:r}){let[o,s]=useState(false),n=useRef(null),i=useRef(null),c=Er(),l=ri(n,o,"left");useEffect(()=>{if(!o)return;let m=g=>{let b=g.target;n.current&&!n.current.contains(b)&&i.current&&!i.current.contains(b)&&s(false);};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[o]);let p=[{value:"all",label:c.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(r,5)},(m,g)=>({value:g+1,label:`L${g+1}`}))],d=t==="all"?c.toolbar.wbsAllLevels||"All":`L${t}`;return jsxs(Fragment,{children:[jsxs(motion.button,{ref:n,onClick:()=>s(!o),className:"flex items-center gap-1.5 px-2 py-1.5 rounded-lg transition-all",style:{backgroundColor:o?e.accentLight:e.bgSecondary,border:`1px solid ${o?e.accent:e.borderLight}`,color:o?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${c.toolbar.wbsLevel||"Level"}: ${d}`,children:[jsx(Layers,{className:"w-3.5 h-3.5"}),jsx("span",{className:"text-[11px] font-medium",style:{fontFamily:"'JetBrains Mono', monospace"},children:d})]}),createPortal(jsx(AnimatePresence,{children:o&&jsx(motion.div,{ref:i,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-24 rounded-xl overflow-hidden",style:{top:l.top,left:l.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsx("div",{className:"py-1",children:p.map((m,g)=>{let b=t===m.value;return jsxs(motion.button,{onClick:()=>{a(m.value),s(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:b?e.accentLight:"transparent",borderBottom:g<p.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none"},whileHover:{backgroundColor:b?e.accentLight:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:g*.03},children:[jsx("span",{className:"text-[11px]",style:{color:b?e.accent:e.textPrimary,fontFamily:"'JetBrains Mono', monospace",fontWeight:b?600:500},children:m.label}),b&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(m.value))})})})}),document.body)]})}function Bp({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=useState(false),i=useRef(null),c=useRef(null),l=Er(),p=ri(i,s,"left");useEffect(()=>{if(!s)return;let b=setTimeout(()=>{let h=f=>{let y=f.target;i.current&&!i.current.contains(y)&&c.current&&!c.current.contains(y)&&n(false);},v=f=>{f.key==="Escape"&&n(false);};document.addEventListener("mousedown",h),document.addEventListener("keydown",v),c._cleanup=()=>{document.removeEventListener("mousedown",h),document.removeEventListener("keydown",v);};},100);return ()=>{clearTimeout(b),c._cleanup&&c._cleanup();}},[s]);let d=[{value:"all",label:l.toolbar.filterAll||"Show All",icon:jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#2E94FF] bg-[#2E94FF]"}),color:"text-[#2E94FF]"},{value:"completed",label:l.toolbar.filterCompleted||"Completed",icon:jsx(CheckCircle2,{className:"w-3.5 h-3.5"}),color:"text-green-500"},{value:"in_progress",label:l.toolbar.filterInProgress||"In Progress",icon:jsx(PlayCircle,{className:"w-3.5 h-3.5"}),color:"text-blue-500"},{value:"incomplete",label:l.toolbar.toDo||"To Do / Pending",icon:jsx(Circle,{className:"w-3.5 h-3.5"}),color:"text-gray-400"}],m=t!=="all"||r,g=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";return jsxs(Fragment,{children:[jsxs(motion.button,{ref:i,onClick:b=>{b.stopPropagation(),n(h=>!h);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:m?g?"rgba(59, 130, 246, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${m?g?"rgba(59, 130, 246, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:m?"#2E94FF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},children:[jsx(Filter,{className:"w-4 h-4"}),jsx("span",{children:l.toolbar.filter||"Filters"}),m&&jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#2E94FF"}})]}),createPortal(jsx(AnimatePresence,{children:s&&jsxs(motion.div,{ref:c,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:p.top,left:p.left,zIndex:99999,backgroundColor:g?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:`1px solid ${g?"rgba(255,255,255,0.08)":"rgb(229 231 235)"}`,boxShadow:g?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:g?"rgba(255,255,255,0.06)":"rgb(229 231 235)"},children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:g?"rgba(255,255,255,0.35)":"#9CA3AF",fontFamily:"Inter, sans-serif"},children:l.toolbar.filterBy||"FILTER BY STATUS"})}),jsx("div",{className:"py-1",children:d.map(b=>{let h=t===b.value&&!r,v=()=>b.value==="all"?h?jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#2E94FF] bg-[#2E94FF]"}):jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-gray-400"}):b.icon;return jsxs(motion.button,{onClick:()=>{a(b.value),o&&o(false),n(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:h?g?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsx("span",{className:`${h?b.color:"text-gray-400"} flex-shrink-0`,children:v()}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:b.label}),h&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]},b.value)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(229 231 235)"}}),o&&jsx("div",{className:"py-1",children:jsxs(motion.button,{onClick:()=>{o(!r),r||a("all"),n(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:r?g?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsx(EyeOff,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:r?"#2E94FF":g?"rgba(255,255,255,0.35)":"#9CA3AF"}}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:l.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]})})]})}),document.body)]})}function Sx({value:e,onChange:t,theme:a}){let r=Er(),o=a.bgPrimary==="#050505"||a.textPrimary==="#FFFFFF",s=[{value:"day",label:r.toolbar.day.charAt(0).toUpperCase()},{value:"week",label:r.toolbar.week.charAt(0).toUpperCase()},{value:"month",label:r.toolbar.month.charAt(0).toUpperCase()}];return jsx("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:o?"#000000":a.bgSecondary,border:`1px solid ${o?"rgba(255,255,255,0.1)":a.border}`},children:s.map(n=>{let i=e===n.value;return jsx(motion.button,{onClick:()=>t(n.value),className:"relative px-3 py-1 text-[11px] font-medium rounded-full transition-colors",style:{color:i?o?"#FFFFFF":a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:i?o?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent"},whileHover:{color:o?"#FFFFFF":a.textPrimary},whileTap:{scale:.95},children:n.label},n.value)})})}function Ex({theme:e,forecast:t}){let a=Er(),r=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF",o=t?.expectedFinish?t.expectedFinish.toLocaleDateString(void 0,{month:"short",day:"numeric"}):"\u2014",s=t?.delayDays,n=s!=null,i=s!=null?s>0?`+${s}d ${a.toolbar.delayLabel}`:s<0?`${s}d ${a.toolbar.earlyLabel}`:a.toolbar.onTimeLabel:null,c=s!=null&&s>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:s!=null&&s<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",text:e.textTertiary},l=t?.confidencePercent,p=l!=null?l>=75?"#22C55E":l>=40?"#F59E0B":"#EF4444":e.textTertiary,d=t?.costAtCompletion,m=t?.currency||"$",g=d!=null?d>=1e6?`${m}${(d/1e6).toFixed(2)}M`:d>=1e3?`${m}${(d/1e3).toFixed(1)}K`:`${m}${d.toFixed(0)}`:"\u2014",b=t?.budgetVariancePercent,h=b!=null&&b!==0,v=b!=null?b>0?`+${b.toFixed(0)}% ${a.toolbar.budgetOver}`:`${b.toFixed(0)}% ${a.toolbar.budgetUnder}`:null,f=b!=null&&b>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:b!=null&&b<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:"transparent",text:e.textTertiary};return jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.forecastHud||(r?"rgba(15,15,15,0.9)":"rgba(248,250,252,0.95)"),borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsxs("div",{className:"flex items-center gap-6",children:[jsx("span",{className:"text-[9px] uppercase tracking-[0.15em]",style:{color:e.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:a.toolbar.projectForecast}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[13px] font-semibold",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.expectedFinish,": ",o]}),n&&i&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:c.bg,color:c.text,fontFamily:"'JetBrains Mono', monospace"},children:i})]})]}),jsxs("div",{className:"flex items-center gap-6",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.confidence,":"]}),jsx("span",{className:"text-[13px] font-semibold",style:{color:p,fontFamily:"'JetBrains Mono', monospace"},children:l!=null?`${l.toFixed(0)}%`:"\u2014"})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:r?"rgba(255,255,255,0.08)":e.borderLight}}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.costAtCompletion,":"]}),jsx("span",{className:"text-[13px] font-bold",style:{color:e.textPrimary,fontFamily:"'JetBrains Mono', monospace"},children:g}),h&&v&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:f.bg,color:f.text,fontFamily:"'JetBrains Mono', monospace"},children:v})]})]})]})}function Fx({theme:e,showCriticalPath:t,onShowCriticalPathChange:a,showBaseline:r,onShowBaselineChange:o,highlightWeekends:s,onHighlightWeekendsChange:n,showDependencies:i,onShowDependenciesChange:c,rowDensity:l,onRowDensityChange:p,hasDependencies:d=true}){let[m,g]=useState(false),b=useRef(null),h=useRef(null),v=Er(),f=ri(b,m,"right",208),y=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";useEffect(()=>{if(!m)return;let k=D=>{let T=D.target;b.current&&!b.current.contains(T)&&h.current&&!h.current.contains(T)&&g(false);};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[m]);let w=v.toolbar.visibility==="Visibilidad",x=[{key:"criticalPath",label:w?"Ruta Cr\xEDtica":"Critical Path",icon:Zap,active:t,onChange:a,disabled:!d,tooltip:d?void 0:w?"Agrega dependencias entre tareas para ver la ruta cr\xEDtica":"Add dependencies between tasks to see the critical path"},{key:"baselines",label:w?"L\xEDneas Base":"Baselines",icon:Layers,active:r,onChange:o},{key:"weekends",label:w?"Fines de Semana":"Weekends",icon:CalendarDays,active:s,onChange:n},{key:"dependencies",label:w?"Dependencias":"Dependencies",icon:GitBranch,active:i,onChange:c}],C=[{value:"compact",label:v.toolbar.visibility==="Visibilidad"?"Compacto":"Compact"},{value:"comfortable",label:"Normal"},{value:"spacious",label:v.toolbar.visibility==="Visibilidad"?"Amplio":"Spacious"}];return jsxs(Fragment,{children:[jsx(motion.button,{ref:b,onClick:()=>g(!m),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:m?e.accent:e.textTertiary,backgroundColor:m?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:v.toolbar.visibility,children:jsx(Eye,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:m&&jsxs(motion.div,{ref:h,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-52 rounded-xl overflow-hidden",style:{top:f.top,left:f.left,zIndex:99999,backgroundColor:y?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${y?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:y?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:y?"rgba(255,255,255,0.35)":e.textTertiary},children:v.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsx("div",{className:"py-0.5",children:x.map((k,D)=>{let T=k.icon,I=k.disabled,$=k.tooltip;return jsxs(motion.button,{onClick:()=>!I&&k.onChange?.(!k.active),className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:I?y?"rgba(255,255,255,0.3)":"#9CA3AF":y?"rgba(255,255,255,0.85)":"#111827",cursor:I?"not-allowed":"pointer"},whileHover:I?{}:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:D*.03},title:$,children:[jsx(T,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:I?y?"rgba(255,255,255,0.2)":"#D1D5DB":k.active?e.accent||"#2E94FF":e.textTertiary}}),jsx("span",{className:"flex-1 text-left",children:k.label}),k.active&&!I&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},k.key)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:y?"rgba(255,255,255,0.06)":e.borderLight}}),jsxs("div",{className:"py-0.5",children:[jsx("div",{className:"px-3 pt-2 pb-1",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:y?"rgba(255,255,255,0.35)":e.textTertiary},children:v.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),C.map((k,D)=>{let T=l===k.value;return jsxs(motion.button,{onClick:()=>p(k.value),className:"w-full flex items-center justify-between px-3 py-2 text-[11px] transition-colors",style:{color:y?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:(x.length+D)*.03},children:[jsx("span",{style:{color:T?e.accent||"#2E94FF":y?"rgba(255,255,255,0.85)":e.textPrimary},children:k.label}),T&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},k.value)})]})]})}),document.body)]})}function oi({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:i,onRowDensityChange:c,showThemeSelector:l=false,showCreateTaskButton:p=false,createTaskLabel:d,onCreateTask:m,taskFilter:g="all",onTaskFilterChange:b,hideCompleted:h=false,onHideCompletedChange:v,toolbarRightContent:f,wbsLevel:y,onWbsLevelChange:w,maxWbsDepth:x=4,viewMode:C="execution",onViewModeChange:k,projectForecast:D,onExportPNG:T,onExportPDF:I,onExportExcel:$,onExportCSV:A,onExportJSON:_,onExportMSProject:E,showCriticalPath:me=true,onShowCriticalPathChange:L,showDependencies:X=true,onShowDependenciesChange:Z,highlightWeekends:He=true,onHighlightWeekendsChange:O,showBaseline:j=false,onShowBaselineChange:he,onCopySnapshotLink:je,hasDependencies:U=true}){let re=Er(),ee=T||I||$||A||_||E,Ee=!!e.glassToolbar,[we,Be]=useState(false),ze=useRef(null);useEffect(()=>{we&&ze.current&&ze.current.focus();},[we]);let Qe=[{value:"day",label:re.toolbar.day},{value:"week",label:re.toolbar.week},{value:"month",label:re.toolbar.month}],te=[{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"})}],tt=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";if(Ee){let pe=tt?"rgba(255,255,255,0.08)":e.borderLight;return jsxs("div",{className:"flex flex-col",children:[jsxs("div",{className:"h-[52px] px-4 flex items-center justify-between border-b",style:{backgroundColor:e.glassToolbar,borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsxs("div",{className:"flex items-center gap-3",children:[jsxs(motion.div,{className:"flex items-center rounded-full overflow-hidden",style:{backgroundColor:tt?"#1A1A1A":e.bgSecondary,border:`1px solid ${tt?"rgba(255,255,255,0.08)":e.border}`},animate:{width:we?220:36},transition:{type:"spring",stiffness:400,damping:30},children:[jsx(motion.button,{onClick:()=>Be(!we),className:"flex items-center justify-center w-9 h-9 flex-shrink-0",style:{color:e.textTertiary},whileHover:{color:e.textPrimary},children:jsx(Search,{className:"w-4 h-4"})}),we&&jsx("input",{ref:ze,type:"text",placeholder:"Search tasks...",className:"bg-transparent border-none outline-none text-[11px] pr-3 w-full",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},onBlur:()=>Be(false),onKeyDown:at=>{at.key==="Escape"&&Be(false);}})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:pe}}),k&&jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:tt?"#000000":e.bgSecondary,border:`1px solid ${tt?"rgba(255,255,255,0.08)":e.border}`},children:[jsx(motion.button,{onClick:()=>k("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:C==="execution"?tt?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent",color:C==="execution"?e.textPrimary:e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:C!=="execution"?{color:e.textSecondary}:{},children:re.toolbar.viewExecution}),jsx(motion.button,{onClick:()=>k("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:C==="oracle"?tt?"rgba(46,148,255,0.15)":"rgba(37,99,235,0.08)":"transparent",color:C==="oracle"?"#2E94FF":e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:C!=="oracle"?{color:e.textSecondary}:{},children:re.toolbar.viewOracle})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Sx,{value:t,onChange:a,theme:e}),jsx("div",{className:"w-px h-5",style:{backgroundColor:pe}}),w&&jsx(Ip,{theme:e,value:y??"all",onChange:w,maxDepth:x}),b&&jsx(Bp,{theme:e,value:g,onChange:b,hideCompleted:h,onHideCompletedChange:v}),f&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:pe}}),f]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:pe}}),jsx(Fx,{theme:e,showCriticalPath:me,onShowCriticalPathChange:L,showBaseline:j,onShowBaselineChange:he,highlightWeekends:He,onHighlightWeekendsChange:O,showDependencies:X,onShowDependenciesChange:Z,rowDensity:i,onRowDensityChange:c,hasDependencies:U}),jsx(Lp,{theme:e,onExportPNG:T,onExportPDF:I,onExportExcel:$,onExportMSProject:E,onCopySnapshotLink:je}),p&&m&&jsxs(motion.button,{onClick:m,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px]",style:{background:`linear-gradient(135deg, ${e.accent} 0%, ${e.accentHover} 100%)`,color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:`0 2px 8px ${tt?"rgba(46,148,255,0.3)":"rgba(37,99,235,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${tt?"rgba(46,148,255,0.4)":"rgba(37,99,235,0.4)"}`},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:d||re.toolbar.createTask})]})]})]}),D&&jsx(Ex,{theme:e,forecast:D})]})}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(Dx,{options:Qe,value:t,onChange:pe=>a(pe),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-[11px] tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:[Math.round(r*100),"%"]}),jsx(motion.button,{onClick:()=>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}}),w&&jsx(Ip,{theme:e,value:y??"all",onChange:w,maxDepth:x}),b&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsx(Bp,{theme:e,value:g,onChange:b,hideCompleted:h,onHideCompletedChange:v})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[f&&jsxs(Fragment,{children:[f,jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}})]}),p&&m&&jsxs(Fragment,{children:[jsxs(motion.button,{onClick:m,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 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||re.toolbar.createTask})]}),(ee||l)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),jsx(Lp,{theme:e,onExportPNG:T,onExportPDF:I,onExportExcel:$,onExportMSProject:E,onCopySnapshotLink:je}),l&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),l&&jsx(Nx,{options:te,value:s,onChange:pe=>n(pe),theme:e})]})]})}function ni({columns:e,onToggleColumn:t,theme:a}){let[r,o]=useState(false),[s,n]=useState({x:0,y:0}),i=useRef(null),c=useRef(null);useEffect(()=>{if(!r)return;let p=d=>{i.current&&!i.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[r]);let l=e.filter(p=>p.id!=="name");return jsxs(Fragment,{children:[jsx(motion.button,{ref:c,onClick:()=>{if(!r&&c.current){let p=c.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:i,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"}),l.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 bn({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=useRef(null),[i,c]=useState({x:t,y:a});if(useEffect(()=>{if(!e)return;let p=200,d=r.length*36+8,m=8,g=window.innerWidth,b=window.innerHeight,h=t,v=a;t+p+m>g&&(h=t-p,h<m&&(h=m)),a+d+m>b&&(v=b-d-m,v<m&&(v=m)),c({x:h,y:v});},[e,t,a,r.length]),useEffect(()=>{if(!e)return;let p=m=>{n.current&&!n.current.contains(m.target)&&o();},d=m=>{m.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 l=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:`${i.x}px`,top:`${i.y}px`,backgroundColor:l(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 qt={Edit:jsx(Edit3,{className:"w-4 h-4"}),Pencil:jsx(Pencil,{className:"w-4 h-4"}),Delete:jsx(Trash2,{className:"w-4 h-4"}),Add:jsx(Plus,{className:"w-4 h-4"}),AddSubtask:jsx(Plus,{className:"w-4 h-4"}),Remove:jsx(Minus,{className:"w-4 h-4"}),Link:jsx(Link2,{className:"w-4 h-4"}),Progress:jsx(BarChart3,{className:"w-4 h-4"}),Sort:jsx(ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsx(ArrowUp,{className:"w-4 h-4"}),SortDesc:jsx(ArrowDown,{className:"w-4 h-4"}),Hide:jsx(EyeOff,{className:"w-4 h-4"}),Show:jsx(Eye,{className:"w-4 h-4"}),Settings:jsx(Settings,{className:"w-4 h-4"}),Split:jsx(Scissors,{className:"w-4 h-4"}),Duplicate:jsx(Copy,{className:"w-4 h-4"}),MarkIncomplete:jsx(Circle,{className:"w-4 h-4"}),SetInProgress:jsx(PlayCircle,{className:"w-4 h-4"}),MarkComplete:jsx(CheckCircle2,{className:"w-4 h-4"})};function Vp({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:i,onTaskOutdent:c,onTaskRename:l,onTaskToggleExpand:p,onOpenTaskModal:d,enableKeyboard:m=true}){let g=useRef(false),b=useCallback(w=>{g.current=w;},[]),h=useCallback(w=>{let x=[],C=k=>{for(let D of k)x.push(D),D.subtasks&&D.subtasks.length>0&&D.isExpanded&&C(D.subtasks);};return C(w),x},[]),v=useCallback(()=>{let w=h(e);for(let x of w)if(t.has(x.id))return x;return null},[e,t,h]),f=useCallback((w,x)=>{let C=h(e);if(C.length===0)return;let k=v();if(!k){a(C[0].id,false);return}let D=C.findIndex($=>$.id===k.id);if(D===-1)return;let T=w==="up"?D-1:D+1;if(T<0||T>=C.length)return;let I=C[T];a(I.id,x);},[e,v,h,a]),y=useCallback(w=>{if(!m)return;let x=w.target;if(x.tagName==="INPUT"||x.tagName==="TEXTAREA"||x.isContentEditable||g.current){w.key==="Escape"&&(x.blur(),g.current=false);return}let D=navigator.platform.toUpperCase().indexOf("MAC")>=0?w.metaKey:w.ctrlKey,T=Array.from(t),I=v();if(w.key==="ArrowUp"){w.preventDefault(),f("up",w.shiftKey);return}if(w.key==="ArrowDown"){w.preventDefault(),f("down",w.shiftKey);return}if(I&&(w.key==="ArrowRight"||w.key==="ArrowLeft")){I.subtasks&&I.subtasks.length>0&&(w.preventDefault(),(w.key==="ArrowRight"&&!I.isExpanded||w.key==="ArrowLeft"&&I.isExpanded)&&p(I.id));return}if(w.altKey&&(w.key==="ArrowUp"||w.key==="ArrowDown")){T.length>0&&(w.preventDefault(),n(T,w.key==="ArrowUp"?"up":"down"));return}if(w.key==="Tab"&&!w.shiftKey){T.length>0&&(w.preventDefault(),i(T));return}if(w.key==="Tab"&&w.shiftKey){T.length>0&&(w.preventDefault(),c(T));return}if(w.key==="Enter"&&!w.shiftKey&&!D){I&&(w.preventDefault(),r(I.id,"below"));return}if(w.key==="Enter"&&w.shiftKey&&!D){I&&(w.preventDefault(),r(I.id,"above"));return}if(w.key==="Enter"&&D){I&&(w.preventDefault(),d(I.id));return}if(w.key==="F2"){I&&(w.preventDefault(),l(I.id));return}if(w.key==="Delete"||w.key==="Backspace"&&D){T.length>0&&(w.preventDefault(),o(T));return}if(w.key==="d"&&D&&!w.shiftKey){T.length>0&&(w.preventDefault(),s(T));return}},[m,t,v,f,r,o,s,n,i,c,l,p,d]);return useEffect(()=>{if(m)return window.addEventListener("keydown",y),()=>{window.removeEventListener("keydown",y);}},[m,y]),{setIsEditing:b}}function _p(){let[e,t]=useState(new Set),[a,r]=useState(null),o=useCallback(d=>{t(new Set([d])),r(d);},[]),s=useCallback(d=>{t(m=>{let g=new Set(m);return g.has(d)?g.delete(d):g.add(d),g}),r(d);},[]),n=useCallback((d,m)=>{if(!a){o(d);return}let g=m.indexOf(a),b=m.indexOf(d);if(g===-1||b===-1){o(d);return}let h=Math.min(g,b),v=Math.max(g,b),f=m.slice(h,v+1);t(new Set(f)),r(d);},[a,o]),i=useCallback((d,m,g,b)=>{b?n(d,m):g?s(d):o(d);},[o,s,n]),c=useCallback((d,m)=>{m?t(g=>{let b=new Set(g);return b.add(d),b}):o(d);},[o]),l=useCallback(()=>{t(new Set),r(null);},[]),p=useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:i,handleKeyboardSelection:c,clearSelection:l,isTaskSelected:p}}function cd(e){return e.map((t,a)=>({...t,position:a,subtasks:t.subtasks?.length?cd(t.subtasks):t.subtasks}))}function hn(e){let t=[],a=(r,o,s=0)=>{let n=[...r].sort((i,c)=>(i.position??0)-(c.position??0));for(let i=0;i<n.length;i++){let c={...n[i],parentId:o,level:s,position:n[i].position??i};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function si(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=si(a.subtasks,t);if(r)return r}}return null}function dd(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=dd(a.subtasks,t);if(r)return r}return null}function ud(e,t){if(t.length===0)return e;let a=hn(e),r=t[0],o=a.findIndex(m=>m.id===r);if(o<=0)return e;let s=a[o-1],n=(m,g)=>{let b=[];return {tasks:m.filter(v=>{if(g.has(v.id))return b.push(v),false;if(v.subtasks){let f=n(v.subtasks,g);v.subtasks=f.tasks,b.push(...f.removed);}return true}),removed:b}},i=(m,g,b)=>m.map(h=>h.id===g?{...h,subtasks:[...h.subtasks||[],...b],isExpanded:true}:h.subtasks?{...h,subtasks:i(h.subtasks,g,b)}:h),c=new Set(t),{tasks:l,removed:p}=n(e,c),d=i(l,s.id,p);return cd(d)}function pd(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=dd(a,r);if(!o)continue;let s=dd(a,o.id),n=(l,p,d)=>{for(let m=0;m<l.length;m++){let g=l[m];if(g.id===p&&g.subtasks){let b=g.subtasks.findIndex(h=>h.id===d);if(b!==-1){let[h]=g.subtasks.splice(b,1);return h}}if(g.subtasks){let b=n(g.subtasks,p,d);if(b)return b}}return null},i=(l,p,d)=>{let m=l.findIndex(g=>g.id===p);if(m!==-1)return l.splice(m+1,0,d),l;for(let g of l)g.subtasks&&i(g.subtasks,p,d);return l},c=n(a,o.id,r);c&&(s&&s.subtasks?i(s.subtasks,o.id,c):i(a,o.id,c));}return cd(a)}function md(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,i,c)=>{let l=n.findIndex(d=>d.id===i);if(l===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,i,c))return true;return false}let p=c==="up"?l-1:l+1;return p<0||p>=n.length?false:([n[l],n[p]]=[n[p],n[l]],n[l]={...n[l],position:l},n[p]={...n[p],position:p},true)};return s(r,o,a),r}function gd(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 Xn(e,t){let a=[...e],r=[];for(let o of t){let s=(c,l)=>c.map((p,d)=>({...p,id:`${p.id}-copy-${Date.now()}-${d}`,parentId:l,subtasks:p.subtasks?s(p.subtasks,`${p.id}-copy-${Date.now()}-${d}`):void 0})),n=c=>{let l=c.findIndex(g=>g.id===o);if(l===-1){for(let g of c)if(g.subtasks){let b=n(g.subtasks);if(b)return b}return null}let p=c[l],d=`${p.id}-copy-${Date.now()}`,m={...p,id:d,name:`${p.name} (Copy)`,subtasks:p.subtasks?s(p.subtasks,d):void 0};return c.splice(l+1,0,m),m},i=n(a);i&&r.push(i);}return {tasks:a,duplicatedTasks:r}}function jp(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:"#2E94FF"},i=c=>{let l=c.findIndex(d=>d.id===t);if(l===-1){for(let d of c)if(d.subtasks&&i(d.subtasks))return true;return false}let p=a==="above"?l:l+1;return c.splice(p,0,n),true};return i(r),{tasks:r,newTask:n}}function fd(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:fd(r.subtasks,t,a)}:r)}function bd(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:bd(a.subtasks,t)}:a)}function hd(e,t){let a=m=>{for(let g of m){if(g.id===t)return g;if(g.subtasks){let b=a(g.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,i=r?.endDate||s,c=m=>{for(let g of m){if(g.id===t)return (g.subtasks||[]).length;if(g.subtasks){let b=c(g.subtasks);if(b>=0)return b}}return 0},l=c(e),p={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(i),color:r?.color||"#2E94FF",position:l,parentId:t},d=m=>m.map(g=>{if(g.id===t){let b=g.subtasks||[];return {...g,subtasks:[...b,p],isExpanded:true}}return g.subtasks?{...g,subtasks:d(g.subtasks)}:g});return {tasks:d(e),newTask:p}}function Kp(e,t,a,r){if(t===a)return e;let o=si(e,t);if(!o)return e;if(a){let i=(c,l)=>{if(!c.subtasks)return false;for(let p of c.subtasks)if(p.id===l||i(p,l))return true;return false};if(i(o,a))return e}let s=i=>{let c=i.filter(p=>p.id!==t),l=c.length<i.length;return c.map((p,d)=>{let m=l?{...p,position:d}:p;return m.subtasks&&m.subtasks.length>0?{...m,subtasks:s(m.subtasks)}:m})},n=s(e);if(a===null){let i=r!==void 0?r:n.length;n.splice(i,0,{...o,parentId:void 0}),n=n.map((c,l)=>({...c,position:l}));}else {let i=c=>c.map(l=>{if(l.id===a){let p=l.subtasks||[],d=r!==void 0?r:p.length,m=[...p];m.splice(d,0,{...o,parentId:a});let g=m.map((b,h)=>({...b,position:h}));return {...l,subtasks:g,isExpanded:true}}return l.subtasks&&l.subtasks.length>0?{...l,subtasks:i(l.subtasks)}:l});n=i(n);}return n}function yr(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let a=yr(t.subtasks),r=a.reduce((i,c)=>(c.startDate&&i.starts.push(new Date(c.startDate).getTime()),c.endDate&&i.ends.push(new Date(c.endDate).getTime()),i.progresses.push(c.progress??0),i),{starts:[],ends:[],progresses:[]}),o=r.starts.length>0?new Date(Math.min(...r.starts)):t.startDate,s=r.ends.length>0?new Date(Math.max(...r.ends)):t.endDate,n=r.progresses.length>0?Math.round(r.progresses.reduce((i,c)=>i+c,0)/r.progresses.length):t.progress;return {...t,subtasks:a,startDate:o,endDate:s,progress:n}})}function li({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:i,onTaskToggle:c,scrollTop:l,columns:p,onToggleColumn:d,onColumnResize:m,onTaskUpdate:g,onTaskIndent:b,onTaskOutdent:h,onTaskMove:v,onMultiTaskDelete:f,onTaskDuplicate:y,onTaskCreate:w,onTaskRename:x,onCreateSubtask:C,onOpenTaskModal:k,onDeleteRequest:D,onTaskReparent:T,scrollContainerRef:I,showCriticalPath:$=false}){let A=useContext(mn),[_,E]=useState(null),[me,L]=useState(null),[X,Z]=useState(""),He=useRef(null),[O,j]=useState(null),[he,je]=useState(0),[U,re]=useState(0),[ee,Ee]=useState({isOpen:false,x:0,y:0,type:"header"}),[we,Be]=useState(null),[ze,Qe]=useState(null),[te,tt]=useState(null),pe=useRef(0),at=5,pt=useRef(false),[Et,Ce]=useState(null),[rt,it]=useState(false),Ze=useRef(null),[H,de]=useState(null),[N,Y]=useState(false),ie=useRef(null);useEffect(()=>{function le(fe){ie.current&&!ie.current.contains(fe.target)&&Y(false);}if(N)return document.addEventListener("mousedown",le),()=>document.removeEventListener("mousedown",le)},[N]),useEffect(()=>{me&&He.current&&(He.current.focus(),He.current.select());},[me]),useEffect(()=>{if(!O)return;let le=P=>{let K=P.clientX-he,q=U+K;m?.(O,q);},fe=()=>{j(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",le),document.addEventListener("mouseup",fe),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",le),document.removeEventListener("mouseup",fe),document.body.style.cursor="",document.body.style.userSelect="";}},[O,he,U,m]);let{selectedTaskIds:ke,handleTaskClick:V,isTaskSelected:ae}=_p(),{setIsEditing:Ve}=Vp({tasks:e,selectedTaskIds:ke,onTaskSelect:(le,fe)=>{let K=hn(e).map(q=>q.id);V(le,K,fe||false,false);},onTaskCreate:w||(()=>{}),onTaskDelete:f||(()=>{}),onTaskDuplicate:y||(()=>{}),onTaskMove:v||(()=>{}),onTaskIndent:b||(()=>{}),onTaskOutdent:h||(()=>{}),onTaskRename:le=>{let fe=hn(e).find(P=>P.id===le);fe&<(fe);},onTaskToggleExpand:c||(()=>{}),onOpenTaskModal:le=>{let fe=hn(e).find(P=>P.id===le);fe&&k&&k(fe);},enableKeyboard:true}),De=(le,fe=0,P="")=>{let K=[],q=[...le].sort((ce,Se)=>(ce.position??0)-(Se.position??0));for(let ce=0;ce<q.length;ce++){let Se=q[ce],Xe=ce+1,_e=P?`${P}.${Xe}`:`${Xe}.0`;if(Se.wbsCode=_e,K.push({task:Se,level:fe}),Se.subtasks&&Se.subtasks.length>0&&Se.isExpanded){let Ie=P?`${P}.${Xe}`:`${Xe}`;K.push(...De(Se.subtasks,fe+1,Ie));}}return K},Ue=De(e),Ne=48,Ke=Math.max(Ue.length*a,600-Ne),bt=le=>!le.startDate||!le.endDate?"-":`${Math.ceil((le.endDate.getTime()-le.startDate.getTime())/(1e3*60*60*24))}d`,lt=le=>{L(le.id),Z(le.name),Ve(true);},nt=le=>{X.trim()&&X!==e.find(fe=>fe.id===le)?.name&&x?.(le,X.trim()),L(null),Z(""),Ve(false);},et=()=>{L(null),Z(""),Ve(false);},At=(le,fe)=>{fe.stopPropagation(),C?.(le.id);},Mt=(le,fe)=>{fe.preventDefault(),pe.current=fe.clientY,Be(le),pt.current=false,it(false),Ce({x:fe.clientX,y:fe.clientY});},mt=le=>{if(!we||(Math.abs(le.clientY-pe.current)>at&&!pt.current&&(pt.current=true,it(true)),Ce({x:le.clientX,y:le.clientY}),!pt.current))return;if(I?.current){let ce=I.current,Se=ce.getBoundingClientRect(),Xe=60,_e=12;Ze.current&&(cancelAnimationFrame(Ze.current),Ze.current=null);let Ie=le.clientY-Se.top,M=Se.bottom-le.clientY;if(Ie<Xe&&ce.scrollTop>0){let J=Math.round(_e*(1-Ie/Xe)),ye=()=>{ce.scrollTop-=J,pt.current&&ce.scrollTop>0&&(Ze.current=requestAnimationFrame(ye));};Ze.current=requestAnimationFrame(ye);}else if(M<Xe&&ce.scrollTop<ce.scrollHeight-ce.clientHeight){let J=Math.round(_e*(1-M/Xe)),ye=()=>{ce.scrollTop+=J,pt.current&&ce.scrollTop<ce.scrollHeight-ce.clientHeight&&(Ze.current=requestAnimationFrame(ye));};Ze.current=requestAnimationFrame(ye);}}let P=document.querySelectorAll("[data-task-row]"),K=null,q=null;P.forEach(ce=>{let Se=ce.getBoundingClientRect(),Xe=ce.getAttribute("data-task-row");if(Xe&&Xe!==we&&le.clientY>=Se.top&&le.clientY<=Se.bottom){K=Xe;let _e=le.clientY-Se.top,Ie=Se.height;_e<Ie*.25?q="above":_e>Ie*.75?q="below":q="child";}}),Qe(K),tt(q);},yt=()=>{if(pt.current&&we&&ze&&te){if(te==="child")T?.(we,ze);else if(te==="above"||te==="below"){let le=(q,ce,Se=null)=>{for(let Xe of q){if(Xe.id===ce)return Se;if(Xe.subtasks){let _e=le(Xe.subtasks,ce,Xe.id);if(_e!==void 0)return _e}}},fe=le(e,we,null),P=le(e,ze,null),K=(q,ce,Se,Xe)=>{let _e=q.findIndex(J=>J.id===ce),Ie=Xe?q.findIndex(J=>J.id===Se):-1,M=te==="below"?_e+1:_e;return Xe&&Ie!==-1&&Ie<_e&&(M-=1),Math.max(0,M)};if(P===null){let ce=K(e,ze,we,fe===null);T?.(we,null,ce);}else {let q=Ue.find(ce=>ce.task.id===P)?.task;if(q?.subtasks){let ce=fe===P,Se=K(q.subtasks,ze,we,ce);T?.(we,P,Se);}}}}Ze.current&&(cancelAnimationFrame(Ze.current),Ze.current=null),Be(null),Qe(null),tt(null),Ce(null),pt.current=false,it(false);};useEffect(()=>{if(we)return document.addEventListener("mousemove",mt),document.addEventListener("mouseup",yt),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",mt),document.removeEventListener("mouseup",yt),document.body.style.cursor="",document.body.style.userSelect="";}},[we,ze,te]);let gt=(le,fe,P)=>{let K=fe.subtasks&&fe.subtasks.length>0;switch(le.id){case "name":let q=me===fe.id,ce=_===fe.id;return jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${P*20}px`},children:[T&&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:ce?1:.3},onMouseDown:B=>Mt(fe.id,B),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),fe.subtasks&&fe.subtasks.length>0?jsx("button",{onClick:B=>{B.stopPropagation(),c?.(fe.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:fe.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"}),q?jsx("input",{ref:He,type:"text",value:X,onChange:B=>Z(B.target.value),onKeyDown:B=>{B.key==="Enter"?nt(fe.id):B.key==="Escape"&&et();},onBlur:()=>nt(fe.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:B=>B.stopPropagation()}):jsxs(Fragment,{children:[jsxs("span",{className:"flex-1",style:{display:"inline-flex",alignItems:"baseline",gap:"6px",overflow:"hidden",color:fe.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:fe.parentId?"13px":"14px",fontWeight:fe.isMilestone?600:fe.parentId?400:600,letterSpacing:fe.parentId?"0":"-0.01em"},title:fe.name,children:[fe.wbsCode&&jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:fe.wbsCode}),fe.isHighlighted&&fe.status==="completed"&&jsx("span",{title:"\u2605",style:{color:"#F59E0B",fontSize:"10px",flexShrink:0,lineHeight:1},children:"\u2605"}),jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:fe.name}),fe.subtasks&&fe.subtasks.length>0&&jsxs("span",{style:{color:"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"12px",fontWeight:400,flexShrink:0,whiteSpace:"nowrap"},children:["\xB7 ",Math.round(fe.progress||0),"%"]}),$&&fe.isCriticalPath&&jsx("span",{style:{display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#EF4444",flexShrink:0,marginLeft:"2px"}}),$&&fe.cpmData&&jsxs("span",{style:{color:fe.cpmData.totalFloat<=0?"#EF4444":fe.cpmData.totalFloat<=5?"#F59E0B":"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"10px",fontWeight:500,flexShrink:0,whiteSpace:"nowrap",marginLeft:"4px"},children:["TF: ",Math.round(fe.cpmData.totalFloat),"d"]})]}),ce&&!q&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:B=>B.stopPropagation(),children:[jsx("button",{onClick:B=>At(fe,B),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:B=>{B.stopPropagation(),lt(fe);},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 Xe=le.id==="startDate"?"startDate":"endDate",_e=fe[Xe],Ie=H?.taskId===fe.id&&H?.field===Xe,M=B=>B?(typeof B=="string"?new Date(B):B).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:B=>B.stopPropagation(),children:[jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors hover:bg-white/5",style:{color:t.textSecondary,opacity:K?.5:1,cursor:K?"default":"pointer"},title:K?"Auto-calculated from subtasks":void 0,onClick:B=>{if(!K)if(Ie)de(null);else {let z=B.currentTarget.getBoundingClientRect();de({taskId:fe.id,field:Xe,month:_e?typeof _e=="string"?new Date(_e):_e:new Date,position:{top:z.bottom+4,left:z.left}});}},children:[jsx(Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsx("span",{children:M(_e)}),K&&jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),Ie&&typeof document<"u"&&createPortal(jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>de(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:H?.position.top,left:H?.position.left},onClick:B=>B.stopPropagation(),children:[jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let B=new Date,z=new Date(B);z.setDate(B.getDate()+1);let ne=new Date(B);ne.setDate(B.getDate()+7);let S=new Date(B);return S.setDate(B.getDate()+14),[{label:"Hoy",date:B},{label:"Ma\xF1ana",date:z},{label:"Pr\xF3xima semana",date:ne},{label:"2 semanas",date:S}].map((Te,We)=>jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:Tt=>Tt.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Tt=>Tt.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(fe.id,{[Xe]:Te.date}),de(null);},children:Te.label},We))})(),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:B=>B.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:B=>B.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(fe.id,{[Xe]:void 0}),de(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:()=>de(B=>B?{...B,month:new Date(B.month.getFullYear(),B.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:H?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>de(B=>B?{...B,month:new Date(B.month.getFullYear(),B.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((B,z)=>jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:B},z))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let B=H?.month||new Date,z=B.getFullYear(),ne=B.getMonth(),S=new Date(z,ne,1).getDay(),oe=new Date(z,ne+1,0).getDate(),Te=new Date,We=[];for(let Nt=S-1;Nt>=0;Nt--)We.push({day:new Date(z,ne,-Nt).getDate(),date:new Date(z,ne-1,new Date(z,ne,-Nt).getDate()),isCurrentMonth:false});for(let Nt=1;Nt<=oe;Nt++)We.push({day:Nt,date:new Date(z,ne,Nt),isCurrentMonth:true});let Tt=42-We.length;for(let Nt=1;Nt<=Tt;Nt++)We.push({day:Nt,date:new Date(z,ne+1,Nt),isCurrentMonth:false});return We.map((Nt,la)=>{let aa=Nt.date.toDateString()===Te.toDateString(),Ut=(_e?typeof _e=="string"?new Date(_e):_e:null)?.toDateString()===Nt.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:Nt.isCurrentMonth?Ut?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:Ut?"#2E94FF":"transparent",boxShadow:aa&&!Ut?"inset 0 0 0 1px #2E94FF":"none"},onClick:()=>{g?.(fe.id,{[Xe]:Nt.date}),de(null);},children:Nt.day},la)})})()})]})]})]}),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:bt(fe)})});case "assignees":if(K)return jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.4},children:jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:"\u2014"})});let J=r.filter(B=>fe.assignees?.some(z=>z.name===B.name||z.initials===B.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:B=>B.stopPropagation(),children:jsx(Po,{assignedUsers:J,availableUsers:r,onChange:B=>{let z=B.map(ne=>({id:ne.id,name:ne.name,initials:ne.initials,color:ne.color}));g?.(fe.id,{assignees:z.length>0?z:void 0});}})});case "status":if(K){let B=fe.progress===100?"\u2713":fe.progress>0?"\u25D0":"\u25CB";return jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.5},children:jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:B})})}return jsx("div",{className:"flex items-center justify-center w-full",onClick:B=>B.stopPropagation(),children:jsx(xu,{status:fe.status||"todo",onChange:B=>{g?.(fe.id,{status:B,progress:B==="completed"?100:fe.progress});}})});case "progress":return jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:K?.6:1},children:[jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${fe.progress}%`,backgroundColor:fe.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:[fe.progress,"%"]})]});case "priority":let ye={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Le={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},Oe=ye[fe.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:B=>B.stopPropagation(),children:jsx(Fo,{priority:Oe,onChange:B=>{B&&g?.(fe.id,{priority:Le[B]||"medium"});}})});default:return null}},Pt=le=>[{id:"hide",label:"Hide Column",icon:qt.Hide,onClick:()=>d(le),disabled:le==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:qt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:qt.SortDesc,onClick:()=>{}}],Ge=le=>le.subtasks&&le.subtasks.length>0?[{id:"addSubtask",label:A?.contextMenu?.addSubtask||"Add Subtask",icon:qt.Add,onClick:()=>{C?.(le.id);}},{id:"duplicate",label:A?.contextMenu?.duplicateTask||"Duplicate Task",icon:qt.Duplicate,onClick:()=>{y?.([le.id]);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:A?.contextMenu?.deleteTask||"Delete Task",icon:qt.Delete,onClick:()=>{D?D(le.id,le.name):f?.([le.id]);}}]:[{id:"edit",label:A?.contextMenu?.editTask||"Edit Task",icon:qt.Pencil,onClick:()=>{n?.(le);}},{id:"addSubtask",label:A?.contextMenu?.addSubtask||"Add Subtask",icon:qt.Add,onClick:()=>{C?.(le.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:A?.contextMenu?.markIncomplete||"Mark Incomplete",icon:qt.MarkIncomplete,onClick:()=>{g?.(le.id,{status:"todo",progress:0});},disabled:le.status==="todo"},{id:"setInProgress",label:A?.contextMenu?.setInProgress||"Set In Progress",icon:qt.SetInProgress,onClick:()=>{g?.(le.id,{status:"in-progress"});},disabled:le.status==="in-progress"},{id:"markComplete",label:A?.contextMenu?.markComplete||"Mark Complete",icon:qt.MarkComplete,onClick:()=>{g?.(le.id,{status:"completed",progress:100});},disabled:le.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:A?.contextMenu?.duplicateTask||"Duplicate Task",icon:qt.Duplicate,onClick:()=>{y?.([le.id]);}},{id:"split",label:A?.contextMenu?.splitTask||"Split Task",icon:qt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:A?.contextMenu?.deleteTask||"Delete Task",icon:qt.Delete,onClick:()=>{D?D(le.id,le.name):f?.([le.id]);}}],Re=p.filter(le=>le.visible),ut=Re.reduce((le,fe)=>le+fe.width,0);return jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:ut},children:[jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${Ne}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((le,fe)=>{let P=fe===Re.length-1,K=le.id==="name";return jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${K?"":"justify-center"}`,style:{width:`${le.width}px`,minWidth:`${le.minWidth??(K?200:60)}px`,maxWidth:`${le.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:P?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:q=>{q.preventDefault(),Ee({isOpen:true,x:q.clientX,y:q.clientY,type:"header",columnId:le.id});},onMouseEnter:q=>{q.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:q=>{q.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:le.label,children:le.label}),le.resizable&&jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:O===le.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:q=>{q.preventDefault(),q.stopPropagation(),j(le.id),je(q.clientX),re(le.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"}})})]},le.id)})}),jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.glassHeader||t.bgSecondary,zIndex:5},children:[jsx(ni,{columns:p,onToggleColumn:d,theme:t}),jsx("button",{onClick:()=>Y(!N),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"})}),N&&jsxs("div",{ref:ie,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:le=>le.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:()=>Y(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:Ke},children:Ue.map(({task:le,level:fe},P)=>{let K=ae(le.id),q=ze===le.id,ce=q&&te==="above",Se=q&&te==="below",Xe=q&&te==="child",_e={};return Xe&&(_e.backgroundColor=`${t.accent}15`,_e.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":le.id,className:`flex items-center cursor-pointer group ${we===le.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:K?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:K?t.accentLight:Xe?`${t.accent}15`:P%2===0?t.bgPrimary:t.bgGrid,opacity:$?le.isCriticalPath?1:.4:void 0,transition:"opacity 300ms ease",..._e},onMouseEnter:()=>E(le.id),onMouseLeave:()=>E(null),onClick:Ie=>{let J=hn(e).map(Oe=>Oe.id),Le=navigator.platform.toUpperCase().indexOf("MAC")>=0?Ie.metaKey:Ie.ctrlKey;V(le.id,J,Le,Ie.shiftKey),s?.(le);},onDoubleClick:Ie=>{Ie.stopPropagation(),n?.(le);},onContextMenu:Ie=>{Ie.preventDefault(),Ee({isOpen:true,x:Ie.clientX,y:Ie.clientY,type:"task",task:le}),i?.(le,Ie);},whileHover:{backgroundColor:K?t.accentLight:t.hoverBg},children:[ce&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Se&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Re.map((Ie,M)=>{let J=M===Re.length-1,ye=Ie.id==="name";return jsx("div",{className:`px-4 flex items-center ${ye?"justify-start":"justify-center"}`,style:{width:`${Ie.width}px`,minWidth:`${Ie.minWidth??(ye?200:60)}px`,maxWidth:`${Ie.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:J?"none":`1px solid ${_===le.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:gt(Ie,le,ye?fe:0)},`${le.id}-${Ie.id}`)})]},le.id)})}),jsx(bn,{isOpen:ee.isOpen,x:ee.x,y:ee.y,items:ee.type==="header"&&ee.columnId?Pt(ee.columnId):ee.type==="task"&&ee.task?Ge(ee.task):[],onClose:()=>Ee({...ee,isOpen:false}),theme:t}),rt&&Et&&we&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:Et.x+12,top:Et.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let le=Ue.find(fe=>fe.task.id===we)?.task;return le?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:le.name})}):null})()}),document.body)]})}function Qp(e,t){let[a,r]=useState("none"),[o,s]=useState(0),[n,i]=useState(e),[c,l]=useState(t),[p,d]=useState(null),[m,g]=useState(null),[b,h]=useState(null),[v,f]=useState(null),[y,w]=useState(0),[x,C]=useState(0),[k,D]=useState(null),[T,I]=useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:i,ghostWidth:c,setGhostWidth:l,connectionLine:p,setConnectionLine:d,hoveredTaskId:m,setHoveredTaskId:g,activeZone:b,setActiveZone:h,draggedSegmentIndex:v,setDraggedSegmentIndex:f,draggedSegmentStartX:y,setDraggedSegmentStartX:w,segmentDragOffsetX:x,setSegmentDragOffsetX:C,hoveredSegmentIndex:k,setHoveredSegmentIndex:D,isHovered:T,setIsHovered:I,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(me,L)=>{r("none"),d(null),g(null),i(me),l(L),C(0),f(null),w(0);}}}function ui({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:i,onClick:c,onDoubleClick:l,onContextMenu:p,onDateChange:d,onDependencyCreate:m,allTaskPositions:g=[],onDragMove:b,onHoverChange:h,showBaseline:v,showTaskBarLabels:f=true,showCriticalPath:y=true,readOnly:w=false}){let x=Qp(t,r),C=useRef(null),k=useRef(false),D=useRef(null),T=useRef(null),{dragMode:I,setDragMode:$,dragOffset:A,setDragOffset:_,ghostX:E,setGhostX:me,ghostWidth:L,setGhostWidth:X,connectionLine:Z,setConnectionLine:He,hoveredTaskId:O,setHoveredTaskId:j,activeZone:he,setActiveZone:je,draggedSegmentIndex:U,setDraggedSegmentIndex:re,draggedSegmentStartX:ee,setDraggedSegmentStartX:Ee,segmentDragOffsetX:we,setSegmentDragOffsetX:Be,hoveredSegmentIndex:ze,setHoveredSegmentIndex:Qe,isHovered:te,setIsHovered:tt,isDragging:pe,isResizing:at,isConnecting:pt,resetDragState:Et}=x,Ce=18,rt=!!o.executionBarBg,it=o.textPrimary==="#FFFFFF"||o.bgPrimary==="#050505",Ze=rt?3:6,H=e.subtasks&&e.subtasks.length>0,de=e.endDate&&(()=>{let P=new Date;P.setHours(0,0,0,0);let K=new Date(e.endDate);return K.setHours(0,0,0,0),K<P})()&&e.progress<100,N=y&&e.isCriticalPath,Y=o.name==="neutral"||o.today==="#1C1917",ie=e.status==="completed"||e.progress===100,ke={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},ae=y&&e.isCriticalPath||de?"#EF4444":e.color?e.color:e.priority&&ke[e.priority]?ke[e.priority]:o.taskBarPrimary,Ve=w?"default":pe?pt?"crosshair":at?"ew-resize":"grabbing":"grab",De=w?"default":"ew-resize",Ne=(P=>P>=80?20:P>=60?15:P>=50?12:10)(r),Ke=r<50,bt=r<40;useEffect(()=>{h&&(!te||pe||e.segments)&&h(null);},[te,pe,e.segments,h]);let lt=P=>P.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),nt=()=>{let P=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${P} day${P!==1?"s":""}`},et=P=>Math.round(P/s)*s,At=P=>{let K=Math.round(P/s),q=new Date(n);return q.setDate(q.getDate()+K),q},Mt=(P,K)=>{for(let q of g){if(q.id===e.id)continue;let ce=5;if(P>=q.x-ce&&P<=q.x+q.width+ce&&K>=q.y-ce&&K<=q.y+q.height+ce)return q.id}return null},mt=useCallback((P,K,q)=>{if(w)return;P.preventDefault(),P.stopPropagation();let ce=C.current?.ownerSVGElement;if(!ce)return;let Se=ce.createSVGPoint();Se.x=P.clientX,Se.y=P.clientY;let Xe=Se.matrixTransform(ce.getScreenCTM()?.inverse()),_e=q!==void 0?q:t,Ie=K;if(!Ie){let M=Xe.x-_e;P.shiftKey?(Ie="connect",He({x:t+r,y:a+Ce/2})):P.ctrlKey||P.metaKey?Ie="move":P.altKey?Ie=M<r/2?"resize-start":"resize-end":bt?M<r/2?Ie="move":Ie="resize-end":Ke?M<=Ne/2?Ie="resize-start":M>=r-Ne/2?Ie="resize-end":Ie="move":M<=Ne?Ie="resize-start":M>=r-Ne?Ie="resize-end":Ie="move";}k.current=false,$(Ie),tt(false),je(null),Ie==="move"?_(Xe.x-_e):Ie==="connect"?He({x:t+r,y:a+Ce/2}):_(0),me(_e),X(r);},[t,r,a,Ce,w]),yt=useCallback(P=>{let K=C.current?.ownerSVGElement;if(!K)return;let q=K.closest(".gantt-timeline-scroll");if(!q)return;let ce=q.getBoundingClientRect(),Se=60,Xe=15,_e=0;if(P.clientX<ce.left+Se){let Ie=ce.left+Se-P.clientX;_e=-Math.min(Xe,Ie/2);}else if(P.clientX>ce.right-Se){let Ie=P.clientX-(ce.right-Se);_e=Math.min(Xe,Ie/2);}return _e!==0&&(q.scrollLeft+=_e),_e!==0},[]),gt=useCallback(P=>{if(I==="none")return;k.current=true,T.current=P;let K=C.current?.ownerSVGElement;if(!K)return;if(I==="move"||I==="resize-start"||I==="resize-end"){let Se=yt(P);Se&&!D.current?D.current=window.setInterval(()=>{T.current&&(yt(T.current),gt(T.current));},16):!Se&&D.current&&(window.clearInterval(D.current),D.current=null);}let q=K.createSVGPoint();q.x=P.clientX,q.y=P.clientY;let ce=q.matrixTransform(K.getScreenCTM()?.inverse());if(I==="connect"){He({x:ce.x,y:ce.y});let Se=Mt(ce.x,ce.y);j(Se);}else if(I==="move"){let Se=ce.x-A,Xe=et(Se);me(Xe),X(r);let _e=Math.round((Xe-t)/s);if(b?.(e.id,_e,true),e.segments&&e.segments.length>0&&U!==null){let Ie=Xe-ee;Be(Ie);}}else if(I==="resize-start"){let Se=ce.x,Xe=et(Se),_e=t+r-Xe;_e>=s&&(me(Xe),X(_e));}else if(I==="resize-end"){let Se=ce.x,_e=et(Se)-t;_e>=s&&X(_e);}},[I,t,r,s,A,e,et,U,ee,Mt,j,He,me,X,Be,b,yt]),Pt=useCallback(()=>{if(D.current&&(window.clearInterval(D.current),D.current=null),T.current=null,I!=="none"){if(I==="connect")O&&m&&m(e,O),He(null),j(null);else {let P=e.endDate.getTime()-e.startDate.getTime(),K,q,ce=true;if(I==="move"){if(K=At(E),q=new Date(K.getTime()+P),e.segments&&e.segments.length>0&&U!==null){let Se=Math.round(we/s),Xe=e.segments.map((J,ye)=>{if(ye===U){let Le=new Date(J.startDate),Oe=new Date(J.endDate);return Le.setDate(Le.getDate()+Se),Oe.setDate(Oe.getDate()+Se),{startDate:Le,endDate:Oe}}return J}),_e=Xe.flatMap(J=>[J.startDate,J.endDate]),Ie=new Date(Math.min(..._e.map(J=>J.getTime()))),M=new Date(Math.max(..._e.map(J=>J.getTime())));d?.({...e,segments:Xe},Ie,M),Et(t,r);return}}else I==="resize-start"?(K=At(E),q=e.endDate,K>q&&(console.warn("Invalid date range: start date must be before or equal to end date"),ce=false)):I==="resize-end"?(K=e.startDate,q=At(E+L),q.setDate(q.getDate()-1),q<K&&(console.warn("Invalid date range: end date must be after or equal to start date"),ce=false)):ce=false;ce&&K&&q&&(q.getTime()<K.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,K,q));}b?.(e.id,0,false),Et(t,r);}},[I,E,L,e,d,O,m,t,r,s,At,we,U,Et,b]);useEffect(()=>{if(I==="none")return;let P=q=>{gt(q);},K=()=>{Pt();};return window.addEventListener("mousemove",P),window.addEventListener("mouseup",K),()=>{window.removeEventListener("mousemove",P),window.removeEventListener("mouseup",K),D.current&&(window.clearInterval(D.current),D.current=null);}},[I,gt,Pt]);let Ge=pe&&!pt?E:t,Re=pe&&!pt?L:r,ut=i.taskClass(e),le=24,fe=y?e.isCriticalPath?1:.25:1;return jsxs("g",{ref:C,"data-task-bar":"true",style:{opacity:fe,transition:"opacity 300ms ease"},onClick:()=>{!pe&&!k.current&&c?.(e),k.current=false;},onDoubleClick:P=>{!pe&&!k.current&&(P.stopPropagation(),l?.(e));},onContextMenu:P=>{P.preventDefault(),p?.(e,P);},onMouseEnter:()=>!pe&&tt(true),onMouseMove:P=>{h&&te&&!pe&&!e.segments&&h({task:e,x:t,y:a,width:r,height:Ce,showBelow:false,mouseX:P.clientX,mouseY:P.clientY});},onMouseLeave:()=>{pe||(tt(false),je(null));},children:[jsx("rect",{x:t,y:a,width:r+le,height:Ce,fill:"transparent",style:{pointerEvents:"all"}}),te&&!pe&&!Ke&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:Ne,height:Ce,fill:he==="resize-start"?o.accent:"transparent",opacity:he==="resize-start"?.15:0,style:{cursor:De,pointerEvents:"all"},onMouseEnter:()=>je("resize-start"),onMouseDown:P=>mt(P,"resize-start")}),jsx("rect",{x:t+Ne,y:a,width:r-Ne*2,height:Ce,fill:he==="move"?o.accent:"transparent",opacity:he==="move"?.1:0,style:{cursor:w?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>je("move"),onMouseDown:P=>mt(P,"move")}),jsx("rect",{x:t+r-Ne,y:a,width:Ne,height:Ce,fill:he==="resize-end"?o.accent:"transparent",opacity:he==="resize-end"?.15:0,style:{cursor:De,pointerEvents:"all"},onMouseEnter:()=>je("resize-end"),onMouseDown:P=>mt(P,"resize-end")})]}),te&&!pe&&bt&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:r/2,height:Ce,fill:he==="move"?o.accent:"transparent",opacity:he==="move"?.2:0,style:{cursor:w?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>je("move"),onMouseDown:P=>mt(P,"move")}),jsx("rect",{x:t+r/2,y:a,width:r/2,height:Ce,fill:he==="resize-end"?o.accent:"transparent",opacity:he==="resize-end"?.2:0,style:{cursor:De,pointerEvents:"all"},onMouseEnter:()=>je("resize-end"),onMouseDown:P=>mt(P,"resize-end")}),te&&jsx(motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+Ce-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),pe&&!pt&&!e.segments&&jsx(motion.rect,{x:E,y:a,width:L,height:Ce,rx:Ze,fill:o.accent,opacity:.15,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 3",initial:{opacity:0},animate:{opacity:.25},transition:{duration:.15},style:{pointerEvents:"none"}}),v&&e.baselineStartDate&&e.baselineEndDate&&!pe&&(()=>{let P=e.baselineStartDate.getTime(),K=e.baselineEndDate.getTime(),q=n.getTime(),ce=864e5,Se=(P-q)/ce,Xe=(K-P)/ce,_e=Se*s,Ie=Math.max(Xe*s,s),M=Ge+Re,J=_e+Ie,ye=e.endDate?.getTime()??0,Le=Math.ceil((ye-K)/ce),Oe=Le>0,B=Le<-0;return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:_e,y:a,width:Ie,height:Ce,rx:Ze,fill:"none",stroke:it?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),Oe&&M>J&&jsx("rect",{x:J,y:a,width:M-J,height:Ce,rx:0,fill:"#EF4444",opacity:.2}),Oe&&jsxs("text",{x:Math.max(M,J)+6,y:a+Ce/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",Le,"d"]}),B&&jsxs("text",{x:M+6,y:a+Ce/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[Le,"d"]})]})})(),!e.segments&&rt&&H&&(()=>{let K=a+(Ce-8)/2,q=4,ce=e.progress||0,Se=new Date;Se.setHours(0,0,0,0);let Xe=e.startDate&&Se>=e.startDate,_e=e.endDate&&(()=>{let Oe=new Date(e.endDate);return Oe.setHours(0,0,0,0),Se>Oe})(),Ie=e.startDate&&Se<e.startDate,M=1;if(Xe&&e.startDate&&e.endDate&&!Ie){let Oe=new Date(e.startDate);Oe.setHours(0,0,0,0);let B=new Date(e.endDate);B.setHours(0,0,0,0);let z=Math.max(1,(B.getTime()-Oe.getTime())/(1e3*60*60*24)),S=Math.min((Se.getTime()-Oe.getTime())/(1e3*60*60*24),z)/z*100;M=S>0?ce/S:1;}let J;ce>=100?J="#00E5CC":Ie?J="#4B5563":_e&&ce<100?J="#EF4444":M>=.95?J="#22C55E":M>=.8?J="#F59E0B":J="#EF4444";let ye=Math.max(ce/100*Re,ce>0?q*2:0),Le=Re>100&&ce>0;return jsxs("g",{"data-task-class":ut,style:{cursor:"default",pointerEvents:"all"},children:[jsx("rect",{x:Ge,y:K,width:Re,height:8,rx:q,fill:"rgba(255,255,255,0.10)"}),ce>0&&jsx("rect",{x:Ge,y:K,width:ye,height:8,rx:q,fill:J}),Le&&jsxs("text",{x:Ge+ye+6,y:K+8/2,dominantBaseline:"central",fill:"rgba(255,255,255,0.7)",fontSize:"9",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[Math.round(ce),"%"]})]})})(),!e.segments&&rt&&!H&&jsx(motion.rect,{x:Ge,y:a,width:Re,height:Ce,rx:Ze,fill:o.executionBarBg||"rgba(255,255,255,0.06)",stroke:o.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":ut,initial:{opacity:0,scale:.95},animate:{opacity:pe&&!pt?.15:e.parentId?.6:1,scale:te&&!pe?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:P=>mt(P),style:{cursor:Ve,pointerEvents:"all"}}),!e.segments&&!rt&&jsx(motion.rect,{x:Ge,y:a,width:Re,height:Ce,rx:Ze,fill:ae,"data-task-class":ut,initial:{opacity:0,scale:.95},animate:{opacity:pe&&!pt?.15:e.parentId?.6:te?.9:.8,scale:te&&!pe?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:H?void 0:P=>mt(P),style:{cursor:H?"default":Ve,pointerEvents:"all"}}),rt&&(de||N)&&!e.segments&&jsx("rect",{x:Ge,y:a,width:Re,height:Ce,rx:Ze,fill:"none",stroke:o.criticalPath,strokeWidth:2,style:{pointerEvents:"none",filter:`drop-shadow(0 0 6px ${o.criticalPathLight||"rgba(255,46,46,0.4)"})`}}),!e.segments&&e.progress>0&&!H&&jsx("rect",{x:Ge,y:a,width:Math.max(Re*(e.progress/100),Ze*2),height:Ce,rx:Ze,fill:ae,opacity:1,style:{pointerEvents:"none"}}),!e.segments&&!H&&e.progress<100&&(()=>{let P=e.progress>0?Re*(e.progress/100):0,K=Ge+P,q=Re-P,ce=e.progress===0?Ze:0,Se=e.progress===0?Ge:K,Xe=e.progress===0?Re:q;return jsxs(Fragment,{children:[jsx("rect",{x:Se,y:a,width:Xe,height:Ce,rx:ce,fill:"url(#bar-remaining-hatch)",style:{pointerEvents:"none"}}),jsx("rect",{x:Se,y:a,width:Xe,height:Ce,rx:ce,fill:"none",stroke:"#2E94FF",strokeWidth:.8,strokeDasharray:"5 3",style:{pointerEvents:"none"}})]})})(),rt&&!e.segments&&e.progress>0&&e.progress<100&&!H&&!pe&&(()=>{let P=Ge+Re*(e.progress/100),K=8,q=e.assignees?.[0];return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("circle",{cx:P,cy:a+Ce/2,r:K,fill:q?.color||o.accent,stroke:"#000",strokeWidth:1.5}),jsx("text",{x:P,y:a+Ce/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:q?.initials||q?.name?.charAt(0)?.toUpperCase()||""})]})})(),e.segments&&e.segments.map((P,K)=>{let q=(P.startDate.getTime()-n.getTime())/864e5*s,Se=(P.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-q+s,Xe=pe&&I==="move"&&U===K,_e=ze===K,Ie=Xe?q+we:q;return jsxs("g",{onMouseEnter:()=>!pe&&Qe(K),onMouseLeave:()=>!pe&&Qe(null),children:[jsx(motion.rect,{x:Ie,y:a,width:Se,height:Ce,rx:Ze,fill:ae,initial:{opacity:0,scale:.95},animate:{opacity:Xe||e.parentId?.6:_e?.9:.8,scale:_e&&!pe?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:M=>{M.stopPropagation(),re(K),Ee(q),mt(M,void 0,q);},style:{cursor:Ve,pointerEvents:"all"}}),jsx("rect",{x:Ie,y:a,width:Se*(e.progress/100),height:Ce,rx:Ze,fill:ae,opacity:1,style:{pointerEvents:"none"}})]},`segment-${K}`)}),Y&&(de||N)&&!e.segments&&jsxs(Fragment,{children:[N&&!de&&jsx("rect",{x:Ge,y:a,width:Re,height:Ce,rx:Ze,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),de&&jsx("rect",{x:Ge,y:a,width:Re,height:Ce,rx:Ze,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),f&&Re>60&&!e.segments&&!(rt&&H)&&(()=>{let P=i.taskLabel(e),K=typeof P=="string"?P:e.name,q=K.length>Math.floor(Re/8)?`${K.substring(0,Math.floor(Re/8))}...`:K;return jsx("text",{x:Ge+8,y:a+Ce/2,dominantBaseline:"middle",fill:ie?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:ie?"line-through":"none"},children:q})})(),!pe&&!e.segments&&!H&&e.progress>0&&e.progress<100&&(rt?jsxs("text",{x:Ge+Re+6,y:a+Ce/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):Re>100?jsxs("text",{x:Ge+Re-12,y:a+Ce/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):null),e.status&&Re>80&&!pe&&!e.segments&&!(rt&&H)&&jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsx("circle",{cx:Ge+Re-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsx("circle",{cx:Ge+Re-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(te||at)&&!pt&&!e.segments&&!H&&jsxs(Fragment,{children:[jsxs("g",{children:[jsx("rect",{x:Ge-2,y:a,width:16,height:Ce,fill:"transparent",style:{cursor:De},onMouseEnter:()=>je("resize-start"),onMouseLeave:()=>je(null),onMouseDown:P=>{P.stopPropagation(),mt(P,"resize-start");}}),jsx(motion.rect,{x:Ge+4,y:a+8,width:3,height:Ce-16,rx:1.5,fill:he==="resize-start"||I==="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:Ge+Re-14,y:a,width:16,height:Ce,fill:"transparent",style:{cursor:De},onMouseEnter:()=>je("resize-end"),onMouseLeave:()=>je(null),onMouseDown:P=>{P.stopPropagation(),mt(P,"resize-end");}}),jsx(motion.rect,{x:Ge+Re-7,y:a+8,width:3,height:Ce-16,rx:1.5,fill:he==="resize-end"||I==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsx(AnimatePresence,{children:te&&!pe&&!e.segments&&jsxs(motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsx("circle",{cx:t+r+10,cy:a+Ce/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>je("connect"),onMouseLeave:()=>je(null),onMouseDown:P=>{P.stopPropagation(),mt(P,"connect");}}),jsx(motion.circle,{cx:t+r+10,cy:a+Ce/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:he==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),pt&&Z&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:t+r,y1:a+Ce/2,x2:Z.x,y2:Z.y,stroke:O?o.statusCompleted:o.accent,strokeWidth:O?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:O?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:Z.x,cy:Z.y,r:O?8:6,fill:O?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),O&&jsx(motion.text,{x:Z.x+15,y:Z.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:Z.x+10},animate:{opacity:1,x:Z.x+15},transition:{duration:.2},children:"Connect"})]}),(te||pe)&&!pt&&!e.segments&&jsx(motion.rect,{x:Ge-1,y:a-1,width:Re+2,height:Ce+2,rx:Ze+1,fill:"none",stroke:pe?o.accent:rt?"rgba(255,255,255,0.2)":o.taskBarPrimary,strokeWidth:rt?1:2,opacity:pe||rt?.6:.4,initial:{opacity:0},animate:{opacity:pe||rt?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),at&&jsxs(Fragment,{children:[jsx("line",{x1:E,y1:0,x2:E,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsx("line",{x1:E+L,y1:0,x2:E+L,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:te&&!pe&&!e.segments&&!h&&(()=>{let q=a<100,ce=q?a+Ce+13:a-82-13,Se=q?`M ${Ge+Re/2-6} ${a+Ce+3} L ${Ge+Re/2} ${a+Ce+13} L ${Ge+Re/2+6} ${a+Ce+3}`:`M ${Ge+Re/2-6} ${a-13} L ${Ge+Re/2} ${a-3} L ${Ge+Re/2+6} ${a-13}`,Xe=ce+22,_e=ce+40,Ie=ce+55,M=ce+70,J=q?ce+82-5:a-18;return jsxs(motion.g,{initial:{opacity:0,y:q?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:q?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:Se,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsx("rect",{x:Ge+Re/2-120,y:ce,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:Ge+Re/2,y:Xe,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:Ge+Re/2-110,y:_e,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:Ge+Re/2-70,y:_e,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:lt(e.startDate)}),jsx("text",{x:Ge+Re/2-110,y:Ie,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:Ge+Re/2-70,y:Ie,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:lt(e.endDate)}),jsx("text",{x:Ge+Re/2+10,y:_e,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:Ge+Re/2+65,y:_e,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:nt()}),jsx("text",{x:Ge+Re/2+10,y:Ie,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:Ge+Re/2+65,y:Ie,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:Ge+Re/2-110,y:M,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:Ge+Re/2-50,y:M,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(ye=>ye.name).join(", ").substring(0,30),e.assignees.map(ye=>ye.name).join(", ").length>30?"...":""]})]}),!q&&jsx("text",{x:Ge+Re/2,y:J,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:bt?"Left: move \u2022 Right: resize":Ke?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}var yd=260,yn=8,tm=16,bv=-12;function am({tooltipData:e,theme:t,locale:a="en"}){let[r,o]=useState(null);if(useLayoutEffect(()=>{if(!e){o(null);return}let{task:y,mouseX:w,mouseY:x}=e,k=y.effortMinutes!=null||y.timeLoggedMinutes!=null||y.soldEffortMinutes!=null?155:105,D=w+tm,T=x+bv-k;D+yd>window.innerWidth-yn&&(D=w-yd-tm),D<yn&&(D=yn);let I=T<yn;I&&(T=x+20),T+k>window.innerHeight-yn&&(T=window.innerHeight-yn-k),o({left:D,top:T,showBelow:I});},[e]),!e||!r)return null;let{task:s}=e,n=s.effortMinutes!=null||s.timeLoggedMinutes!=null||s.soldEffortMinutes!=null,i={start:a==="es"?"Inicio":"Start",end:a==="es"?"Fin":"End",duration:a==="es"?"Duraci\xF3n":"Duration",progress:a==="es"?"Progreso":"Progress",assignees:a==="es"?"Asignados":"Assignees",estimated:a==="es"?"Estimado":"Estimated",logged:a==="es"?"Registrado":"Logged",quoted:a==="es"?"Ofertado":"Quoted"},c=y=>y.toLocaleDateString(a==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),l=()=>{if(!s.startDate||!s.endDate)return "N/A";let y=Math.ceil((s.endDate.getTime()-s.startDate.getTime())/(1e3*60*60*24));return a==="es"?`${y} d\xEDa${y!==1?"s":""}`:`${y} day${y!==1?"s":""}`},p=y=>{if(y==null||y===0)return "N/A";let w=Math.floor(y/60),x=y%60;return w===0?`${x}m`:x===0?`${w}h`:`${w}h ${x}m`},d=t.textTertiary||"#9CA3AF",m=t.textSecondary||"#D1D5DB",g=t.textPrimary||"#F9FAFB",b=t.accent||"#3B82F6",h=t.bgSecondary||"#1F2937",v=t.border||"#374151",f=jsxs("div",{style:{position:"fixed",left:r.left,top:r.top,width:yd,zIndex:99999,pointerEvents:"none",fontFamily:"Inter, system-ui, sans-serif",animation:"gantt-tooltip-fade 0.12s ease-out"},children:[jsxs("div",{style:{background:h,border:`1px solid ${v}`,borderRadius:8,padding:"12px 14px",boxShadow:"0 8px 24px rgba(0,0,0,0.3)"},children:[jsx("div",{style:{fontSize:13,fontWeight:600,color:g,marginBottom:8,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:s.name}),jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"3px 12px",fontSize:11},children:[jsx(pi,{label:i.start,value:s.startDate?c(s.startDate):"N/A",labelColor:d,valueColor:m}),jsx(pi,{label:i.duration,value:l(),labelColor:d,valueColor:m}),jsx(pi,{label:i.end,value:s.endDate?c(s.endDate):"N/A",labelColor:d,valueColor:m}),jsx(pi,{label:i.progress,value:`${s.progress}%`,labelColor:d,valueColor:m})]}),s.assignees&&s.assignees.length>0&&jsxs("div",{style:{fontSize:11,marginTop:6},children:[jsxs("span",{style:{color:d},children:[i.assignees,": "]}),jsx("span",{style:{color:m,fontWeight:500},children:s.assignees.map(y=>y.name).join(", ")})]}),n&&jsxs("div",{style:{marginTop:6,display:"flex",gap:10,fontSize:11},children:[s.effortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:d},children:[i.estimated,":"]})," ",jsx("span",{style:{color:m,fontWeight:600},children:p(s.effortMinutes)})]}),s.timeLoggedMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:d},children:[i.logged,":"]})," ",jsx("span",{style:{color:b,fontWeight:600},children:p(s.timeLoggedMinutes)})]}),s.soldEffortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:d},children:[i.quoted,":"]})," ",jsx("span",{style:{color:m,fontWeight:600},children:p(s.soldEffortMinutes)})]})]})]}),jsx("style",{children:`
|
|
125
|
+
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Ql({templates:e,onSelectTemplate:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null);useEffect(()=>{function l(p){s.current&&!s.current.contains(p.target)&&n.current&&!n.current.contains(p.target)&&o(false);}if(r)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]);let i=l=>{t(l),o(false);},c=e.reduce((l,p)=>{let d=p.category||"Other";return l[d]||(l[d]=[]),l[d].push(p),l},{});return jsxs("div",{className:u("relative inline-block",a),children:[jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",l.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",l.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsx("span",{children:"Templates"}),jsx("svg",{className:u("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(c).map(([l,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:l})}),jsx("div",{children:p.map(d=>jsxs("button",{onClick:()=>i(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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.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))})]},l)),e.length===0&&jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function ed({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,i]=useState("export"),[c,l]=useState("json"),[p,d]=useState(null),m=useRef(null);if(!t)return null;let g=async()=>{let h=o?.current||void 0,v=await Jc(e,c,h);Qc(v,c);},b=async h=>{let v=h.target.files?.[0];if(v){try{let f=await tu(v),y=v.name.endsWith(".json")?"json":"csv",w=eu(f,y);d(w),w.success&&r&&r(w,f);}catch(f){d({success:false,errors:[`Failed to read file: ${f instanceof Error?f.message:"Unknown error"}`]});}m.current&&(m.current.value="");}};return jsxs("div",{className:u("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxs("div",{className:"flex border-b border-white/10",children:[jsx("button",{onClick:()=>i("export"),className:u("flex-1 px-6 py-4 font-semibold transition-colors",n==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsx("button",{onClick:()=>i("import"),className:u("flex-1 px-6 py-4 font-semibold transition-colors",n==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxs("div",{className:"p-6",children:[n==="export"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(h=>jsxs("button",{onClick:()=>l(h),className:u("p-4 rounded-lg border-2 transition-all text-center",c===h?"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:[h==="json"&&"\u{1F4C4}",h==="csv"&&"\u{1F4CA}",h==="pdf"&&"\u{1F4DD}"]}),jsx("div",{className:"font-semibold uppercase text-xs",children:h})]},h))})]}),jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxs("div",{className:"text-xs text-white/60",children:[jsxs("div",{children:["Board: ",jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxs("div",{children:["Columns: ",jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxs("div",{children:["Cards: ",jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsx("button",{onClick:g,className:"w-full py-3 px-4 bg-gradient-to-r from-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:m,type:"file",accept:".json,.csv",onChange:b,className:"hidden"}),jsxs("button",{onClick:()=>m.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:u("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:u("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((h,v)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",h]},v))})]})]})]})]})]})}var Uy=["URGENT","HIGH","MEDIUM","LOW"],Wy=[{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"}],Vy=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function td({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:i,availableUsers:c=[],availableLabels:l=[],availableColumns:p=[],showQuickFilters:d=true,compact:m=false,groupBy:g="none",onGroupByChange:b}){let[h,v]=useState(true),f=useCallback(k=>{a({search:k.target.value});},[a]),y=useCallback(k=>{a({dateFilter:k.target.value});},[a]),w=useCallback(k=>{r({by:k.target.value});},[r]),x=useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),T=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxs("div",{className:`filter-bar ${m?"filter-bar--compact":""} ${h?"filter-bar--collapsed":""}`,children:[jsxs("div",{className:"filter-bar__header",onClick:()=>v(!h),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:h?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:k=>{k.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:k=>{k.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:h?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsx("polyline",{points:"6 9 12 15 18 9"})}),jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),T&&jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!h&&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"}),i&&jsx("button",{onClick:i,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:y,className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Dates"}),jsx("option",{value:"overdue",children:"Overdue"}),jsx("option",{value:"today",children:"Today"}),jsx("option",{value:"this-week",children:"This Week"})]})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.priorities[0]||"all",onChange:k=>{let S=k.target.value;a({priorities:S==="all"?[]:[S]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Priorities"}),Uy.map(k=>jsx("option",{value:k,children:k},k))]})}),c.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.assignees[0]||"all",onChange:k=>{let S=k.target.value;a({assignees:S==="all"?[]:[S]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Assignees"}),c.map(k=>jsx("option",{value:k.id,children:k.name},k.id))]})}),l.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.labels[0]||"all",onChange:k=>{let S=k.target.value;a({labels:S==="all"?[]:[S]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Labels"}),l.map(k=>jsx("option",{value:k,children:k},k))]})}),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:w,className:"filter-bar__select filter-bar__select--sm",children:Wy.map(k=>jsx("option",{value:k.value,children:k.label},k.value))}),t.by!=="none"&&jsx("button",{onClick:x,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),b&&jsx("div",{className:"filter-bar__field",children:jsx("select",{value:g,onChange:k=>b(k.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Vy.map(k=>jsx("option",{value:k.value,children:k.label},k.value))})}),T&&jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function ad({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:i,onExportGanttCSV:c}){let[l,p]=useState(false),d=useRef(null);useEffect(()=>{let g=b=>{d.current&&!d.current.contains(b.target)&&p(false);};return l&&document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g);}},[l]);let m=g=>{g(),p(false);};return jsxs("div",{className:u("relative",r),ref:d,children:[jsxs("button",{onClick:()=>p(!l),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",g.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",g.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":l,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"3"}),jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsx("span",{children:"Config"})]}),l&&jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxs("button",{onClick:()=>m(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxs(Fragment,{children:[jsxs("button",{onClick:()=>m(async()=>await s?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxs("button",{onClick:()=>m(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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxs("button",{onClick:()=>m(async()=>await i?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxs("button",{onClick:()=>m(()=>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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxs("button",{onClick:()=>m(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"5"}),jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxs("button",{onClick:()=>m(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var rd={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:"#2E94FF",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"}},od={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:"#2E94FF",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"}},nd={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"}},Oo={dark:rd,light:od,neutral:nd},Zs="dark";var ei=createContext(void 0),Zy="asakaa-theme";function Fp({children:e,defaultTheme:t=Zs,storageKey:a=Zy}){let[r,o]=useState(()=>{if(typeof window<"u"){let i=localStorage.getItem(a);if(i&&(i==="dark"||i==="light"||i==="neutral"))return i}return t}),s=useCallback(i=>{o(i),typeof window<"u"&&localStorage.setItem(a,i);},[a]);useEffect(()=>{if(typeof window>"u")return;let i=document.documentElement,c=Oo[r];Object.entries(c.colors).forEach(([p,d])=>{d&&i.style.setProperty(`--theme-${ex(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 m=c.colors[p];m&&i.style.setProperty(d,m);}),i.setAttribute("data-theme",r),i.classList.remove("theme-dark","theme-light","theme-neutral"),i.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:Oo};return jsx(ei.Provider,{value:n,children:e})}function un(){let e=useContext(ei);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function ex(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function sd({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=un();return e?jsxs("div",{className:u("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsx("div",{className:"p-6 space-y-3",children:Object.entries(Oo).map(([s,n])=>jsxs("button",{onClick:()=>{o(s),t();},className:u("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsx("div",{className:"text-3xl",children:n.emoji}),jsxs("div",{className:"text-left flex-1",children:[jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:n.displayName}),jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),r===s&&jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}function Mp(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return ct[e]||ct.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",ct[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",ct[e].bgSecondary),bgGrid:r("--theme-bg-card",ct[e].bgGrid),bgWeekend:r("--theme-bg-hover",ct[e].bgWeekend),border:r("--theme-border-primary",ct[e].border),borderLight:r("--theme-border-subtle",ct[e].borderLight),textPrimary:r("--theme-text-primary",ct[e].textPrimary),textSecondary:r("--theme-text-secondary",ct[e].textSecondary),textTertiary:r("--theme-text-tertiary",ct[e].textTertiary),accent:r("--theme-accent-primary",ct[e].accent),accentHover:r("--theme-accent-hover",ct[e].accentHover),accentLight:r("--theme-accent-primary",ct[e].accentLight),taskBarPrimary:r("--theme-accent-primary",ct[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",ct[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",ct[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",ct[e].dependency),dependencyHover:r("--theme-border-secondary",ct[e].dependencyHover),criticalPath:r("--theme-error",ct[e].criticalPath),criticalPathLight:r("--theme-error",ct[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",ct[e].today):e==="neutral"?r("--theme-text-primary",ct[e].today):r("--theme-error",ct[e].today),todayLight:e==="light"?r("--theme-accent-primary",ct[e].todayLight):e==="neutral"?r("--theme-text-primary",ct[e].todayLight):r("--theme-error",ct[e].todayLight),milestone:r("--theme-warning",ct[e].milestone),milestoneLight:r("--theme-warning",ct[e].milestoneLight),statusTodo:r("--theme-text-tertiary",ct[e].statusTodo),statusInProgress:r("--theme-accent-primary",ct[e].statusInProgress),statusCompleted:r("--theme-success",ct[e].statusCompleted),hoverBg:r("--theme-bg-hover",ct[e].hoverBg),focusRing:r("--theme-accent-primary",ct[e].focusRing),...ct[e].dotGrid&&{dotGrid:ct[e].dotGrid},...ct[e].glassHeader&&{glassHeader:ct[e].glassHeader},...ct[e].glassToolbar&&{glassToolbar:ct[e].glassToolbar},...ct[e].forecastHud&&{forecastHud:ct[e].forecastHud},...ct[e].neonRedGlow&&{neonRedGlow:ct[e].neonRedGlow},...ct[e].executionBarBg&&{executionBarBg:ct[e].executionBarBg}}}var ti={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious",filterAll:"All",filterIncomplete:"Incomplete",filterInProgress:"In Progress",filterCompleted:"Completed",filter:"Filters",filterBy:"FILTER BY STATUS",filterAllDesc:"Show all tasks",filterIncompleteDesc:"Hide completed tasks",filterInProgressDesc:"Tasks currently being worked on",filterCompletedDesc:"Only show finished tasks",clearFilter:"Clear filter",hideCompleted:"Hide Completed Tasks",toDo:"To Do / Pending",wbsLevel:"Level",wbsAllLevels:"All",viewExecution:"Execution",viewOracle:"Pulse View",simulateScenario:"Simulate Scenario",projectForecast:"PROJECT FORECAST",expectedFinish:"Expected Finish",confidence:"Confidence",costAtCompletion:"Cost at Completion",delayLabel:"Delay",earlyLabel:"Early",onTimeLabel:"On Time",budgetOver:"Over",budgetUnder:"Under",baselines:"Baselines",visibility:"Visibility",share:"Share",copySnapshotLink:"Copy Snapshot Link",copied:"Copied!"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",duplicateTask:"Duplicate Task",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today",week:"Week",clickToSetDates:"Click to set dates..."},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},Pp={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso",filterAll:"Todas",filterIncomplete:"Sin completar",filterInProgress:"En progreso",filterCompleted:"Completadas",filter:"Filtros",filterBy:"FILTRAR POR ESTADO",filterAllDesc:"Mostrar todas las tareas",filterIncompleteDesc:"Ocultar tareas completadas",filterInProgressDesc:"Tareas en las que se est\xE1 trabajando",filterCompletedDesc:"Solo mostrar tareas terminadas",clearFilter:"Limpiar filtro",hideCompleted:"Ocultar Tareas Completadas",toDo:"Por Hacer / Pendiente",wbsLevel:"Nivel",wbsAllLevels:"Todos",viewExecution:"Ejecuci\xF3n",viewOracle:"Vista Pulse",simulateScenario:"Simular Escenario",projectForecast:"PRON\xD3STICO DEL PROYECTO",expectedFinish:"Fin Estimado",confidence:"Confianza",costAtCompletion:"Costo al Completar",delayLabel:"Retraso",earlyLabel:"Adelanto",onTimeLabel:"A Tiempo",budgetOver:"Excedido",budgetUnder:"Bajo",baselines:"L\xEDneas Base",visibility:"Visibilidad",share:"Compartir",copySnapshotLink:"Copiar enlace de vista",copied:"\xA1Copiado!"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",duplicateTask:"Duplicar Tarea",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy",week:"Semana",clickToSetDates:"Clic para establecer fechas..."},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},id={en:ti,es:Pp};function Ap(e){return id[e]||id.en}function ld(e,t){let a=Ap(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 mn=createContext(ti);function Er(){return useContext(mn)}function oi(e,t,a="left",r=208){let[o,s]=useState({top:0,left:0});return useEffect(()=>{if(!t||!e.current)return;let n=e.current.getBoundingClientRect(),i=n.bottom+4,c;a==="right"?c=n.right-r:c=n.left;let l=8;c+r>window.innerWidth-l&&(c=window.innerWidth-l-r),c<l&&(c=l),s({top:i,left:c});},[t,a,e,r]),o}function Ip({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportMSProject:o,onCopySnapshotLink:s}){let[n,i]=useState(false),[c,l]=useState(null),[p,d]=useState(false),m=useRef(null),g=useRef(null),b=Er(),h=oi(m,n,"right",224),v=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",f=b.toolbar.visibility==="Visibilidad";useEffect(()=>{if(!n)return;let T=k=>{let S=k.target;m.current&&!m.current.contains(S)&&g.current&&!g.current.contains(S)&&i(false);};return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[n]);let y=[{id:"png",label:b.toolbar.exportPng,icon:jsx(FileImage,{className:"w-3.5 h-3.5"}),handler:t},{id:"pdf",label:b.toolbar.exportPdf,icon:jsx(FileText,{className:"w-3.5 h-3.5"}),handler:a},{id:"excel",label:b.toolbar.exportExcel,icon:jsx(FileSpreadsheet,{className:"w-3.5 h-3.5"}),handler:r},{id:"msproject",label:b.toolbar.exportMsProject,icon:jsx(FolderKanban,{className:"w-3.5 h-3.5"}),handler:o}].filter(T=>T.handler),w=async(T,k)=>{if(k){l(T);try{await k();}catch(S){console.error(`Export ${T} failed:`,S);}finally{l(null),i(false);}}},x=()=>{s?.(),d(true),setTimeout(()=>d(false),2e3);};return jsxs(Fragment,{children:[jsx(motion.button,{ref:m,onClick:()=>i(!n),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:n?e.accent:e.textTertiary,backgroundColor:n?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:b.toolbar.share,children:jsx(Share2,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:n&&jsxs(motion.div,{ref:g,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:h.top,left:h.left,zIndex:99999,backgroundColor:v?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${v?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:v?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[y.length>0&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:v?"rgba(255,255,255,0.35)":e.textTertiary},children:f?"EXPORTAR":"EXPORT"})}),jsx("div",{className:"py-0.5",children:y.map((T,k)=>jsxs(motion.button,{onClick:()=>w(T.id,T.handler),disabled:c!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:v?"rgba(255,255,255,0.85)":"#111827"},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-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:e.accentLight,color:e.accent},children:c===T.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-3.5 h-3.5"})}):T.icon}),jsx("span",{className:"flex-1 text-left",children:T.label})]},T.id))})]}),y.length>0&&s&&jsx("div",{className:"mx-3 h-px",style:{backgroundColor:v?"rgba(255,255,255,0.06)":e.borderLight}}),s&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:v?"rgba(255,255,255,0.35)":e.textTertiary},children:f?"COMPARTIR":"SHARE"})}),jsx("div",{className:"py-0.5 pb-1.5",children:jsxs(motion.button,{onClick:x,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:v?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:y.length*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:p?"rgba(34,197,94,0.15)":e.accentLight,color:p?"#22C55E":e.accent},children:p?jsx(Check,{className:"w-3.5 h-3.5"}):jsx(Link2,{className:"w-3.5 h-3.5"})}),jsx("span",{className:"flex-1 text-left",children:p?b.toolbar.copied:b.toolbar.copySnapshotLink})]})})]})]})}),document.body)]})}function Dx({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-[11px] 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 Sx({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-[11px] transition-all",style:{color:s?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsx("span",{children: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 Bp({theme:e,value:t,onChange:a,maxDepth:r}){let[o,s]=useState(false),n=useRef(null),i=useRef(null),c=Er(),l=oi(n,o,"left");useEffect(()=>{if(!o)return;let m=g=>{let b=g.target;n.current&&!n.current.contains(b)&&i.current&&!i.current.contains(b)&&s(false);};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[o]);let p=[{value:"all",label:c.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(r,5)},(m,g)=>({value:g+1,label:`L${g+1}`}))],d=t==="all"?c.toolbar.wbsAllLevels||"All":`L${t}`;return jsxs(Fragment,{children:[jsxs(motion.button,{ref:n,onClick:()=>s(!o),className:"flex items-center gap-1.5 px-2 py-1.5 rounded-lg transition-all",style:{backgroundColor:o?e.accentLight:e.bgSecondary,border:`1px solid ${o?e.accent:e.borderLight}`,color:o?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${c.toolbar.wbsLevel||"Level"}: ${d}`,children:[jsx(Layers,{className:"w-3.5 h-3.5"}),jsx("span",{className:"text-[11px] font-medium",style:{fontFamily:"'JetBrains Mono', monospace"},children:d})]}),createPortal(jsx(AnimatePresence,{children:o&&jsx(motion.div,{ref:i,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-24 rounded-xl overflow-hidden",style:{top:l.top,left:l.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsx("div",{className:"py-1",children:p.map((m,g)=>{let b=t===m.value;return jsxs(motion.button,{onClick:()=>{a(m.value),s(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:b?e.accentLight:"transparent",borderBottom:g<p.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none"},whileHover:{backgroundColor:b?e.accentLight:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:g*.03},children:[jsx("span",{className:"text-[11px]",style:{color:b?e.accent:e.textPrimary,fontFamily:"'JetBrains Mono', monospace",fontWeight:b?600:500},children:m.label}),b&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(m.value))})})})}),document.body)]})}function Rp({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=useState(false),i=useRef(null),c=useRef(null),l=Er(),p=oi(i,s,"left");useEffect(()=>{if(!s)return;let b=setTimeout(()=>{let h=f=>{let y=f.target;i.current&&!i.current.contains(y)&&c.current&&!c.current.contains(y)&&n(false);},v=f=>{f.key==="Escape"&&n(false);};document.addEventListener("mousedown",h),document.addEventListener("keydown",v),c._cleanup=()=>{document.removeEventListener("mousedown",h),document.removeEventListener("keydown",v);};},100);return ()=>{clearTimeout(b),c._cleanup&&c._cleanup();}},[s]);let d=[{value:"all",label:l.toolbar.filterAll||"Show All",icon:jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#2E94FF] bg-[#2E94FF]"}),color:"text-[#2E94FF]"},{value:"completed",label:l.toolbar.filterCompleted||"Completed",icon:jsx(CheckCircle2,{className:"w-3.5 h-3.5"}),color:"text-green-500"},{value:"in_progress",label:l.toolbar.filterInProgress||"In Progress",icon:jsx(PlayCircle,{className:"w-3.5 h-3.5"}),color:"text-blue-500"},{value:"incomplete",label:l.toolbar.toDo||"To Do / Pending",icon:jsx(Circle,{className:"w-3.5 h-3.5"}),color:"text-gray-400"}],m=t!=="all"||r,g=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";return jsxs(Fragment,{children:[jsxs(motion.button,{ref:i,onClick:b=>{b.stopPropagation(),n(h=>!h);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:m?g?"rgba(59, 130, 246, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${m?g?"rgba(59, 130, 246, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:m?"#2E94FF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},children:[jsx(Filter,{className:"w-4 h-4"}),jsx("span",{children:l.toolbar.filter||"Filters"}),m&&jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#2E94FF"}})]}),createPortal(jsx(AnimatePresence,{children:s&&jsxs(motion.div,{ref:c,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:p.top,left:p.left,zIndex:99999,backgroundColor:g?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:`1px solid ${g?"rgba(255,255,255,0.08)":"rgb(229 231 235)"}`,boxShadow:g?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:g?"rgba(255,255,255,0.06)":"rgb(229 231 235)"},children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:g?"rgba(255,255,255,0.35)":"#9CA3AF",fontFamily:"Inter, sans-serif"},children:l.toolbar.filterBy||"FILTER BY STATUS"})}),jsx("div",{className:"py-1",children:d.map(b=>{let h=t===b.value&&!r,v=()=>b.value==="all"?h?jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#2E94FF] bg-[#2E94FF]"}):jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-gray-400"}):b.icon;return jsxs(motion.button,{onClick:()=>{a(b.value),o&&o(false),n(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:h?g?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsx("span",{className:`${h?b.color:"text-gray-400"} flex-shrink-0`,children:v()}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:b.label}),h&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]},b.value)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(229 231 235)"}}),o&&jsx("div",{className:"py-1",children:jsxs(motion.button,{onClick:()=>{o(!r),r||a("all"),n(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:r?g?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsx(EyeOff,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:r?"#2E94FF":g?"rgba(255,255,255,0.35)":"#9CA3AF"}}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:l.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]})})]})}),document.body)]})}function Ex({value:e,onChange:t,theme:a}){let r=Er(),o=a.bgPrimary==="#050505"||a.textPrimary==="#FFFFFF",s=[{value:"day",label:r.toolbar.day.charAt(0).toUpperCase()},{value:"week",label:r.toolbar.week.charAt(0).toUpperCase()},{value:"month",label:r.toolbar.month.charAt(0).toUpperCase()}];return jsx("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:o?"#000000":a.bgSecondary,border:`1px solid ${o?"rgba(255,255,255,0.1)":a.border}`},children:s.map(n=>{let i=e===n.value;return jsx(motion.button,{onClick:()=>t(n.value),className:"relative px-3 py-1 text-[11px] font-medium rounded-full transition-colors",style:{color:i?o?"#FFFFFF":a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:i?o?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent"},whileHover:{color:o?"#FFFFFF":a.textPrimary},whileTap:{scale:.95},children:n.label},n.value)})})}function Fx({theme:e,forecast:t}){let a=Er(),r=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF",o=t?.expectedFinish?t.expectedFinish.toLocaleDateString(void 0,{month:"short",day:"numeric"}):"\u2014",s=t?.delayDays,n=s!=null,i=s!=null?s>0?`+${s}d ${a.toolbar.delayLabel}`:s<0?`${s}d ${a.toolbar.earlyLabel}`:a.toolbar.onTimeLabel:null,c=s!=null&&s>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:s!=null&&s<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",text:e.textTertiary},l=t?.confidencePercent,p=l!=null?l>=75?"#22C55E":l>=40?"#F59E0B":"#EF4444":e.textTertiary,d=t?.costAtCompletion,m=t?.currency||"$",g=d!=null?d>=1e6?`${m}${(d/1e6).toFixed(2)}M`:d>=1e3?`${m}${(d/1e3).toFixed(1)}K`:`${m}${d.toFixed(0)}`:"\u2014",b=t?.budgetVariancePercent,h=b!=null&&b!==0,v=b!=null?b>0?`+${b.toFixed(0)}% ${a.toolbar.budgetOver}`:`${b.toFixed(0)}% ${a.toolbar.budgetUnder}`:null,f=b!=null&&b>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:b!=null&&b<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:"transparent",text:e.textTertiary};return jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.forecastHud||(r?"rgba(15,15,15,0.9)":"rgba(248,250,252,0.95)"),borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsxs("div",{className:"flex items-center gap-6",children:[jsx("span",{className:"text-[9px] uppercase tracking-[0.15em]",style:{color:e.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:a.toolbar.projectForecast}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[13px] font-semibold",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.expectedFinish,": ",o]}),n&&i&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:c.bg,color:c.text,fontFamily:"'JetBrains Mono', monospace"},children:i})]})]}),jsxs("div",{className:"flex items-center gap-6",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.confidence,":"]}),jsx("span",{className:"text-[13px] font-semibold",style:{color:p,fontFamily:"'JetBrains Mono', monospace"},children:l!=null?`${l.toFixed(0)}%`:"\u2014"})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:r?"rgba(255,255,255,0.08)":e.borderLight}}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.costAtCompletion,":"]}),jsx("span",{className:"text-[13px] font-bold",style:{color:e.textPrimary,fontFamily:"'JetBrains Mono', monospace"},children:g}),h&&v&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:f.bg,color:f.text,fontFamily:"'JetBrains Mono', monospace"},children:v})]})]})]})}function Mx({theme:e,showCriticalPath:t,onShowCriticalPathChange:a,showBaseline:r,onShowBaselineChange:o,highlightWeekends:s,onHighlightWeekendsChange:n,showDependencies:i,onShowDependenciesChange:c,rowDensity:l,onRowDensityChange:p,hasDependencies:d=true}){let[m,g]=useState(false),b=useRef(null),h=useRef(null),v=Er(),f=oi(b,m,"right",208),y=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";useEffect(()=>{if(!m)return;let k=S=>{let C=S.target;b.current&&!b.current.contains(C)&&h.current&&!h.current.contains(C)&&g(false);};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[m]);let w=v.toolbar.visibility==="Visibilidad",x=[{key:"criticalPath",label:w?"Ruta Cr\xEDtica":"Critical Path",icon:Zap,active:t,onChange:a,disabled:!d,tooltip:d?void 0:w?"Agrega dependencias entre tareas para ver la ruta cr\xEDtica":"Add dependencies between tasks to see the critical path"},{key:"baselines",label:w?"L\xEDneas Base":"Baselines",icon:Layers,active:r,onChange:o},{key:"weekends",label:w?"Fines de Semana":"Weekends",icon:CalendarDays,active:s,onChange:n},{key:"dependencies",label:w?"Dependencias":"Dependencies",icon:GitBranch,active:i,onChange:c}],T=[{value:"compact",label:v.toolbar.visibility==="Visibilidad"?"Compacto":"Compact"},{value:"comfortable",label:"Normal"},{value:"spacious",label:v.toolbar.visibility==="Visibilidad"?"Amplio":"Spacious"}];return jsxs(Fragment,{children:[jsx(motion.button,{ref:b,onClick:()=>g(!m),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:m?e.accent:e.textTertiary,backgroundColor:m?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:v.toolbar.visibility,children:jsx(Eye,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:m&&jsxs(motion.div,{ref:h,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-52 rounded-xl overflow-hidden",style:{top:f.top,left:f.left,zIndex:99999,backgroundColor:y?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${y?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:y?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:y?"rgba(255,255,255,0.35)":e.textTertiary},children:v.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsx("div",{className:"py-0.5",children:x.map((k,S)=>{let C=k.icon,I=k.disabled,$=k.tooltip;return jsxs(motion.button,{onClick:()=>!I&&k.onChange?.(!k.active),className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:I?y?"rgba(255,255,255,0.3)":"#9CA3AF":y?"rgba(255,255,255,0.85)":"#111827",cursor:I?"not-allowed":"pointer"},whileHover:I?{}:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:S*.03},title:$,children:[jsx(C,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:I?y?"rgba(255,255,255,0.2)":"#D1D5DB":k.active?e.accent||"#2E94FF":e.textTertiary}}),jsx("span",{className:"flex-1 text-left",children:k.label}),k.active&&!I&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},k.key)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:y?"rgba(255,255,255,0.06)":e.borderLight}}),jsxs("div",{className:"py-0.5",children:[jsx("div",{className:"px-3 pt-2 pb-1",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:y?"rgba(255,255,255,0.35)":e.textTertiary},children:v.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),T.map((k,S)=>{let C=l===k.value;return jsxs(motion.button,{onClick:()=>p(k.value),className:"w-full flex items-center justify-between px-3 py-2 text-[11px] transition-colors",style:{color:y?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:(x.length+S)*.03},children:[jsx("span",{style:{color:C?e.accent||"#2E94FF":y?"rgba(255,255,255,0.85)":e.textPrimary},children:k.label}),C&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},k.value)})]})]})}),document.body)]})}function ni({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:i,onRowDensityChange:c,showThemeSelector:l=false,showCreateTaskButton:p=false,createTaskLabel:d,onCreateTask:m,taskFilter:g="all",onTaskFilterChange:b,hideCompleted:h=false,onHideCompletedChange:v,toolbarRightContent:f,wbsLevel:y,onWbsLevelChange:w,maxWbsDepth:x=4,viewMode:T="execution",onViewModeChange:k,projectForecast:S,onExportPNG:C,onExportPDF:I,onExportExcel:$,onExportCSV:A,onExportJSON:_,onExportMSProject:E,showCriticalPath:me=true,onShowCriticalPathChange:L,showDependencies:X=true,onShowDependenciesChange:ee,highlightWeekends:ze=true,onHighlightWeekendsChange:O,showBaseline:j=false,onShowBaselineChange:he,onCopySnapshotLink:je,hasDependencies:U=true}){let oe=Er(),te=C||I||$||A||_||E,Fe=!!e.glassToolbar,[we,Re]=useState(false),Ue=useRef(null);useEffect(()=>{we&&Ue.current&&Ue.current.focus();},[we]);let Qe=[{value:"day",label:oe.toolbar.day},{value:"week",label:oe.toolbar.week},{value:"month",label:oe.toolbar.month}],ae=[{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"})}],tt=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";if(Fe){let pe=tt?"rgba(255,255,255,0.08)":e.borderLight;return jsxs("div",{className:"flex flex-col",children:[jsxs("div",{className:"h-[52px] px-4 flex items-center justify-between border-b",style:{backgroundColor:e.glassToolbar,borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsxs("div",{className:"flex items-center gap-3",children:[jsxs(motion.div,{className:"flex items-center rounded-full overflow-hidden",style:{backgroundColor:tt?"#1A1A1A":e.bgSecondary,border:`1px solid ${tt?"rgba(255,255,255,0.08)":e.border}`},animate:{width:we?220:36},transition:{type:"spring",stiffness:400,damping:30},children:[jsx(motion.button,{onClick:()=>Re(!we),className:"flex items-center justify-center w-9 h-9 flex-shrink-0",style:{color:e.textTertiary},whileHover:{color:e.textPrimary},children:jsx(Search,{className:"w-4 h-4"})}),we&&jsx("input",{ref:Ue,type:"text",placeholder:"Search tasks...",className:"bg-transparent border-none outline-none text-[11px] pr-3 w-full",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},onBlur:()=>Re(false),onKeyDown:at=>{at.key==="Escape"&&Re(false);}})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:pe}}),k&&jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:tt?"#000000":e.bgSecondary,border:`1px solid ${tt?"rgba(255,255,255,0.08)":e.border}`},children:[jsx(motion.button,{onClick:()=>k("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:T==="execution"?tt?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent",color:T==="execution"?e.textPrimary:e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:T!=="execution"?{color:e.textSecondary}:{},children:oe.toolbar.viewExecution}),jsx(motion.button,{onClick:()=>k("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:T==="oracle"?tt?"rgba(46,148,255,0.15)":"rgba(37,99,235,0.08)":"transparent",color:T==="oracle"?"#2E94FF":e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:T!=="oracle"?{color:e.textSecondary}:{},children:oe.toolbar.viewOracle})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Ex,{value:t,onChange:a,theme:e}),jsx("div",{className:"w-px h-5",style:{backgroundColor:pe}}),w&&jsx(Bp,{theme:e,value:y??"all",onChange:w,maxDepth:x}),b&&jsx(Rp,{theme:e,value:g,onChange:b,hideCompleted:h,onHideCompletedChange:v}),f&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:pe}}),f]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:pe}}),jsx(Mx,{theme:e,showCriticalPath:me,onShowCriticalPathChange:L,showBaseline:j,onShowBaselineChange:he,highlightWeekends:ze,onHighlightWeekendsChange:O,showDependencies:X,onShowDependenciesChange:ee,rowDensity:i,onRowDensityChange:c,hasDependencies:U}),jsx(Ip,{theme:e,onExportPNG:C,onExportPDF:I,onExportExcel:$,onExportMSProject:E,onCopySnapshotLink:je}),p&&m&&jsxs(motion.button,{onClick:m,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px]",style:{background:`linear-gradient(135deg, ${e.accent} 0%, ${e.accentHover} 100%)`,color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:`0 2px 8px ${tt?"rgba(46,148,255,0.3)":"rgba(37,99,235,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${tt?"rgba(46,148,255,0.4)":"rgba(37,99,235,0.4)"}`},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:d||oe.toolbar.createTask})]})]})]}),S&&jsx(Fx,{theme:e,forecast:S})]})}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(Sx,{options:Qe,value:t,onChange:pe=>a(pe),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-[11px] tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:[Math.round(r*100),"%"]}),jsx(motion.button,{onClick:()=>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}}),w&&jsx(Bp,{theme:e,value:y??"all",onChange:w,maxDepth:x}),b&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsx(Rp,{theme:e,value:g,onChange:b,hideCompleted:h,onHideCompletedChange:v})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[f&&jsxs(Fragment,{children:[f,jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}})]}),p&&m&&jsxs(Fragment,{children:[jsxs(motion.button,{onClick:m,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 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||oe.toolbar.createTask})]}),(te||l)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),jsx(Ip,{theme:e,onExportPNG:C,onExportPDF:I,onExportExcel:$,onExportMSProject:E,onCopySnapshotLink:je}),l&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),l&&jsx(Dx,{options:ae,value:s,onChange:pe=>n(pe),theme:e})]})]})}function si({columns:e,onToggleColumn:t,theme:a}){let[r,o]=useState(false),[s,n]=useState({x:0,y:0}),i=useRef(null),c=useRef(null);useEffect(()=>{if(!r)return;let p=d=>{i.current&&!i.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[r]);let l=e.filter(p=>p.id!=="name");return jsxs(Fragment,{children:[jsx(motion.button,{ref:c,onClick:()=>{if(!r&&c.current){let p=c.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:i,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"}),l.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 bn({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=useRef(null),[i,c]=useState({x:t,y:a});if(useEffect(()=>{if(!e)return;let p=200,d=r.length*36+8,m=8,g=window.innerWidth,b=window.innerHeight,h=t,v=a;t+p+m>g&&(h=t-p,h<m&&(h=m)),a+d+m>b&&(v=b-d-m,v<m&&(v=m)),c({x:h,y:v});},[e,t,a,r.length]),useEffect(()=>{if(!e)return;let p=m=>{n.current&&!n.current.contains(m.target)&&o();},d=m=>{m.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 l=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:`${i.x}px`,top:`${i.y}px`,backgroundColor:l(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 Xt={Edit:jsx(Edit3,{className:"w-4 h-4"}),Pencil:jsx(Pencil,{className:"w-4 h-4"}),Delete:jsx(Trash2,{className:"w-4 h-4"}),Add:jsx(Plus,{className:"w-4 h-4"}),AddSubtask:jsx(Plus,{className:"w-4 h-4"}),Remove:jsx(Minus,{className:"w-4 h-4"}),Link:jsx(Link2,{className:"w-4 h-4"}),Progress:jsx(BarChart3,{className:"w-4 h-4"}),Sort:jsx(ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsx(ArrowUp,{className:"w-4 h-4"}),SortDesc:jsx(ArrowDown,{className:"w-4 h-4"}),Hide:jsx(EyeOff,{className:"w-4 h-4"}),Show:jsx(Eye,{className:"w-4 h-4"}),Settings:jsx(Settings,{className:"w-4 h-4"}),Split:jsx(Scissors,{className:"w-4 h-4"}),Duplicate:jsx(Copy,{className:"w-4 h-4"}),MarkIncomplete:jsx(Circle,{className:"w-4 h-4"}),SetInProgress:jsx(PlayCircle,{className:"w-4 h-4"}),MarkComplete:jsx(CheckCircle2,{className:"w-4 h-4"})};function Gp({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:i,onTaskOutdent:c,onTaskRename:l,onTaskToggleExpand:p,onOpenTaskModal:d,enableKeyboard:m=true}){let g=useRef(false),b=useCallback(w=>{g.current=w;},[]),h=useCallback(w=>{let x=[],T=k=>{for(let S of k)x.push(S),S.subtasks&&S.subtasks.length>0&&S.isExpanded&&T(S.subtasks);};return T(w),x},[]),v=useCallback(()=>{let w=h(e);for(let x of w)if(t.has(x.id))return x;return null},[e,t,h]),f=useCallback((w,x)=>{let T=h(e);if(T.length===0)return;let k=v();if(!k){a(T[0].id,false);return}let S=T.findIndex($=>$.id===k.id);if(S===-1)return;let C=w==="up"?S-1:S+1;if(C<0||C>=T.length)return;let I=T[C];a(I.id,x);},[e,v,h,a]),y=useCallback(w=>{if(!m)return;let x=w.target;if(x.tagName==="INPUT"||x.tagName==="TEXTAREA"||x.isContentEditable||g.current){w.key==="Escape"&&(x.blur(),g.current=false);return}let S=navigator.platform.toUpperCase().indexOf("MAC")>=0?w.metaKey:w.ctrlKey,C=Array.from(t),I=v();if(w.key==="ArrowUp"){w.preventDefault(),f("up",w.shiftKey);return}if(w.key==="ArrowDown"){w.preventDefault(),f("down",w.shiftKey);return}if(I&&(w.key==="ArrowRight"||w.key==="ArrowLeft")){I.subtasks&&I.subtasks.length>0&&(w.preventDefault(),(w.key==="ArrowRight"&&!I.isExpanded||w.key==="ArrowLeft"&&I.isExpanded)&&p(I.id));return}if(w.altKey&&(w.key==="ArrowUp"||w.key==="ArrowDown")){C.length>0&&(w.preventDefault(),n(C,w.key==="ArrowUp"?"up":"down"));return}if(w.key==="Tab"&&!w.shiftKey){C.length>0&&(w.preventDefault(),i(C));return}if(w.key==="Tab"&&w.shiftKey){C.length>0&&(w.preventDefault(),c(C));return}if(w.key==="Enter"&&!w.shiftKey&&!S){I&&(w.preventDefault(),r(I.id,"below"));return}if(w.key==="Enter"&&w.shiftKey&&!S){I&&(w.preventDefault(),r(I.id,"above"));return}if(w.key==="Enter"&&S){I&&(w.preventDefault(),d(I.id));return}if(w.key==="F2"){I&&(w.preventDefault(),l(I.id));return}if(w.key==="Delete"||w.key==="Backspace"&&S){C.length>0&&(w.preventDefault(),o(C));return}if(w.key==="d"&&S&&!w.shiftKey){C.length>0&&(w.preventDefault(),s(C));return}},[m,t,v,f,r,o,s,n,i,c,l,p,d]);return useEffect(()=>{if(m)return window.addEventListener("keydown",y),()=>{window.removeEventListener("keydown",y);}},[m,y]),{setIsEditing:b}}function jp(){let[e,t]=useState(new Set),[a,r]=useState(null),o=useCallback(d=>{t(new Set([d])),r(d);},[]),s=useCallback(d=>{t(m=>{let g=new Set(m);return g.has(d)?g.delete(d):g.add(d),g}),r(d);},[]),n=useCallback((d,m)=>{if(!a){o(d);return}let g=m.indexOf(a),b=m.indexOf(d);if(g===-1||b===-1){o(d);return}let h=Math.min(g,b),v=Math.max(g,b),f=m.slice(h,v+1);t(new Set(f)),r(d);},[a,o]),i=useCallback((d,m,g,b)=>{b?n(d,m):g?s(d):o(d);},[o,s,n]),c=useCallback((d,m)=>{m?t(g=>{let b=new Set(g);return b.add(d),b}):o(d);},[o]),l=useCallback(()=>{t(new Set),r(null);},[]),p=useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:i,handleKeyboardSelection:c,clearSelection:l,isTaskSelected:p}}function ud(e){return e.map((t,a)=>({...t,position:a,subtasks:t.subtasks?.length?ud(t.subtasks):t.subtasks}))}function hn(e){let t=[],a=(r,o,s=0)=>{let n=[...r].sort((i,c)=>(i.position??0)-(c.position??0));for(let i=0;i<n.length;i++){let c={...n[i],parentId:o,level:s,position:n[i].position??i};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function ii(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=ii(a.subtasks,t);if(r)return r}}return null}function cd(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=cd(a.subtasks,t);if(r)return r}return null}function pd(e,t){if(t.length===0)return e;let a=hn(e),r=t[0],o=a.findIndex(m=>m.id===r);if(o<=0)return e;let s=a[o-1],n=(m,g)=>{let b=[];return {tasks:m.filter(v=>{if(g.has(v.id))return b.push(v),false;if(v.subtasks){let f=n(v.subtasks,g);v.subtasks=f.tasks,b.push(...f.removed);}return true}),removed:b}},i=(m,g,b)=>m.map(h=>h.id===g?{...h,subtasks:[...h.subtasks||[],...b],isExpanded:true}:h.subtasks?{...h,subtasks:i(h.subtasks,g,b)}:h),c=new Set(t),{tasks:l,removed:p}=n(e,c),d=i(l,s.id,p);return ud(d)}function md(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=cd(a,r);if(!o)continue;let s=cd(a,o.id),n=(l,p,d)=>{for(let m=0;m<l.length;m++){let g=l[m];if(g.id===p&&g.subtasks){let b=g.subtasks.findIndex(h=>h.id===d);if(b!==-1){let[h]=g.subtasks.splice(b,1);return h}}if(g.subtasks){let b=n(g.subtasks,p,d);if(b)return b}}return null},i=(l,p,d)=>{let m=l.findIndex(g=>g.id===p);if(m!==-1)return l.splice(m+1,0,d),l;for(let g of l)g.subtasks&&i(g.subtasks,p,d);return l},c=n(a,o.id,r);c&&(s&&s.subtasks?i(s.subtasks,o.id,c):i(a,o.id,c));}return ud(a)}function gd(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,i,c)=>{let l=n.findIndex(d=>d.id===i);if(l===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,i,c))return true;return false}let p=c==="up"?l-1:l+1;return p<0||p>=n.length?false:([n[l],n[p]]=[n[p],n[l]],n[l]={...n[l],position:l},n[p]={...n[p],position:p},true)};return s(r,o,a),r}function fd(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 Xn(e,t){let a=[...e],r=[];for(let o of t){let s=(c,l)=>c.map((p,d)=>({...p,id:`${p.id}-copy-${Date.now()}-${d}`,parentId:l,subtasks:p.subtasks?s(p.subtasks,`${p.id}-copy-${Date.now()}-${d}`):void 0})),n=c=>{let l=c.findIndex(g=>g.id===o);if(l===-1){for(let g of c)if(g.subtasks){let b=n(g.subtasks);if(b)return b}return null}let p=c[l],d=`${p.id}-copy-${Date.now()}`,m={...p,id:d,name:`${p.name} (Copy)`,subtasks:p.subtasks?s(p.subtasks,d):void 0};return c.splice(l+1,0,m),m},i=n(a);i&&r.push(i);}return {tasks:a,duplicatedTasks:r}}function Kp(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:"#2E94FF"},i=c=>{let l=c.findIndex(d=>d.id===t);if(l===-1){for(let d of c)if(d.subtasks&&i(d.subtasks))return true;return false}let p=a==="above"?l:l+1;return c.splice(p,0,n),true};return i(r),{tasks:r,newTask:n}}function bd(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:bd(r.subtasks,t,a)}:r)}function hd(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:hd(a.subtasks,t)}:a)}function yd(e,t){let a=m=>{for(let g of m){if(g.id===t)return g;if(g.subtasks){let b=a(g.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,i=r?.endDate||s,c=m=>{for(let g of m){if(g.id===t)return (g.subtasks||[]).length;if(g.subtasks){let b=c(g.subtasks);if(b>=0)return b}}return 0},l=c(e),p={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(i),color:r?.color||"#2E94FF",position:l,parentId:t},d=m=>m.map(g=>{if(g.id===t){let b=g.subtasks||[];return {...g,subtasks:[...b,p],isExpanded:true}}return g.subtasks?{...g,subtasks:d(g.subtasks)}:g});return {tasks:d(e),newTask:p}}function Yp(e,t,a,r){if(t===a)return e;let o=ii(e,t);if(!o)return e;if(a){let i=(c,l)=>{if(!c.subtasks)return false;for(let p of c.subtasks)if(p.id===l||i(p,l))return true;return false};if(i(o,a))return e}let s=i=>{let c=i.filter(p=>p.id!==t),l=c.length<i.length;return c.map((p,d)=>{let m=l?{...p,position:d}:p;return m.subtasks&&m.subtasks.length>0?{...m,subtasks:s(m.subtasks)}:m})},n=s(e);if(a===null){let i=r!==void 0?r:n.length;n.splice(i,0,{...o,parentId:void 0}),n=n.map((c,l)=>({...c,position:l}));}else {let i=c=>c.map(l=>{if(l.id===a){let p=l.subtasks||[],d=r!==void 0?r:p.length,m=[...p];m.splice(d,0,{...o,parentId:a});let g=m.map((b,h)=>({...b,position:h}));return {...l,subtasks:g,isExpanded:true}}return l.subtasks&&l.subtasks.length>0?{...l,subtasks:i(l.subtasks)}:l});n=i(n);}return n}function yr(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let a=yr(t.subtasks),r=a.reduce((i,c)=>(c.startDate&&i.starts.push(new Date(c.startDate).getTime()),c.endDate&&i.ends.push(new Date(c.endDate).getTime()),i.progresses.push(c.progress??0),i),{starts:[],ends:[],progresses:[]}),o=r.starts.length>0?new Date(Math.min(...r.starts)):t.startDate,s=r.ends.length>0?new Date(Math.max(...r.ends)):t.endDate,n=r.progresses.length>0?Math.round(r.progresses.reduce((i,c)=>i+c,0)/r.progresses.length):t.progress;return {...t,subtasks:a,startDate:o,endDate:s,progress:n}})}function di({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:i,onTaskToggle:c,scrollTop:l,columns:p,onToggleColumn:d,onColumnResize:m,onTaskUpdate:g,onTaskIndent:b,onTaskOutdent:h,onTaskMove:v,onMultiTaskDelete:f,onTaskDuplicate:y,onTaskCreate:w,onTaskRename:x,onCreateSubtask:T,onOpenTaskModal:k,onDeleteRequest:S,onTaskReparent:C,scrollContainerRef:I,showCriticalPath:$=false}){let A=useContext(mn),[_,E]=useState(null),[me,L]=useState(null),[X,ee]=useState(""),ze=useRef(null),[O,j]=useState(null),[he,je]=useState(0),[U,oe]=useState(0),[te,Fe]=useState({isOpen:false,x:0,y:0,type:"header"}),[we,Re]=useState(null),[Ue,Qe]=useState(null),[ae,tt]=useState(null),pe=useRef(0),at=5,mt=useRef(false),[Ft,Te]=useState(null),[rt,lt]=useState(false),Ze=useRef(null),[H,de]=useState(null),[N,Y]=useState(false),ie=useRef(null);useEffect(()=>{function le(fe){ie.current&&!ie.current.contains(fe.target)&&Y(false);}if(N)return document.addEventListener("mousedown",le),()=>document.removeEventListener("mousedown",le)},[N]),useEffect(()=>{me&&ze.current&&(ze.current.focus(),ze.current.select());},[me]),useEffect(()=>{if(!O)return;let le=P=>{let K=P.clientX-he,q=U+K;m?.(O,q);},fe=()=>{j(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",le),document.addEventListener("mouseup",fe),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",le),document.removeEventListener("mouseup",fe),document.body.style.cursor="",document.body.style.userSelect="";}},[O,he,U,m]);let{selectedTaskIds:ke,handleTaskClick:V,isTaskSelected:re}=jp(),{setIsEditing:Ve}=Gp({tasks:e,selectedTaskIds:ke,onTaskSelect:(le,fe)=>{let K=hn(e).map(q=>q.id);V(le,K,fe||false,false);},onTaskCreate:w||(()=>{}),onTaskDelete:f||(()=>{}),onTaskDuplicate:y||(()=>{}),onTaskMove:v||(()=>{}),onTaskIndent:b||(()=>{}),onTaskOutdent:h||(()=>{}),onTaskRename:le=>{let fe=hn(e).find(P=>P.id===le);fe&&dt(fe);},onTaskToggleExpand:c||(()=>{}),onOpenTaskModal:le=>{let fe=hn(e).find(P=>P.id===le);fe&&k&&k(fe);},enableKeyboard:true}),De=(le,fe=0,P="")=>{let K=[],q=[...le].sort((ce,Se)=>(ce.position??0)-(Se.position??0));for(let ce=0;ce<q.length;ce++){let Se=q[ce],Xe=ce+1,_e=P?`${P}.${Xe}`:`${Xe}.0`;if(Se.wbsCode=_e,K.push({task:Se,level:fe}),Se.subtasks&&Se.subtasks.length>0&&Se.isExpanded){let Be=P?`${P}.${Xe}`:`${Xe}`;K.push(...De(Se.subtasks,fe+1,Be));}}return K},We=De(e),Ne=48,Ke=Math.max(We.length*a,600-Ne),ht=le=>!le.startDate||!le.endDate?"-":`${Math.ceil((le.endDate.getTime()-le.startDate.getTime())/(1e3*60*60*24))}d`,dt=le=>{L(le.id),ee(le.name),Ve(true);},nt=le=>{X.trim()&&X!==e.find(fe=>fe.id===le)?.name&&x?.(le,X.trim()),L(null),ee(""),Ve(false);},et=()=>{L(null),ee(""),Ve(false);},Lt=(le,fe)=>{fe.stopPropagation(),T?.(le.id);},Pt=(le,fe)=>{fe.preventDefault(),pe.current=fe.clientY,Re(le),mt.current=false,lt(false),Te({x:fe.clientX,y:fe.clientY});},gt=le=>{if(!we||(Math.abs(le.clientY-pe.current)>at&&!mt.current&&(mt.current=true,lt(true)),Te({x:le.clientX,y:le.clientY}),!mt.current))return;if(I?.current){let ce=I.current,Se=ce.getBoundingClientRect(),Xe=60,_e=12;Ze.current&&(cancelAnimationFrame(Ze.current),Ze.current=null);let Be=le.clientY-Se.top,M=Se.bottom-le.clientY;if(Be<Xe&&ce.scrollTop>0){let J=Math.round(_e*(1-Be/Xe)),ye=()=>{ce.scrollTop-=J,mt.current&&ce.scrollTop>0&&(Ze.current=requestAnimationFrame(ye));};Ze.current=requestAnimationFrame(ye);}else if(M<Xe&&ce.scrollTop<ce.scrollHeight-ce.clientHeight){let J=Math.round(_e*(1-M/Xe)),ye=()=>{ce.scrollTop+=J,mt.current&&ce.scrollTop<ce.scrollHeight-ce.clientHeight&&(Ze.current=requestAnimationFrame(ye));};Ze.current=requestAnimationFrame(ye);}}let P=document.querySelectorAll("[data-task-row]"),K=null,q=null;P.forEach(ce=>{let Se=ce.getBoundingClientRect(),Xe=ce.getAttribute("data-task-row");if(Xe&&Xe!==we&&le.clientY>=Se.top&&le.clientY<=Se.bottom){K=Xe;let _e=le.clientY-Se.top,Be=Se.height;_e<Be*.25?q="above":_e>Be*.75?q="below":q="child";}}),Qe(K),tt(q);},vt=()=>{if(mt.current&&we&&Ue&&ae){if(ae==="child")C?.(we,Ue);else if(ae==="above"||ae==="below"){let le=(q,ce,Se=null)=>{for(let Xe of q){if(Xe.id===ce)return Se;if(Xe.subtasks){let _e=le(Xe.subtasks,ce,Xe.id);if(_e!==void 0)return _e}}},fe=le(e,we,null),P=le(e,Ue,null),K=(q,ce,Se,Xe)=>{let _e=q.findIndex(J=>J.id===ce),Be=Xe?q.findIndex(J=>J.id===Se):-1,M=ae==="below"?_e+1:_e;return Xe&&Be!==-1&&Be<_e&&(M-=1),Math.max(0,M)};if(P===null){let ce=K(e,Ue,we,fe===null);C?.(we,null,ce);}else {let q=We.find(ce=>ce.task.id===P)?.task;if(q?.subtasks){let ce=fe===P,Se=K(q.subtasks,Ue,we,ce);C?.(we,P,Se);}}}}Ze.current&&(cancelAnimationFrame(Ze.current),Ze.current=null),Re(null),Qe(null),tt(null),Te(null),mt.current=false,lt(false);};useEffect(()=>{if(we)return document.addEventListener("mousemove",gt),document.addEventListener("mouseup",vt),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",gt),document.removeEventListener("mouseup",vt),document.body.style.cursor="",document.body.style.userSelect="";}},[we,Ue,ae]);let ft=(le,fe,P)=>{let K=fe.subtasks&&fe.subtasks.length>0;switch(le.id){case "name":let q=me===fe.id,ce=_===fe.id;return jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${P*20}px`},children:[C&&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:ce?1:.3},onMouseDown:B=>Pt(fe.id,B),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),fe.subtasks&&fe.subtasks.length>0?jsx("button",{onClick:B=>{B.stopPropagation(),c?.(fe.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:fe.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"}),q?jsx("input",{ref:ze,type:"text",value:X,onChange:B=>ee(B.target.value),onKeyDown:B=>{B.key==="Enter"?nt(fe.id):B.key==="Escape"&&et();},onBlur:()=>nt(fe.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:B=>B.stopPropagation()}):jsxs(Fragment,{children:[jsxs("span",{className:"flex-1",style:{display:"inline-flex",alignItems:"baseline",gap:"6px",overflow:"hidden",color:fe.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:fe.parentId?"13px":"14px",fontWeight:fe.isMilestone?600:fe.parentId?400:600,letterSpacing:fe.parentId?"0":"-0.01em"},title:fe.name,children:[fe.wbsCode&&jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:fe.wbsCode}),fe.isHighlighted&&fe.status==="completed"&&jsx("span",{title:"\u2605",style:{color:"#F59E0B",fontSize:"10px",flexShrink:0,lineHeight:1},children:"\u2605"}),jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:fe.name}),fe.subtasks&&fe.subtasks.length>0&&jsxs("span",{style:{color:"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"12px",fontWeight:400,flexShrink:0,whiteSpace:"nowrap"},children:["\xB7 ",Math.round(fe.progress||0),"%"]}),$&&fe.isCriticalPath&&jsx("span",{style:{display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#EF4444",flexShrink:0,marginLeft:"2px"}}),$&&fe.cpmData&&jsxs("span",{style:{color:fe.cpmData.totalFloat<=0?"#EF4444":fe.cpmData.totalFloat<=5?"#F59E0B":"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"10px",fontWeight:500,flexShrink:0,whiteSpace:"nowrap",marginLeft:"4px"},children:["TF: ",Math.round(fe.cpmData.totalFloat),"d"]})]}),ce&&!q&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:B=>B.stopPropagation(),children:[jsx("button",{onClick:B=>Lt(fe,B),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:B=>{B.stopPropagation(),dt(fe);},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 Xe=le.id==="startDate"?"startDate":"endDate",_e=fe[Xe],Be=H?.taskId===fe.id&&H?.field===Xe,M=B=>B?(typeof B=="string"?new Date(B):B).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:B=>B.stopPropagation(),children:[jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors hover:bg-white/5",style:{color:t.textSecondary,opacity:K?.5:1,cursor:K?"default":"pointer"},title:K?"Auto-calculated from subtasks":void 0,onClick:B=>{if(!K)if(Be)de(null);else {let z=B.currentTarget.getBoundingClientRect();de({taskId:fe.id,field:Xe,month:_e?typeof _e=="string"?new Date(_e):_e:new Date,position:{top:z.bottom+4,left:z.left}});}},children:[jsx(Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsx("span",{children:M(_e)}),K&&jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),Be&&typeof document<"u"&&createPortal(jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>de(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:H?.position.top,left:H?.position.left},onClick:B=>B.stopPropagation(),children:[jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let B=new Date,z=new Date(B);z.setDate(B.getDate()+1);let ne=new Date(B);ne.setDate(B.getDate()+7);let D=new Date(B);return D.setDate(B.getDate()+14),[{label:"Hoy",date:B},{label:"Ma\xF1ana",date:z},{label:"Pr\xF3xima semana",date:ne},{label:"2 semanas",date:D}].map((Ce,Ee)=>jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:yt=>yt.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:yt=>yt.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(fe.id,{[Xe]:Ce.date}),de(null);},children:Ce.label},Ee))})(),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:B=>B.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:B=>B.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(fe.id,{[Xe]:void 0}),de(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:()=>de(B=>B?{...B,month:new Date(B.month.getFullYear(),B.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:H?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>de(B=>B?{...B,month:new Date(B.month.getFullYear(),B.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((B,z)=>jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:B},z))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let B=H?.month||new Date,z=B.getFullYear(),ne=B.getMonth(),D=new Date(z,ne,1).getDay(),Q=new Date(z,ne+1,0).getDate(),Ce=new Date,Ee=[];for(let st=D-1;st>=0;st--)Ee.push({day:new Date(z,ne,-st).getDate(),date:new Date(z,ne-1,new Date(z,ne,-st).getDate()),isCurrentMonth:false});for(let st=1;st<=Q;st++)Ee.push({day:st,date:new Date(z,ne,st),isCurrentMonth:true});let yt=42-Ee.length;for(let st=1;st<=yt;st++)Ee.push({day:st,date:new Date(z,ne+1,st),isCurrentMonth:false});return Ee.map((st,ta)=>{let oa=st.date.toDateString()===Ce.toDateString(),Ut=(_e?typeof _e=="string"?new Date(_e):_e:null)?.toDateString()===st.date.toDateString();return jsx("button",{type:"button",className:"w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",style:{color:st.isCurrentMonth?Ut?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:Ut?"#2E94FF":"transparent",boxShadow:oa&&!Ut?"inset 0 0 0 1px #2E94FF":"none"},onClick:()=>{g?.(fe.id,{[Xe]:st.date}),de(null);},children:st.day},ta)})})()})]})]})]}),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:ht(fe)})});case "assignees":if(K)return jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.4},children:jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:"\u2014"})});let J=r.filter(B=>fe.assignees?.some(z=>z.name===B.name||z.initials===B.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:B=>B.stopPropagation(),children:jsx(Po,{assignedUsers:J,availableUsers:r,onChange:B=>{let z=B.map(ne=>({id:ne.id,name:ne.name,initials:ne.initials,color:ne.color}));g?.(fe.id,{assignees:z.length>0?z:void 0});}})});case "status":if(K){let B=fe.progress===100?"\u2713":fe.progress>0?"\u25D0":"\u25CB";return jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.5},children:jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:B})})}return jsx("div",{className:"flex items-center justify-center w-full",onClick:B=>B.stopPropagation(),children:jsx(vu,{status:fe.status||"todo",onChange:B=>{g?.(fe.id,{status:B,progress:B==="completed"?100:fe.progress});}})});case "progress":return jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:K?.6:1},children:[jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${fe.progress}%`,backgroundColor:fe.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:[fe.progress,"%"]})]});case "priority":let ye={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Ie={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},$e=ye[fe.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:B=>B.stopPropagation(),children:jsx(Fo,{priority:$e,onChange:B=>{B&&g?.(fe.id,{priority:Ie[B]||"medium"});}})});default:return null}},At=le=>[{id:"hide",label:"Hide Column",icon:Xt.Hide,onClick:()=>d(le),disabled:le==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Xt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Xt.SortDesc,onClick:()=>{}}],Ge=le=>le.subtasks&&le.subtasks.length>0?[{id:"addSubtask",label:A?.contextMenu?.addSubtask||"Add Subtask",icon:Xt.Add,onClick:()=>{T?.(le.id);}},{id:"duplicate",label:A?.contextMenu?.duplicateTask||"Duplicate Task",icon:Xt.Duplicate,onClick:()=>{y?.([le.id]);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:A?.contextMenu?.deleteTask||"Delete Task",icon:Xt.Delete,onClick:()=>{S?S(le.id,le.name):f?.([le.id]);}}]:[{id:"edit",label:A?.contextMenu?.editTask||"Edit Task",icon:Xt.Pencil,onClick:()=>{n?.(le);}},{id:"addSubtask",label:A?.contextMenu?.addSubtask||"Add Subtask",icon:Xt.Add,onClick:()=>{T?.(le.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:A?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Xt.MarkIncomplete,onClick:()=>{g?.(le.id,{status:"todo",progress:0});},disabled:le.status==="todo"},{id:"setInProgress",label:A?.contextMenu?.setInProgress||"Set In Progress",icon:Xt.SetInProgress,onClick:()=>{g?.(le.id,{status:"in-progress"});},disabled:le.status==="in-progress"},{id:"markComplete",label:A?.contextMenu?.markComplete||"Mark Complete",icon:Xt.MarkComplete,onClick:()=>{g?.(le.id,{status:"completed",progress:100});},disabled:le.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:A?.contextMenu?.duplicateTask||"Duplicate Task",icon:Xt.Duplicate,onClick:()=>{y?.([le.id]);}},{id:"split",label:A?.contextMenu?.splitTask||"Split Task",icon:Xt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:A?.contextMenu?.deleteTask||"Delete Task",icon:Xt.Delete,onClick:()=>{S?S(le.id,le.name):f?.([le.id]);}}],Oe=p.filter(le=>le.visible),pt=Oe.reduce((le,fe)=>le+fe.width,0);return jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:pt},children:[jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${Ne}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsx("div",{className:"flex items-center flex-1 min-w-0",children:Oe.map((le,fe)=>{let P=fe===Oe.length-1,K=le.id==="name";return jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${K?"":"justify-center"}`,style:{width:`${le.width}px`,minWidth:`${le.minWidth??(K?200:60)}px`,maxWidth:`${le.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:P?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:q=>{q.preventDefault(),Fe({isOpen:true,x:q.clientX,y:q.clientY,type:"header",columnId:le.id});},onMouseEnter:q=>{q.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:q=>{q.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:le.label,children:le.label}),le.resizable&&jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:O===le.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:q=>{q.preventDefault(),q.stopPropagation(),j(le.id),je(q.clientX),oe(le.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"}})})]},le.id)})}),jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.glassHeader||t.bgSecondary,zIndex:5},children:[jsx(si,{columns:p,onToggleColumn:d,theme:t}),jsx("button",{onClick:()=>Y(!N),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"})}),N&&jsxs("div",{ref:ie,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:le=>le.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:()=>Y(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:Ke},children:We.map(({task:le,level:fe},P)=>{let K=re(le.id),q=Ue===le.id,ce=q&&ae==="above",Se=q&&ae==="below",Xe=q&&ae==="child",_e={};return Xe&&(_e.backgroundColor=`${t.accent}15`,_e.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":le.id,className:`flex items-center cursor-pointer group ${we===le.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:K?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:K?t.accentLight:Xe?`${t.accent}15`:P%2===0?t.bgPrimary:t.bgGrid,opacity:$?le.isCriticalPath?1:.4:void 0,transition:"opacity 300ms ease",..._e},onMouseEnter:()=>E(le.id),onMouseLeave:()=>E(null),onClick:Be=>{let J=hn(e).map($e=>$e.id),Ie=navigator.platform.toUpperCase().indexOf("MAC")>=0?Be.metaKey:Be.ctrlKey;V(le.id,J,Ie,Be.shiftKey),s?.(le);},onDoubleClick:Be=>{Be.stopPropagation(),n?.(le);},onContextMenu:Be=>{Be.preventDefault(),Fe({isOpen:true,x:Be.clientX,y:Be.clientY,type:"task",task:le}),i?.(le,Be);},whileHover:{backgroundColor:K?t.accentLight:t.hoverBg},children:[ce&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Se&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Oe.map((Be,M)=>{let J=M===Oe.length-1,ye=Be.id==="name";return jsx("div",{className:`px-4 flex items-center ${ye?"justify-start":"justify-center"}`,style:{width:`${Be.width}px`,minWidth:`${Be.minWidth??(ye?200:60)}px`,maxWidth:`${Be.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:J?"none":`1px solid ${_===le.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:ft(Be,le,ye?fe:0)},`${le.id}-${Be.id}`)})]},le.id)})}),jsx(bn,{isOpen:te.isOpen,x:te.x,y:te.y,items:te.type==="header"&&te.columnId?At(te.columnId):te.type==="task"&&te.task?Ge(te.task):[],onClose:()=>Fe({...te,isOpen:false}),theme:t}),rt&&Ft&&we&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:Ft.x+12,top:Ft.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let le=We.find(fe=>fe.task.id===we)?.task;return le?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:le.name})}):null})()}),document.body)]})}function Zp(e,t){let[a,r]=useState("none"),[o,s]=useState(0),[n,i]=useState(e),[c,l]=useState(t),[p,d]=useState(null),[m,g]=useState(null),[b,h]=useState(null),[v,f]=useState(null),[y,w]=useState(0),[x,T]=useState(0),[k,S]=useState(null),[C,I]=useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:i,ghostWidth:c,setGhostWidth:l,connectionLine:p,setConnectionLine:d,hoveredTaskId:m,setHoveredTaskId:g,activeZone:b,setActiveZone:h,draggedSegmentIndex:v,setDraggedSegmentIndex:f,draggedSegmentStartX:y,setDraggedSegmentStartX:w,segmentDragOffsetX:x,setSegmentDragOffsetX:T,hoveredSegmentIndex:k,setHoveredSegmentIndex:S,isHovered:C,setIsHovered:I,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(me,L)=>{r("none"),d(null),g(null),i(me),l(L),T(0),f(null),w(0);}}}function pi({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:i,onClick:c,onDoubleClick:l,onContextMenu:p,onDateChange:d,onDependencyCreate:m,allTaskPositions:g=[],onDragMove:b,onHoverChange:h,showBaseline:v,showTaskBarLabels:f=true,showCriticalPath:y=true,readOnly:w=false}){let x=Zp(t,r),T=useRef(null),k=useRef(false),S=useRef(null),C=useRef(null),{dragMode:I,setDragMode:$,dragOffset:A,setDragOffset:_,ghostX:E,setGhostX:me,ghostWidth:L,setGhostWidth:X,connectionLine:ee,setConnectionLine:ze,hoveredTaskId:O,setHoveredTaskId:j,activeZone:he,setActiveZone:je,draggedSegmentIndex:U,setDraggedSegmentIndex:oe,draggedSegmentStartX:te,setDraggedSegmentStartX:Fe,segmentDragOffsetX:we,setSegmentDragOffsetX:Re,hoveredSegmentIndex:Ue,setHoveredSegmentIndex:Qe,isHovered:ae,setIsHovered:tt,isDragging:pe,isResizing:at,isConnecting:mt,resetDragState:Ft}=x,Te=18,rt=!!o.executionBarBg,lt=o.textPrimary==="#FFFFFF"||o.bgPrimary==="#050505",Ze=rt?3:6,H=e.subtasks&&e.subtasks.length>0,de=e.endDate&&(()=>{let P=new Date;P.setHours(0,0,0,0);let K=new Date(e.endDate);return K.setHours(0,0,0,0),K<P})()&&e.progress<100,N=y&&e.isCriticalPath,Y=o.name==="neutral"||o.today==="#1C1917",ie=e.status==="completed"||e.progress===100,ke={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},re=y&&e.isCriticalPath||de?"#EF4444":e.color?e.color:e.priority&&ke[e.priority]?ke[e.priority]:o.taskBarPrimary,Ve=w?"default":pe?mt?"crosshair":at?"ew-resize":"grabbing":"grab",De=w?"default":"ew-resize",Ne=(P=>P>=80?20:P>=60?15:P>=50?12:10)(r),Ke=r<50,ht=r<40;useEffect(()=>{h&&(!ae||pe||e.segments)&&h(null);},[ae,pe,e.segments,h]);let dt=P=>P.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),nt=()=>{let P=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${P} day${P!==1?"s":""}`},et=P=>Math.round(P/s)*s,Lt=P=>{let K=Math.round(P/s),q=new Date(n);return q.setDate(q.getDate()+K),q},Pt=(P,K)=>{for(let q of g){if(q.id===e.id)continue;let ce=5;if(P>=q.x-ce&&P<=q.x+q.width+ce&&K>=q.y-ce&&K<=q.y+q.height+ce)return q.id}return null},gt=useCallback((P,K,q)=>{if(w)return;P.preventDefault(),P.stopPropagation();let ce=T.current?.ownerSVGElement;if(!ce)return;let Se=ce.createSVGPoint();Se.x=P.clientX,Se.y=P.clientY;let Xe=Se.matrixTransform(ce.getScreenCTM()?.inverse()),_e=q!==void 0?q:t,Be=K;if(!Be){let M=Xe.x-_e;P.shiftKey?(Be="connect",ze({x:t+r,y:a+Te/2})):P.ctrlKey||P.metaKey?Be="move":P.altKey?Be=M<r/2?"resize-start":"resize-end":ht?M<r/2?Be="move":Be="resize-end":Ke?M<=Ne/2?Be="resize-start":M>=r-Ne/2?Be="resize-end":Be="move":M<=Ne?Be="resize-start":M>=r-Ne?Be="resize-end":Be="move";}k.current=false,$(Be),tt(false),je(null),Be==="move"?_(Xe.x-_e):Be==="connect"?ze({x:t+r,y:a+Te/2}):_(0),me(_e),X(r);},[t,r,a,Te,w]),vt=useCallback(P=>{let K=T.current?.ownerSVGElement;if(!K)return;let q=K.closest(".gantt-timeline-scroll");if(!q)return;let ce=q.getBoundingClientRect(),Se=60,Xe=15,_e=0;if(P.clientX<ce.left+Se){let Be=ce.left+Se-P.clientX;_e=-Math.min(Xe,Be/2);}else if(P.clientX>ce.right-Se){let Be=P.clientX-(ce.right-Se);_e=Math.min(Xe,Be/2);}return _e!==0&&(q.scrollLeft+=_e),_e!==0},[]),ft=useCallback(P=>{if(I==="none")return;k.current=true,C.current=P;let K=T.current?.ownerSVGElement;if(!K)return;if(I==="move"||I==="resize-start"||I==="resize-end"){let Se=vt(P);Se&&!S.current?S.current=window.setInterval(()=>{C.current&&(vt(C.current),ft(C.current));},16):!Se&&S.current&&(window.clearInterval(S.current),S.current=null);}let q=K.createSVGPoint();q.x=P.clientX,q.y=P.clientY;let ce=q.matrixTransform(K.getScreenCTM()?.inverse());if(I==="connect"){ze({x:ce.x,y:ce.y});let Se=Pt(ce.x,ce.y);j(Se);}else if(I==="move"){let Se=ce.x-A,Xe=et(Se);me(Xe),X(r);let _e=Math.round((Xe-t)/s);if(b?.(e.id,_e,true),e.segments&&e.segments.length>0&&U!==null){let Be=Xe-te;Re(Be);}}else if(I==="resize-start"){let Se=ce.x,Xe=et(Se),_e=t+r-Xe;_e>=s&&(me(Xe),X(_e));}else if(I==="resize-end"){let Se=ce.x,_e=et(Se)-t;_e>=s&&X(_e);}},[I,t,r,s,A,e,et,U,te,Pt,j,ze,me,X,Re,b,vt]),At=useCallback(()=>{if(S.current&&(window.clearInterval(S.current),S.current=null),C.current=null,I!=="none"){if(I==="connect")O&&m&&m(e,O),ze(null),j(null);else {let P=e.endDate.getTime()-e.startDate.getTime(),K,q,ce=true;if(I==="move"){if(K=Lt(E),q=new Date(K.getTime()+P),e.segments&&e.segments.length>0&&U!==null){let Se=Math.round(we/s),Xe=e.segments.map((J,ye)=>{if(ye===U){let Ie=new Date(J.startDate),$e=new Date(J.endDate);return Ie.setDate(Ie.getDate()+Se),$e.setDate($e.getDate()+Se),{startDate:Ie,endDate:$e}}return J}),_e=Xe.flatMap(J=>[J.startDate,J.endDate]),Be=new Date(Math.min(..._e.map(J=>J.getTime()))),M=new Date(Math.max(..._e.map(J=>J.getTime())));d?.({...e,segments:Xe},Be,M),Ft(t,r);return}}else I==="resize-start"?(K=Lt(E),q=e.endDate,K>q&&(console.warn("Invalid date range: start date must be before or equal to end date"),ce=false)):I==="resize-end"?(K=e.startDate,q=Lt(E+L),q.setDate(q.getDate()-1),q<K&&(console.warn("Invalid date range: end date must be after or equal to start date"),ce=false)):ce=false;ce&&K&&q&&(q.getTime()<K.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,K,q));}b?.(e.id,0,false),Ft(t,r);}},[I,E,L,e,d,O,m,t,r,s,Lt,we,U,Ft,b]);useEffect(()=>{if(I==="none")return;let P=q=>{ft(q);},K=()=>{At();};return window.addEventListener("mousemove",P),window.addEventListener("mouseup",K),()=>{window.removeEventListener("mousemove",P),window.removeEventListener("mouseup",K),S.current&&(window.clearInterval(S.current),S.current=null);}},[I,ft,At]);let Ge=pe&&!mt?E:t,Oe=pe&&!mt?L:r,pt=i.taskClass(e),le=24,fe=y?e.isCriticalPath?1:.25:1;return jsxs("g",{ref:T,"data-task-bar":"true",style:{opacity:fe,transition:"opacity 300ms ease"},onClick:()=>{!pe&&!k.current&&c?.(e),k.current=false;},onDoubleClick:P=>{!pe&&!k.current&&(P.stopPropagation(),l?.(e));},onContextMenu:P=>{P.preventDefault(),p?.(e,P);},onMouseEnter:()=>!pe&&tt(true),onMouseMove:P=>{h&&ae&&!pe&&!e.segments&&h({task:e,x:t,y:a,width:r,height:Te,showBelow:false,mouseX:P.clientX,mouseY:P.clientY});},onMouseLeave:()=>{pe||(tt(false),je(null));},children:[jsx("rect",{x:t,y:a,width:r+le,height:Te,fill:"transparent",style:{pointerEvents:"all"}}),ae&&!pe&&!Ke&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:Ne,height:Te,fill:he==="resize-start"?o.accent:"transparent",opacity:he==="resize-start"?.15:0,style:{cursor:De,pointerEvents:"all"},onMouseEnter:()=>je("resize-start"),onMouseDown:P=>gt(P,"resize-start")}),jsx("rect",{x:t+Ne,y:a,width:r-Ne*2,height:Te,fill:he==="move"?o.accent:"transparent",opacity:he==="move"?.1:0,style:{cursor:w?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>je("move"),onMouseDown:P=>gt(P,"move")}),jsx("rect",{x:t+r-Ne,y:a,width:Ne,height:Te,fill:he==="resize-end"?o.accent:"transparent",opacity:he==="resize-end"?.15:0,style:{cursor:De,pointerEvents:"all"},onMouseEnter:()=>je("resize-end"),onMouseDown:P=>gt(P,"resize-end")})]}),ae&&!pe&&ht&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:r/2,height:Te,fill:he==="move"?o.accent:"transparent",opacity:he==="move"?.2:0,style:{cursor:w?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>je("move"),onMouseDown:P=>gt(P,"move")}),jsx("rect",{x:t+r/2,y:a,width:r/2,height:Te,fill:he==="resize-end"?o.accent:"transparent",opacity:he==="resize-end"?.2:0,style:{cursor:De,pointerEvents:"all"},onMouseEnter:()=>je("resize-end"),onMouseDown:P=>gt(P,"resize-end")}),ae&&jsx(motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+Te-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),pe&&!mt&&!e.segments&&jsx(motion.rect,{x:E,y:a,width:L,height:Te,rx:Ze,fill:o.accent,opacity:.15,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 3",initial:{opacity:0},animate:{opacity:.25},transition:{duration:.15},style:{pointerEvents:"none"}}),v&&e.baselineStartDate&&e.baselineEndDate&&!pe&&(()=>{let P=e.baselineStartDate.getTime(),K=e.baselineEndDate.getTime(),q=n.getTime(),ce=864e5,Se=(P-q)/ce,Xe=(K-P)/ce,_e=Se*s,Be=Math.max(Xe*s,s),M=Ge+Oe,J=_e+Be,ye=e.endDate?.getTime()??0,Ie=Math.ceil((ye-K)/ce),$e=Ie>0,B=Ie<-0;return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:_e,y:a,width:Be,height:Te,rx:Ze,fill:"none",stroke:lt?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),$e&&M>J&&jsx("rect",{x:J,y:a,width:M-J,height:Te,rx:0,fill:"#EF4444",opacity:.2}),$e&&jsxs("text",{x:Math.max(M,J)+6,y:a+Te/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",Ie,"d"]}),B&&jsxs("text",{x:M+6,y:a+Te/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[Ie,"d"]})]})})(),!e.segments&&rt&&H&&(()=>{let K=a+(Te-8)/2,q=4,ce=e.progress||0,Se=new Date;Se.setHours(0,0,0,0);let Xe=e.startDate&&Se>=e.startDate,_e=e.endDate&&(()=>{let $e=new Date(e.endDate);return $e.setHours(0,0,0,0),Se>$e})(),Be=e.startDate&&Se<e.startDate,M=1;if(Xe&&e.startDate&&e.endDate&&!Be){let $e=new Date(e.startDate);$e.setHours(0,0,0,0);let B=new Date(e.endDate);B.setHours(0,0,0,0);let z=Math.max(1,(B.getTime()-$e.getTime())/(1e3*60*60*24)),D=Math.min((Se.getTime()-$e.getTime())/(1e3*60*60*24),z)/z*100;M=D>0?ce/D:1;}let J;ce>=100?J="#00E5CC":Be?J="#4B5563":_e&&ce<100?J="#EF4444":M>=.95?J="#22C55E":M>=.8?J="#F59E0B":J="#EF4444";let ye=Math.max(ce/100*Oe,ce>0?q*2:0),Ie=Oe>100&&ce>0;return jsxs("g",{"data-task-class":pt,style:{cursor:"default",pointerEvents:"all"},children:[jsx("rect",{x:Ge,y:K,width:Oe,height:8,rx:q,fill:"rgba(255,255,255,0.10)"}),ce>0&&jsx("rect",{x:Ge,y:K,width:ye,height:8,rx:q,fill:J}),Ie&&jsxs("text",{x:Ge+ye+6,y:K+8/2,dominantBaseline:"central",fill:"rgba(255,255,255,0.7)",fontSize:"9",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[Math.round(ce),"%"]})]})})(),!e.segments&&rt&&!H&&jsx(motion.rect,{x:Ge,y:a,width:Oe,height:Te,rx:Ze,fill:o.executionBarBg||"rgba(255,255,255,0.06)",stroke:o.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":pt,initial:{opacity:0,scale:.95},animate:{opacity:pe&&!mt?.15:e.parentId?.6:1,scale:ae&&!pe?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:P=>gt(P),style:{cursor:Ve,pointerEvents:"all"}}),!e.segments&&!rt&&jsx(motion.rect,{x:Ge,y:a,width:Oe,height:Te,rx:Ze,fill:re,"data-task-class":pt,initial:{opacity:0,scale:.95},animate:{opacity:pe&&!mt?.15:e.parentId?.6:ae?.9:.8,scale:ae&&!pe?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:H?void 0:P=>gt(P),style:{cursor:H?"default":Ve,pointerEvents:"all"}}),rt&&(de||N)&&!e.segments&&jsx("rect",{x:Ge,y:a,width:Oe,height:Te,rx:Ze,fill:"none",stroke:o.criticalPath,strokeWidth:2,style:{pointerEvents:"none",filter:`drop-shadow(0 0 6px ${o.criticalPathLight||"rgba(255,46,46,0.4)"})`}}),!e.segments&&e.progress>0&&!H&&jsx("rect",{x:Ge,y:a,width:Math.max(Oe*(e.progress/100),Ze*2),height:Te,rx:Ze,fill:re,opacity:1,style:{pointerEvents:"none"}}),!e.segments&&!H&&e.progress<100&&(()=>{let P=e.progress>0?Oe*(e.progress/100):0,K=Ge+P,q=Oe-P,ce=e.progress===0?Ze:0,Se=e.progress===0?Ge:K,Xe=e.progress===0?Oe:q;return jsxs(Fragment,{children:[jsx("rect",{x:Se,y:a,width:Xe,height:Te,rx:ce,fill:"url(#bar-remaining-hatch)",style:{pointerEvents:"none"}}),jsx("rect",{x:Se,y:a,width:Xe,height:Te,rx:ce,fill:"none",stroke:"#2E94FF",strokeWidth:.8,strokeDasharray:"5 3",style:{pointerEvents:"none"}})]})})(),rt&&!e.segments&&e.progress>0&&e.progress<100&&!H&&!pe&&(()=>{let P=Ge+Oe*(e.progress/100),K=8,q=e.assignees?.[0];return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("circle",{cx:P,cy:a+Te/2,r:K,fill:q?.color||o.accent,stroke:"#000",strokeWidth:1.5}),jsx("text",{x:P,y:a+Te/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:q?.initials||q?.name?.charAt(0)?.toUpperCase()||""})]})})(),e.segments&&e.segments.map((P,K)=>{let q=(P.startDate.getTime()-n.getTime())/864e5*s,Se=(P.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-q+s,Xe=pe&&I==="move"&&U===K,_e=Ue===K,Be=Xe?q+we:q;return jsxs("g",{onMouseEnter:()=>!pe&&Qe(K),onMouseLeave:()=>!pe&&Qe(null),children:[jsx(motion.rect,{x:Be,y:a,width:Se,height:Te,rx:Ze,fill:re,initial:{opacity:0,scale:.95},animate:{opacity:Xe||e.parentId?.6:_e?.9:.8,scale:_e&&!pe?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:M=>{M.stopPropagation(),oe(K),Fe(q),gt(M,void 0,q);},style:{cursor:Ve,pointerEvents:"all"}}),jsx("rect",{x:Be,y:a,width:Se*(e.progress/100),height:Te,rx:Ze,fill:re,opacity:1,style:{pointerEvents:"none"}})]},`segment-${K}`)}),Y&&(de||N)&&!e.segments&&jsxs(Fragment,{children:[N&&!de&&jsx("rect",{x:Ge,y:a,width:Oe,height:Te,rx:Ze,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),de&&jsx("rect",{x:Ge,y:a,width:Oe,height:Te,rx:Ze,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),f&&Oe>60&&!e.segments&&!(rt&&H)&&(()=>{let P=i.taskLabel(e),K=typeof P=="string"?P:e.name,q=K.length>Math.floor(Oe/8)?`${K.substring(0,Math.floor(Oe/8))}...`:K;return jsx("text",{x:Ge+8,y:a+Te/2,dominantBaseline:"middle",fill:ie?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:ie?"line-through":"none"},children:q})})(),!pe&&!e.segments&&!H&&e.progress>0&&e.progress<100&&(rt?jsxs("text",{x:Ge+Oe+6,y:a+Te/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):Oe>100?jsxs("text",{x:Ge+Oe-12,y:a+Te/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):null),e.status&&Oe>80&&!pe&&!e.segments&&!(rt&&H)&&jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsx("circle",{cx:Ge+Oe-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsx("circle",{cx:Ge+Oe-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(ae||at)&&!mt&&!e.segments&&!H&&jsxs(Fragment,{children:[jsxs("g",{children:[jsx("rect",{x:Ge-2,y:a,width:16,height:Te,fill:"transparent",style:{cursor:De},onMouseEnter:()=>je("resize-start"),onMouseLeave:()=>je(null),onMouseDown:P=>{P.stopPropagation(),gt(P,"resize-start");}}),jsx(motion.rect,{x:Ge+4,y:a+8,width:3,height:Te-16,rx:1.5,fill:he==="resize-start"||I==="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:Ge+Oe-14,y:a,width:16,height:Te,fill:"transparent",style:{cursor:De},onMouseEnter:()=>je("resize-end"),onMouseLeave:()=>je(null),onMouseDown:P=>{P.stopPropagation(),gt(P,"resize-end");}}),jsx(motion.rect,{x:Ge+Oe-7,y:a+8,width:3,height:Te-16,rx:1.5,fill:he==="resize-end"||I==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsx(AnimatePresence,{children:ae&&!pe&&!e.segments&&jsxs(motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsx("circle",{cx:t+r+10,cy:a+Te/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>je("connect"),onMouseLeave:()=>je(null),onMouseDown:P=>{P.stopPropagation(),gt(P,"connect");}}),jsx(motion.circle,{cx:t+r+10,cy:a+Te/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:he==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),mt&&ee&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:t+r,y1:a+Te/2,x2:ee.x,y2:ee.y,stroke:O?o.statusCompleted:o.accent,strokeWidth:O?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:O?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:ee.x,cy:ee.y,r:O?8:6,fill:O?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),O&&jsx(motion.text,{x:ee.x+15,y:ee.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:ee.x+10},animate:{opacity:1,x:ee.x+15},transition:{duration:.2},children:"Connect"})]}),(ae||pe)&&!mt&&!e.segments&&jsx(motion.rect,{x:Ge-1,y:a-1,width:Oe+2,height:Te+2,rx:Ze+1,fill:"none",stroke:pe?o.accent:rt?"rgba(255,255,255,0.2)":o.taskBarPrimary,strokeWidth:rt?1:2,opacity:pe||rt?.6:.4,initial:{opacity:0},animate:{opacity:pe||rt?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),at&&jsxs(Fragment,{children:[jsx("line",{x1:E,y1:0,x2:E,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsx("line",{x1:E+L,y1:0,x2:E+L,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:ae&&!pe&&!e.segments&&!h&&(()=>{let q=a<100,ce=q?a+Te+13:a-82-13,Se=q?`M ${Ge+Oe/2-6} ${a+Te+3} L ${Ge+Oe/2} ${a+Te+13} L ${Ge+Oe/2+6} ${a+Te+3}`:`M ${Ge+Oe/2-6} ${a-13} L ${Ge+Oe/2} ${a-3} L ${Ge+Oe/2+6} ${a-13}`,Xe=ce+22,_e=ce+40,Be=ce+55,M=ce+70,J=q?ce+82-5:a-18;return jsxs(motion.g,{initial:{opacity:0,y:q?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:q?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:Se,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsx("rect",{x:Ge+Oe/2-120,y:ce,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:Ge+Oe/2,y:Xe,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:Ge+Oe/2-110,y:_e,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:Ge+Oe/2-70,y:_e,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:dt(e.startDate)}),jsx("text",{x:Ge+Oe/2-110,y:Be,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:Ge+Oe/2-70,y:Be,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:dt(e.endDate)}),jsx("text",{x:Ge+Oe/2+10,y:_e,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:Ge+Oe/2+65,y:_e,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:nt()}),jsx("text",{x:Ge+Oe/2+10,y:Be,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:Ge+Oe/2+65,y:Be,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxs(Fragment,{children:[jsx("text",{x:Ge+Oe/2-110,y:M,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:Ge+Oe/2-50,y:M,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(ye=>ye.name).join(", ").substring(0,30),e.assignees.map(ye=>ye.name).join(", ").length>30?"...":""]})]}),!q&&jsx("text",{x:Ge+Oe/2,y:J,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:ht?"Left: move \u2022 Right: resize":Ke?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}var xd=260,yn=8,am=16,hv=-12;function rm({tooltipData:e,theme:t,locale:a="en"}){let[r,o]=useState(null);if(useLayoutEffect(()=>{if(!e){o(null);return}let{task:y,mouseX:w,mouseY:x}=e,k=y.effortMinutes!=null||y.timeLoggedMinutes!=null||y.soldEffortMinutes!=null?155:105,S=w+am,C=x+hv-k;S+xd>window.innerWidth-yn&&(S=w-xd-am),S<yn&&(S=yn);let I=C<yn;I&&(C=x+20),C+k>window.innerHeight-yn&&(C=window.innerHeight-yn-k),o({left:S,top:C,showBelow:I});},[e]),!e||!r)return null;let{task:s}=e,n=s.effortMinutes!=null||s.timeLoggedMinutes!=null||s.soldEffortMinutes!=null,i={start:a==="es"?"Inicio":"Start",end:a==="es"?"Fin":"End",duration:a==="es"?"Duraci\xF3n":"Duration",progress:a==="es"?"Progreso":"Progress",assignees:a==="es"?"Asignados":"Assignees",estimated:a==="es"?"Estimado":"Estimated",logged:a==="es"?"Registrado":"Logged",quoted:a==="es"?"Ofertado":"Quoted"},c=y=>y.toLocaleDateString(a==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),l=()=>{if(!s.startDate||!s.endDate)return "N/A";let y=Math.ceil((s.endDate.getTime()-s.startDate.getTime())/(1e3*60*60*24));return a==="es"?`${y} d\xEDa${y!==1?"s":""}`:`${y} day${y!==1?"s":""}`},p=y=>{if(y==null||y===0)return "N/A";let w=Math.floor(y/60),x=y%60;return w===0?`${x}m`:x===0?`${w}h`:`${w}h ${x}m`},d=t.textTertiary||"#9CA3AF",m=t.textSecondary||"#D1D5DB",g=t.textPrimary||"#F9FAFB",b=t.accent||"#3B82F6",h=t.bgSecondary||"#1F2937",v=t.border||"#374151",f=jsxs("div",{style:{position:"fixed",left:r.left,top:r.top,width:xd,zIndex:99999,pointerEvents:"none",fontFamily:"Inter, system-ui, sans-serif",animation:"gantt-tooltip-fade 0.12s ease-out"},children:[jsxs("div",{style:{background:h,border:`1px solid ${v}`,borderRadius:8,padding:"12px 14px",boxShadow:"0 8px 24px rgba(0,0,0,0.3)"},children:[jsx("div",{style:{fontSize:13,fontWeight:600,color:g,marginBottom:8,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:s.name}),jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"3px 12px",fontSize:11},children:[jsx(mi,{label:i.start,value:s.startDate?c(s.startDate):"N/A",labelColor:d,valueColor:m}),jsx(mi,{label:i.duration,value:l(),labelColor:d,valueColor:m}),jsx(mi,{label:i.end,value:s.endDate?c(s.endDate):"N/A",labelColor:d,valueColor:m}),jsx(mi,{label:i.progress,value:`${s.progress}%`,labelColor:d,valueColor:m})]}),s.assignees&&s.assignees.length>0&&jsxs("div",{style:{fontSize:11,marginTop:6},children:[jsxs("span",{style:{color:d},children:[i.assignees,": "]}),jsx("span",{style:{color:m,fontWeight:500},children:s.assignees.map(y=>y.name).join(", ")})]}),n&&jsxs("div",{style:{marginTop:6,display:"flex",gap:10,fontSize:11},children:[s.effortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:d},children:[i.estimated,":"]})," ",jsx("span",{style:{color:m,fontWeight:600},children:p(s.effortMinutes)})]}),s.timeLoggedMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:d},children:[i.logged,":"]})," ",jsx("span",{style:{color:b,fontWeight:600},children:p(s.timeLoggedMinutes)})]}),s.soldEffortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:d},children:[i.quoted,":"]})," ",jsx("span",{style:{color:m,fontWeight:600},children:p(s.soldEffortMinutes)})]})]})]}),jsx("style",{children:`
|
|
126
126
|
@keyframes gantt-tooltip-fade {
|
|
127
127
|
from { opacity: 0; transform: translateY(${r.showBelow?"-4px":"4px"}); }
|
|
128
128
|
to { opacity: 1; transform: translateY(0); }
|
|
129
129
|
}
|
|
130
|
-
`})]});return createPortal(f,document.body)}function
|
|
131
|
-
`)},formatDate:e=>{let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return `${t}-${a}-${r}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let a=
|
|
130
|
+
`})]});return createPortal(f,document.body)}function mi({label:e,value:t,labelColor:a,valueColor:r}){return jsxs("div",{children:[jsxs("span",{style:{color:a},children:[e,": "]}),jsx("span",{style:{color:r,fontWeight:500},children:t})]})}function Qn({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:i=false,onHoverChange:c,hoverOverlayOnly:l=false,colorOverride:p,strokeWidthOverride:d,glowFilter:m}){let[,g]=useState(false),[b,h]=useState(null),v=r-t,f=v>0,y=Math.abs(v)<5,w=20,x=!y&&a<=e,T,k,S=a-e,C=e+S/2;k=C;let I=8;if(n==="squared")if(y)T=`M ${e} ${t} L ${a} ${r}`;else if(x){let we=e+15,Re=a-w,Ue=f?t+20:t-20;k=Re;let Qe=f?1:-1;T=`M ${e} ${t} L ${we-I} ${t} Q ${we} ${t} ${we} ${t+Qe*I} L ${we} ${Ue-Qe*I} Q ${we} ${Ue} ${we-I} ${Ue} L ${Re+I} ${Ue} Q ${Re} ${Ue} ${Re} ${Ue+Qe*I} L ${Re} ${r-Qe*I} Q ${Re} ${r} ${Re+I} ${r} L ${a} ${r}`;}else {k=a-w;let Fe=f?1:-1;T=`M ${e} ${t} L ${k-I} ${t} Q ${k} ${t} ${k} ${t+Fe*I} L ${k} ${r-Fe*I} Q ${k} ${r} ${k+I} ${r} L ${a} ${r}`;}else T=`M ${e} ${t} C ${C} ${t}, ${C} ${r}, ${a} ${r}`;let $=6,A=5,_=`M ${a} ${r} L ${a-$} ${r-A/2} L ${a-$} ${r+A/2} Z`,E=!o.bgPrimary||o.bgPrimary.startsWith("#0")||o.bgPrimary.startsWith("#1"),me=p||(E?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.20)"),L=d||1,X=o.dependencyHover||(E?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.45)"),ee="#f87171",ze="rgba(248, 113, 113, 0.15)",O=k,j=(t+r)/2;if(b)if(n==="squared")if(y)O=Math.max(e+10,Math.min(a-10,b.x)),j=t;else if(x){let Fe=e+15,we=a-w,Re=f?t+20:t-20,Ue=[[e,t,Fe,t],[Fe,t,Fe,Re],[Fe,Re,we,Re],[we,Re,we,r],[we,r,a,r]],Qe=1/0,ae={x:O,y:j};for(let tt of Ue){let pe=he(b.x,b.y,tt[0],tt[1],tt[2],tt[3]),at=Math.hypot(b.x-pe.x,b.y-pe.y);at<Qe&&(Qe=at,ae=pe);}O=ae.x,j=ae.y;}else {let Fe=[[e,t,k,t],[k,t,k,r],[k,r,a,r]],we=1/0,Re={x:O,y:j};for(let Ue of Fe){let Qe=he(b.x,b.y,Ue[0],Ue[1],Ue[2],Ue[3]),ae=Math.hypot(b.x-Qe.x,b.y-Qe.y);ae<we&&(we=ae,Re=Qe);}O=Re.x,j=Re.y;}else {let Fe=C,we=t,Re=C,Ue=r,Qe=1/0,ae=O,tt=j;for(let pe=0;pe<=1;pe+=.02){let at=1-pe,mt=at*at*at*e+3*at*at*pe*Fe+3*at*pe*pe*Re+pe*pe*pe*a,Ft=at*at*at*t+3*at*at*pe*we+3*at*pe*pe*Ue+pe*pe*pe*r,Te=Math.hypot(b.x-mt,b.y-Ft);Te<Qe&&(Qe=Te,ae=mt,tt=Ft);}O=ae,j=tt;}function he(Fe,we,Re,Ue,Qe,ae){let tt=Qe-Re,pe=ae-Ue,at=tt*tt+pe*pe;if(at===0)return {x:Re,y:Ue};let mt=((Fe-Re)*tt+(we-Ue)*pe)/at;return mt=Math.max(0,Math.min(1,mt)),{x:Re+mt*tt,y:Ue+mt*pe}}let je=Fe=>{let we=Fe.currentTarget.ownerSVGElement;if(!we)return;let Re=we.getScreenCTM();if(!Re)return;let Ue=Re.inverse();h({x:Ue.a*Fe.clientX+Ue.c*Fe.clientY+Ue.e,y:Ue.b*Fe.clientX+Ue.d*Fe.clientY+Ue.f});},U=()=>{g(false),h(null),c?.(false);},oe=()=>{g(true),c?.(true);},te=Fe=>s?jsxs(motion.g,{initial:Fe,animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:we=>{we.stopPropagation(),s();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsx("circle",{cx:O,cy:j,r:16,fill:"transparent",style:{cursor:"pointer"}}),jsx("circle",{cx:O,cy:j,r:9,fill:ze,stroke:ee,strokeWidth:1.5,style:{pointerEvents:"none"}}),jsx("line",{x1:O-3,y1:j-3,x2:O+3,y2:j+3,stroke:ee,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("line",{x1:O+3,y1:j-3,x2:O-3,y2:j+3,stroke:ee,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}})]}):null;return i?jsxs("g",{"data-dependency-line":"true",onMouseLeave:U,onMouseMove:je,children:[jsx("path",{d:T,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsx("path",{d:T,fill:"none",stroke:X,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsx("path",{d:T,fill:"none",stroke:X,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("path",{d:_,fill:X,stroke:"none",opacity:.9,style:{pointerEvents:"none"}}),jsx("circle",{cx:a,cy:r,r:4,fill:X,opacity:.9,style:{pointerEvents:"none"}}),te({opacity:0,scale:.8})]}):l?jsxs("g",{"data-dependency-hover-overlay":"true",onMouseEnter:oe,onMouseLeave:U,onMouseMove:je,style:{cursor:s?"pointer":"default"},children:[jsx("path",{d:T,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsx("path",{d:T,fill:"none",stroke:o.bgPrimary||"#1A1D21",strokeWidth:4,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("path",{d:T,fill:"none",stroke:X,strokeWidth:5,strokeLinecap:"round",opacity:.12,style:{pointerEvents:"none"}}),jsx("path",{d:T,fill:"none",stroke:X,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("path",{d:_,fill:X,stroke:"none",style:{pointerEvents:"none"}}),jsx("circle",{cx:a,cy:r,r:3.5,fill:X,style:{pointerEvents:"none"}}),te({opacity:0,scale:0})]}):jsxs("g",{"data-dependency-line":"true",onMouseEnter:oe,onMouseLeave:U,onMouseMove:je,style:{cursor:s?"pointer":"default"},children:[jsx("path",{d:T,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsx(motion.path,{d:T,fill:"none",stroke:me,strokeWidth:L,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}},style:{pointerEvents:"none",filter:m||"none"}}),jsx(motion.path,{d:_,fill:me,stroke:"none",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3},style:{pointerEvents:"none"}}),jsx(motion.circle,{cx:a,cy:r,r:3,fill:me,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15},style:{pointerEvents:"none"}})]})}function hi({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=useState(false),i=16,c=l=>l.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:i+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsx(motion.rect,{x:t-i/2,y:a+16-i/2,width:i,height:i,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-(i+4)/2,y:a+16-(i+4)/2,width:i+4,height:i+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsx(AnimatePresence,{children:s&&jsxs(motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:c(e.startDate)}),e.isCriticalPath&&jsxs("g",{children:[jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var Ae={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=l=>{l.forEach(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,i=new Set,c=l=>{if(!n.has(l)){n.add(l),i.add(l);let p=r.get(l)||[];for(let d of p){if(!n.has(d)&&c(d))return true;if(i.has(d))return true}}return i.delete(l),false};return c(a)},flattenTasks:e=>{let t=[],a=r=>{[...r].sort((s,n)=>(s.position??0)-(n.position??0)).forEach(s=>{t.push(s),s.subtasks&&s.subtasks.length>0&&a(s.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Ae.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=Ae.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=Ae.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=Ae.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(`
|
|
131
|
+
`)},formatDate:e=>{let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return `${t}-${a}-${r}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let a=Ae.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=Ae.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)=>Ae.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=Ae.findTaskById(e,t);return !a||!a.dependencies?[]:Ae.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>Ae.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>Ae.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=Ae.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=>Ae.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=Ae.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"]],i=s.map(c=>{let l=c.startDate&&c.endDate?Ae.calculateDuration(c.startDate,c.endDate):0;return [c.name,c.startDate?Ae.formatDate(c.startDate):"N/A",c.endDate?Ae.formatDate(c.endDate):"N/A",l>0?`${l} days`:"N/A",`${c.progress}%`,c.status||"N/A"]});r(o,{head:n,body:i,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)=>{let a=await import('xlsx'),r=Ae.flattenTasks(e),o=new Map,s=(p,d="")=>{[...p].sort((g,b)=>(g.position??0)-(b.position??0)).forEach((g,b)=>{let h=d?`${d}.${b+1}`:`${b+1}`;o.set(g.id,h),g.subtasks?.length&&s(g.subtasks,h);});};s(e);let n=r.map(p=>{let d=p.startDate&&p.endDate?Ae.calculateDuration(p.startDate,p.endDate):0,m=p.effortMinutes,g=p.timeLoggedMinutes,b=p.soldEffortMinutes;return {WBS:o.get(p.id)||"","Task Name":p.name,"Start Date":p.startDate?Ae.formatDate(p.startDate):"","End Date":p.endDate?Ae.formatDate(p.endDate):"","Duration (days)":d>0?d:"","Progress (%)":p.progress,Status:p.status||"",Assignees:p.assignees?.map(h=>h.name).join(", ")||"","Estimated (h)":typeof m=="number"?+(m/60).toFixed(1):"","Logged (h)":typeof g=="number"?+(g/60).toFixed(1):"","Quoted (h)":typeof b=="number"?+(b/60).toFixed(1):"","Is Milestone":p.isMilestone?"Yes":"No"}}),i=a.utils.json_to_sheet(n),c=[{wch:10},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:14},{wch:12},{wch:12},{wch:12}];i["!cols"]=c;let l=a.utils.book_new();if(a.utils.book_append_sheet(l,i,"Gantt Tasks"),!t){let p=new Date,d=g=>String(g).padStart(2,"0");t=`Project_${`${p.getFullYear()}-${d(p.getMonth()+1)}-${d(p.getDate())}_${d(p.getHours())}${d(p.getMinutes())}`}.xlsx`;}a.writeFile(l,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=Ae.flattenTasks(e),o=new Map;r.forEach((m,g)=>{o.set(m.id,g+1);});let s=m=>m.toISOString().replace("Z",""),n=Ae.getEarliestStartDate(e)||new Date,i=Ae.getLatestEndDate(e)||new Date,c=r.map((m,g)=>{let b=o.get(m.id),h=m.startDate&&m.endDate?Ae.calculateDuration(m.startDate,m.endDate):0,v=(m.dependencies||[]).filter(f=>o.has(f)).map(f=>`
|
|
132
132
|
<PredecessorLink>
|
|
133
133
|
<PredecessorUID>${o.get(f)}</PredecessorUID>
|
|
134
134
|
<Type>1</Type>
|
|
@@ -358,14 +358,14 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
358
358
|
</Calendars>
|
|
359
359
|
<Tasks>${c}
|
|
360
360
|
</Tasks>
|
|
361
|
-
</Project>`,p=new Blob([l],{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=Pe.flattenTasks(e),a=t.filter(l=>l.startDate&&l.endDate);if(a.length===0)return [];let r=new Map,o=l=>{if(r.has(l.id))return;let p=l.startDate&&l.endDate?Pe.calculateDuration(l.startDate,l.endDate):0,d=0;if(l.dependencies&&l.dependencies.length>0)for(let g of l.dependencies){let b=t.find(h=>h.id===g);if(b){o(b);let h=r.get(g)?.ef||0;d=Math.max(d,h);}}let m=d+p;r.set(l.id,{es:d,ef:m});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(l=>l.ef)),n=new Map,i=l=>{if(n.has(l.id))return;let p=l.startDate&&l.endDate?Pe.calculateDuration(l.startDate,l.endDate):0,d=t.filter(b=>b.dependencies&&b.dependencies.includes(l.id)),m=s;if(d.length>0)for(let b of d){i(b);let h=n.get(b.id)?.ls||0;m=Math.min(m,h);}let g=m-p;n.set(l.id,{ls:g,lf:m});};a.forEach(i);let c=[];for(let l of a){let p=r.get(l.id),d=n.get(l.id);if(p&&d){let m=d.ls-p.es;Math.abs(m)<.01&&c.push(l.id);}}return c},calculateCriticalPathFull:e=>{let t=new Map,r=Pe.flattenTasks(e).filter(m=>m.startDate&&m.endDate);if(r.length===0)return t;let o=new Map(r.map(m=>[m.id,m])),s=new Map;for(let m of r)s.has(m.id)||s.set(m.id,[]);for(let m of r)if(m.dependencies){for(let g of m.dependencies)if(o.has(g)){let b=s.get(g);b&&b.push(m.id);}}let n=new Map;for(let m of r)n.set(m.id,0);for(let m of r)if(m.dependencies)for(let g of m.dependencies)o.has(g)&&n.set(m.id,(n.get(m.id)||0)+1);let i=new Map,c=[],l=[];for(let m of r)(n.get(m.id)||0)===0&&l.push(m.id);for(;l.length>0;){let m=l.shift();c.push(m);let g=o.get(m);if(!g||!g.startDate||!g.endDate)continue;let b=Pe.calculateDuration(g.startDate,g.endDate),h=0;if(g.dependencies)for(let f of g.dependencies){let y=i.get(f);y&&(h=Math.max(h,y.ef));}i.set(m,{es:h,ef:h+b});let v=s.get(m)||[];for(let f of v){let y=(n.get(f)||1)-1;n.set(f,y),y===0&&l.push(f);}}if(c.length<r.length)return t;let p=Math.max(...Array.from(i.values()).map(m=>m.ef)),d=new Map;for(let m=c.length-1;m>=0;m--){let g=c[m];if(!g)continue;let b=o.get(g);if(!b||!b.startDate||!b.endDate)continue;let h=Pe.calculateDuration(b.startDate,b.endDate),v=s.get(g)||[],f=p;if(v.length>0)for(let y of v){let w=d.get(y);w&&(f=Math.min(f,w.ls));}d.set(g,{ls:f-h,lf:f});}for(let m of c){let g=i.get(m),b=d.get(m),h=b.ls-g.es,v=s.get(m)||[],f;v.length>0?f=Math.min(...v.map(y=>i.get(y).es))-g.ef:f=p-g.ef,t.set(m,{earlyStart:g.es,earlyFinish:g.ef,lateStart:b.ls,lateFinish:b.lf,totalFloat:Math.round(h*100)/100,freeFloat:Math.max(0,Math.round(f*100)/100),isCritical:h<=.01});}return t},calculateSlack:(e,t)=>{let a=Pe.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(Pe.calculateCriticalPath(e).includes(t))return 0;let o=Pe.getDependentTasks(e,t);if(o.length===0){let i=Pe.getLatestEndDate(e);if(!i)return null;let c=Pe.calculateDuration(a.endDate,i);return Math.max(0,c)}let s=o.filter(i=>i.startDate).map(i=>i.startDate.getTime()).sort((i,c)=>i-c)[0];if(!s)return null;let n=Pe.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>Pe.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a,r)=>{let o=r||new Set;if(o.has(t))return e;o.add(t);let s=Pe.findTaskById(e,t);if(!s||!s.endDate)return e;let n=Pe.getDependentTasks(e,t);if(n.length===0)return e;let i=[...e];for(let c of n){if(o.has(c.id)||!c.startDate||!c.endDate)continue;let l=Pe.calculateDuration(c.startDate,c.endDate),p;if(a!==void 0?(p=new Date(c.startDate),p.setDate(p.getDate()+a)):(p=new Date(s.endDate),p.setDate(p.getDate()+1)),a!==void 0){let g=new Date(s.endDate),b=new Date(g);b.setDate(b.getDate()+1),p<b&&(p=b);}let d=Pe.calculateEndDate(p,l),m=g=>g.map(b=>b.id===c.id?{...b,startDate:p,endDate:d}:b.subtasks?{...b,subtasks:m(b.subtasks)}:b);i=m(i),i=Pe.autoScheduleDependents(i,c.id,a,o);}return i},calculateCascadePreview:(e,t,a,r,o,s,n,i)=>{if(a===0)return [];let c=[],l=o.getTime(),p=1e3*60*60*24,d=Pe.findTaskById(e,t);if(!d||!d.endDate)return [];let m=(g,b,h=new Set)=>{if(h.has(g))return;h.add(g);let v=Pe.getDependentTasks(e,g);for(let f of v){if(!f.startDate||!f.endDate)continue;let y=r.findIndex(A=>A.id===f.id);if(y===-1)continue;let w=f.startDate.getTime(),C=(f.endDate.getTime()-w)/p,D=(w-l)/p*s,T=D+b*s,I=Math.max(C*s,s),$=i+y*n+(n-18)/2;c.push({taskId:f.id,taskName:f.name,originalX:D,previewX:T,width:I,y:$,rowIndex:y,daysDelta:b,color:f.color}),m(f.id,b,h);}};return m(t,a),c},splitTask:(e,t,a,r=3)=>{let o=Pe.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let n=new Date(a);n.setDate(n.getDate()+r);let i=new Date(o.endDate);i.setDate(i.getDate()+r);let c=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:i}],l=p=>p.map(d=>d.id===o.id?{...d,endDate:i,segments:c}:d.subtasks?{...d,subtasks:l(d.subtasks)}:d);return l(e)}};function yi({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:i="en",templates:c,dependencyLineStyle:l="curved",showTaskBarLabels:p=true,onTaskClick:d,onTaskDblClick:m,onTaskContextMenu:g,onTaskDateChange:b,onDependencyCreate:h,onDependencyDelete:v,showBaseline:f,showCriticalPath:y=true,showDependencies:w=true,highlightWeekends:x=true,canEditTask:C}){let D=Er(),T=useRef(null),[I,$]=useState([]),[A,_]=useState(null),[E,me]=useState(null),[L,X]=useState(null),Z=useRef(false),[He,O]=useState(new Set),[j,he]=useState(null),je=useCallback(H=>{if(L&&!Z.current){let de=H.target,N=false;for(;de&&de!==H.currentTarget;){if(de.getAttribute?.("data-dependency-line")==="true"||de.getAttribute?.("data-dependency-hover-overlay")==="true"){N=true;break}de=de.parentElement;}N||X(null);}},[L]),U=useCallback(H=>{me(H);},[]),re=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),ee=r==="day"?60:r==="week"?20:8,Ee=re*ee*n,we=H=>{let de=new Date(Date.UTC(H.getFullYear(),H.getMonth(),H.getDate())),N=de.getUTCDay()||7;de.setUTCDate(de.getUTCDate()+4-N);let Y=new Date(Date.UTC(de.getUTCFullYear(),0,1));return Math.ceil(((de.getTime()-Y.getTime())/864e5+1)/7)},Be=H=>{let de=H.getDay();return de===0||de===6},ze=useCallback(H=>{let de=Math.round(H/(ee*n)),N=new Date(o);return N.setDate(N.getDate()+de),N},[o,ee,n]),Qe=useCallback((H,de)=>{if(de.startDate&&de.endDate)return;let N=H.currentTarget.ownerSVGElement;if(!N)return;let Y=N.createSVGPoint();Y.x=H.clientX,Y.y=H.clientY;let ie=Y.matrixTransform(N.getScreenCTM()?.inverse()),ke=ze(ie.x),V=new Date(ke);V.setDate(V.getDate()+1),he(null),b?.(de,ke,V);},[ze,b]),te=useCallback((H,de,N)=>{let Y=H.currentTarget.ownerSVGElement;if(!Y)return;let ie=Y.createSVGPoint();ie.x=H.clientX,ie.y=H.clientY;let ke=ie.matrixTransform(Y.getScreenCTM()?.inverse()),V=ze(ke.x),Ve=Math.round(ke.x/(ee*n))*ee*n;he({taskId:de.id,x:Ve,y:N*a+a/2,date:V});},[ze,ee,n,a]),tt=useCallback(()=>{he(null);},[]),pe=useMemo(()=>{let H=ie=>ie.map(ke=>{if(ke.subtasks&&ke.subtasks.length>0){let V=H(ke.subtasks),ae=V.filter(Ve=>Ve.startDate&&Ve.endDate);if(ae.length>0){let Ve=ae.map(Ke=>Ke.startDate.getTime()),De=ae.map(Ke=>Ke.endDate.getTime()),Ue=new Date(Math.min(...Ve)),Ne=new Date(Math.max(...De));return {...ke,subtasks:V,startDate:Ue,endDate:Ne}}return {...ke,subtasks:V}}return ke}),de=(ie,ke=[])=>{let V=[...ie].sort((ae,Ve)=>(ae.position??0)-(Ve.position??0));for(let ae of V)ke.push(ae),ae.subtasks&&ae.subtasks.length>0&&(ae.isExpanded===void 0||ae.isExpanded)&&de(ae.subtasks,ke);return ke},N=H(e);return de(N)},[e]),at=useCallback(H=>{if(!H.startDate||!H.endDate)return {x:0,width:0};let de=H.startDate.getTime(),N=H.endDate.getTime(),Y=o.getTime(),ie=(de-Y)/(1e3*60*60*24),ke=(N-de)/(1e3*60*60*24)+1,V=ie*ee*n,ae=Math.max(ee*n,40),Ve=Math.max(ke*ee*n,ae);return {x:V,width:Ve}},[o,ee,n]),pt=useMemo(()=>pe.filter(H=>H.startDate&&H.endDate).map(H=>{let{x:de,width:N}=at(H),ie=pe.findIndex(ke=>ke.id===H.id)*a+(a-18)/2;return {id:H.id,x:de,y:ie,width:N,height:18}}),[pe,at]),Et=useCallback((H,de,N)=>{if(!N){$([]),_(null);return}if(_({taskId:H,daysDelta:de}),de===0){$([]);return}let Y=Pe.calculateCascadePreview(e,H,de,pe,o,ee*n,a,48);$(Y);},[e,pe,o,ee,n,a,48]),Ce=useCallback((H,de)=>{if(!A)return de;let N=ee*n,Y=A.daysDelta*N;if(H===A.taskId)return {x:de.x+Y,width:de.width};let ie=I.find(ke=>ke.taskId===H);return ie?{x:ie.previewX,width:ie.width}:de},[A,I,ee,n]),rt=useMemo(()=>{let H=[],de=new Date(o);for(;de<=s;){let ie=(de.getTime()-o.getTime())/864e5*ee*n;if(r==="day")H.push({date:new Date(de),label:de.toLocaleDateString(i,{day:"numeric",month:"short"}),x:ie}),de.setDate(de.getDate()+1);else if(r==="week"){let ke=we(de);H.push({date:new Date(de),label:`${D.labels.week} ${ke}`,x:ie}),de.setDate(de.getDate()+7);}else H.push({date:new Date(de),label:de.toLocaleDateString(i,{month:"short",year:"numeric"}),x:ie}),de.setMonth(de.getMonth()+1);}return H},[o,s,r,ee,n,i,D.labels.week]),it=useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*ee*n,[o,ee,n]),Ze=Math.max(pe.length*a,552);return jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},children:[jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.glassHeader||t.bgSecondary,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.borderLight}`,boxSizing:"border-box"},children:jsxs("svg",{width:Math.max(Ee,1e3),height:47,style:{display:"block"},children:[jsx("rect",{x:0,y:0,width:Math.max(Ee,1e3),height:48,fill:t.glassHeader||t.bgSecondary}),rt.map((H,de)=>jsxs("g",{children:[de>0&&jsx("line",{x1:H.x,y1:0,x2:H.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsx("text",{x:H.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:H.label})]},`header-${de}`)),it>=0&&it<=Ee&&jsxs("g",{children:[jsx("circle",{cx:it,cy:38,r:4,fill:t.today,opacity:1}),t.neonRedGlow&&jsx("circle",{cx:it,cy:38,r:6,fill:"none",stroke:t.today,strokeWidth:1,opacity:.3}),t.neonRedGlow&&jsxs("g",{transform:`translate(${it-18}, 2)`,children:[jsx("rect",{x:0,y:0,width:36,height:14,rx:2,fill:"rgba(0,0,0,0.8)",stroke:t.today,strokeWidth:.5,opacity:.8}),jsx("text",{x:18,y:10,textAnchor:"middle",fill:t.today,fontSize:"7",fontFamily:"'JetBrains Mono', monospace",fontWeight:"700",letterSpacing:"0.1em",children:D.labels.today.toUpperCase()})]})]})]})}),jsxs("svg",{ref:T,width:Math.max(Ee,1e3),height:Ze,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:je,children:[jsxs("defs",{children:[jsx("filter",{id:"shadow",children:jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})}),jsx("pattern",{id:"weekend-hatch",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.055)":"rgba(0,0,0,0.04)",strokeWidth:"4"})}),jsxs("pattern",{id:"bar-remaining-hatch",width:"10",height:"10",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:[jsx("rect",{x:"0",y:"0",width:"5",height:"10",fill:"#2E94FF",opacity:"0.18"}),jsx("rect",{x:"5",y:"0",width:"5",height:"10",fill:"#94A3B8",opacity:"0.12"})]})]}),jsx("rect",{x:0,y:0,width:Math.max(Ee,1e3),height:Ze,fill:t.bgPrimary}),pe.map((H,de)=>jsx("rect",{x:0,y:de*a,width:Math.max(Ee,1e3),height:a,fill:de%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-bg-${H.id}`)),rt.map((H,de)=>de>0?jsx("line",{x1:H.x,y1:0,x2:H.x,y2:pe.length*a,stroke:t.borderLight,strokeWidth:1,shapeRendering:"crispEdges",opacity:t.neonRedGlow?1:.1},`vgrid-${de}`):null),x&&rt.map((H,de)=>{let N=rt[de+1]?.x||Ee;return Be(H.date)?jsxs("g",{children:[jsx("rect",{x:H.x,y:0,width:N-H.x,height:pe.length*a,fill:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",style:{pointerEvents:"none"}}),jsx("rect",{x:H.x,y:0,width:N-H.x,height:pe.length*a,fill:"url(#weekend-hatch)",style:{pointerEvents:"none"}})]},`we-overlay-${de}`):null}),pe.map((H,de)=>{let N=H.startDate&&H.endDate;return jsx("g",{children:!N&&jsxs(Fragment,{children:[jsx("rect",{x:0,y:de*a,width:Ee,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:Y=>Qe(Y,H),onMouseMove:Y=>te(Y,H,de),onMouseLeave:()=>{tt();}},`clickable-${H.id}`),j&&j.taskId===H.id&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx("line",{x1:j.x,y1:de*a+4,x2:j.x,y2:de*a+a-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsx("circle",{cx:j.x,cy:j.y,r:8,fill:t.accent,opacity:.9}),jsx("circle",{cx:j.x,cy:j.y,r:4,fill:"white",opacity:.9}),jsxs("g",{transform:`translate(${j.x}, ${de*a-8})`,children:[jsx("rect",{x:-40,y:-20,width:80,height:20,rx:4,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsx("text",{x:0,y:-6,textAnchor:"middle",fill:t.textPrimary,fontSize:"11",fontFamily:"Inter, sans-serif",fontWeight:"500",children:j.date.toLocaleDateString(i==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!j||j.taskId!==H.id)&&jsx("text",{x:it>0?it:100,y:de*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:D.labels.clickToSetDates},`placeholder-${H.id}`)]})},`row-group-${H.id}`)}),pe.map((H,de)=>{if(!H.startDate||!H.endDate)return null;let{x:N,width:Y}=at(H),ie=de*a+(a-18)/2,ke=H.subtasks&&H.subtasks.length>0&&!H.isMilestone;if(H.isMilestone)return jsx(bi,{task:H,x:N+Y/2,y:ie+12,theme:t,onClick:d},H.id);if(ke){let V=!t.bgPrimary||t.bgPrimary.startsWith("#0")||t.bgPrimary.startsWith("#1"),ae=8,Ve=ie+(a-18)/2+(18-ae)/2,De=4,Ue=H.progress||0,Ne=new Date;Ne.setHours(0,0,0,0);let Ke=H.startDate&&Ne>=H.startDate,bt=H.endDate&&(()=>{let gt=new Date(H.endDate);return gt.setHours(0,0,0,0),Ne>gt})(),lt=H.startDate&&Ne<H.startDate,nt=1;if(Ke&&H.startDate&&H.endDate&&!lt){let gt=new Date(H.startDate);gt.setHours(0,0,0,0);let Pt=new Date(H.endDate);Pt.setHours(0,0,0,0);let Ge=Math.max(1,(Pt.getTime()-gt.getTime())/(1e3*60*60*24)),ut=Math.min((Ne.getTime()-gt.getTime())/(1e3*60*60*24),Ge)/Ge*100;nt=ut>0?Ue/ut:1;}let et;Ue>=100?et="#00E5CC":lt?et="#4B5563":bt&&Ue<100?et="#EF4444":nt>=.95?et="#22C55E":nt>=.8?et="#F59E0B":et="#EF4444";let At=Math.max(Ue/100*Y,Ue>0?De*2:0),Mt=Y>100&&Ue>0,mt=H.isCriticalPath;return jsxs("g",{onClick:()=>d?.(H),onContextMenu:gt=>{gt.preventDefault(),gt.stopPropagation(),g?.(H,gt);},onMouseMove:gt=>{U({task:H,x:N,y:Ve,width:Y,height:ae,showBelow:Ve<100,mouseX:gt.clientX,mouseY:gt.clientY});},onMouseLeave:()=>U(null),style:{cursor:"default",opacity:y?mt?1:.25:1,transition:"opacity 300ms ease"},children:[jsx("rect",{x:N,y:ie,width:Y,height:a,fill:"transparent",style:{pointerEvents:"all"}}),jsx("rect",{x:N,y:Ve,width:Y,height:ae,rx:De,fill:V?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.08)"}),Ue>0&&jsx("rect",{x:N,y:Ve,width:At,height:ae,rx:De,fill:et}),y&&mt&&jsx("rect",{x:N,y:Ve,width:Y,height:ae,rx:De,fill:"none",stroke:"#EF4444",strokeWidth:2,style:{pointerEvents:"none",filter:"drop-shadow(0 0 6px rgba(239, 68, 68, 0.4))"}}),Mt&&jsxs("text",{x:N+At+6,y:Ve+ae/2,dominantBaseline:"central",fill:V?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.55)",fontSize:"9",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[Math.round(Ue),"%"]})]},H.id)}return jsx(ui,{task:H,x:N,y:ie,width:Y,theme:t,dayWidth:ee*n,startDate:o,templates:c,onClick:d,onDoubleClick:m,onContextMenu:g,onDateChange:b,onDependencyCreate:h,allTaskPositions:pt,onDragMove:Et,onHoverChange:U,showBaseline:f,showTaskBarLabels:p,showCriticalPath:y,readOnly:C?!C(H):false},H.id)}),w&&pe.map((H,de)=>!H.dependencies||H.dependencies.length===0||!H.startDate||!H.endDate?null:H.dependencies.map(N=>{let Y=pe.find(et=>et.id===N);if(!Y||!Y.startDate||!Y.endDate)return null;let ie=pe.findIndex(et=>et.id===N),ke=Ce(Y.id,at(Y)),V=Ce(H.id,at(H)),ae=ke.x+ke.width,Ve=ie*a+26,De=V.x,Ue=de*a+26,Ne=`dep-${N}-${H.id}`;if(He.has(Ne))return null;let Ke=y&&H.isCriticalPath&&Y.isCriticalPath;return jsx(Qn,{x1:ae,y1:Ve,x2:De,y2:Ue,theme:t,lineStyle:l,colorOverride:y?Ke?"#EF4444":"rgba(255,255,255,0.10)":void 0,strokeWidthOverride:y?Ke?2:1:void 0,glowFilter:Ke?"drop-shadow(0 0 4px rgba(239, 68, 68, 0.3))":void 0,onDelete:()=>v?.(H.id,N),onHoverChange:et=>{Z.current=et,et&&X({key:Ne,fromId:N,toId:H.id,exitX:ae,exitY:Ve,enterX:De,enterY:Ue});}},Ne)})),I.map(H=>jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:H.previewX,y:H.y-48,width:H.width,height:18,rx:6,fill:H.color||t.accent,opacity:.15,stroke:t.accent,strokeWidth:1,strokeDasharray:"4 3"}),Math.abs(H.daysDelta)>0&&jsx("text",{x:H.previewX+H.width/2,y:H.y-48+9,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:H.daysDelta>0?`+${H.daysDelta}d`:`${H.daysDelta}d`})]},`cascade-preview-${H.taskId}`)),w&&L&&jsx(Qn,{x1:L.exitX,y1:L.exitY,x2:L.enterX,y2:L.enterY,theme:t,lineStyle:l,onDelete:()=>{let H=L.key;X(null),Z.current=false,O(de=>new Set(de).add(H)),v?.(L.toId,L.fromId);},hoverOverlayOnly:true,onHoverChange:H=>{Z.current=H,H||X(null);}},`${L.key}-hover-overlay`),it>=0&&it<=Ee&&jsxs("g",{style:{pointerEvents:"none"},children:[t.neonRedGlow&&jsx("line",{x1:it,y1:0,x2:it,y2:Ze,stroke:t.today,strokeWidth:6,opacity:.15}),jsx("line",{x1:it,y1:0,x2:it,y2:Ze,stroke:t.today,strokeWidth:1,opacity:1})]})]}),E&&jsx(am,{tooltipData:E,theme:t,locale:i==="es"?"es":"en"})]})}var vv=['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"'],nm=({size:e=16})=>jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:"M12 2l2.4 7.2L22 12l-7.6 2.8L12 22l-2.4-7.2L2 12l7.6-2.8L12 2z"})}),wv=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M22 2L11 13M22 2L15 22L11 13M22 2L2 9L11 13"})}),kv=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M18 6L6 18M6 6L18 18"})}),Cv=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M5 12h14"})}),Tv=()=>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 wi({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:i,onDependencyDelete:c}){let[l,p]=useState(false),[d,m]=useState(false),[g,b]=useState([]),[h,v]=useState(""),[f,y]=useState(false),[w,x]=useState(true),[C,k]=useState(""),[D,T]=useState(-1),[I,$]=useState(false),[A,_]=useState(0),E=useRef(null),me=useRef(null),L=useRef(null),X=useRef(null),{enabled:Z=true,placeholder:He='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:O="bottom-right",onCommand:j,suggestions:he=vv,maxHistory:je=50,persistHistory:U,mentionableUsers:re=[]}=a,ee=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",Ee=ee?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",we=ee?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.25)",Be=ee?"0 0 20px rgba(46, 148, 255, 0.08), 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 0 12px rgba(46, 148, 255, 0.04)":"0 0 20px rgba(46, 148, 255, 0.06), 0 4px 12px rgba(0, 0, 0, 0.08)",ze=ee?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",Qe=ee?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",te=ee?"rgba(10, 10, 10, 0.85)":"rgba(255, 255, 255, 0.95)",tt=ee?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.2)",pe=ee?"rgba(46, 148, 255, 0.9)":"#2E94FF",at=ee?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",pt=ee?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",Et=ee?"0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(46, 148, 255, 0.04), inset 0 1px 0 rgba(255,255,255,0.03)":"0 20px 60px rgba(0, 0, 0, 0.1), 0 0 20px rgba(46, 148, 255, 0.04)",Ce=ee?"rgba(46, 148, 255, 0.04)":"rgba(46, 148, 255, 0.03)",rt=ee?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.08)",it=ee?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",Ze=ee?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",H=ee?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.85)",de=ee?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",N=ee?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)",Y=ee?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",ie=ee?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",ke="rgba(46, 148, 255, 0.04)",V=ee?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.12)",ae=ee?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.5)",Ve=ee?"rgba(46, 148, 255, 0.25)":"rgba(46, 148, 255, 0.3)",De=ee?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",Ue=ee?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.12)",Ne=ee?"rgba(255, 255, 255, 0.04)":"rgba(0, 0, 0, 0.03)",Ke=ee?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",bt=ee?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",lt="rgba(46, 148, 255, 0.06)",nt=ee?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",et=ee?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.1)",At=ee?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",Mt=ee?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",mt=ee?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",yt=ee?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",gt=ee?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",Pt=ee?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",Ge=ee?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",Re=ee?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",ut=ee?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",le=ee?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",fe=ee?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",P=ee?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",K=ee?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",q=U?.storageKey||"gantt-ai-history",ce=U?.maxMessages??5,Se=re.filter(B=>{if(!C)return true;let z=C.toLowerCase();return B.name.toLowerCase().includes(z)||B.email&&B.email.toLowerCase().includes(z)}).slice(0,5),Xe=useCallback(B=>{if(v(B),re.length===0)return;let z=E.current;if(!z)return;let ne=z.selectionStart||B.length,S=B.slice(0,ne),oe=S.lastIndexOf("@");if(oe>=0&&((oe>0?S[oe-1]:" ")===" "||oe===0)){let We=S.slice(oe+1);if(We.length<=40){k(We),T(oe),$(true),_(0);return}}$(false),k(""),T(-1);},[re.length]),_e=useCallback(B=>{let z=h.slice(0,D),ne=h.slice(D+1+C.length),S=`${z}@${B.name} ${ne}`;v(S),$(false),k(""),T(-1),setTimeout(()=>E.current?.focus(),0);},[h,D,C]),Ie=useCallback(B=>{if(!I||Se.length===0)return false;if(B.key==="ArrowDown")return B.preventDefault(),_(z=>z<Se.length-1?z+1:0),true;if(B.key==="ArrowUp")return B.preventDefault(),_(z=>z>0?z-1:Se.length-1),true;if(B.key==="Enter"||B.key==="Tab"){B.preventDefault();let z=Se[A];return z&&_e(z),true}return B.key==="Escape"?($(false),true):false},[I,Se,A,_e]);useEffect(()=>{if(U?.enabled)try{let B=localStorage.getItem(q);if(B){let ne=JSON.parse(B).map(S=>({...S,timestamp:new Date(S.timestamp)}));b(ne.slice(-ce));}}catch(B){console.warn("[GanttAIAssistant] Failed to load persisted history:",B);}},[U?.enabled,q,ce]),useEffect(()=>{if(U?.enabled&&g.length>0)try{let B=g.filter(z=>!z.isLoading).slice(-ce);localStorage.setItem(q,JSON.stringify(B));}catch(B){console.warn("[GanttAIAssistant] Failed to persist history:",B);}},[g,U?.enabled,q,ce]),useEffect(()=>{me.current&&me.current.scrollIntoView({behavior:"smooth"});},[g]),useEffect(()=>{l&&!d&&E.current&&setTimeout(()=>E.current?.focus(),100);},[l,d]);let M=useCallback(B=>{if(B.success)switch(B.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":B.taskId&&B.updates&&o?.(B.taskId,B.updates);break;case "create_task":B.newTask&&s?.(B.newTask);break;case "delete_task":B.taskId&&n?.(B.taskId);break;case "link_tasks":B.dependencyFrom&&B.dependencyTo&&i?.(B.dependencyFrom,B.dependencyTo);break;case "unlink_tasks":B.taskId&&B.dependencyFrom&&c?.(B.taskId,B.dependencyFrom);break}},[o,s,n,i,c]),J=useCallback(async B=>{if(!B.trim()||f)return;let z={id:`user-${Date.now()}`,role:"user",content:B,timestamp:new Date};b(S=>[...S.slice(-(je-1)),z]),v(""),x(false),y(true);let ne={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};b(S=>[...S,ne]);try{if(j){let S=await j(B,e);b(oe=>{let Te=oe.filter(Tt=>!Tt.isLoading),We={id:`assistant-${Date.now()}`,role:"assistant",content:S.message,timestamp:new Date,command:S};return [...Te,We]}),M(S);}else b(S=>[...S.filter(Te=>!Te.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(S){b(oe=>[...oe.filter(We=>!We.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${S instanceof Error?S.message:"Unknown error"}`,timestamp:new Date}]);}finally{y(false);}},[f,je,j,e,M]),ye=B=>{B.preventDefault(),J(h);},Le=B=>{v(B),E.current?.focus();};if(useEffect(()=>{let B=z=>{(z.metaKey||z.ctrlKey)&&z.key==="k"&&(z.preventDefault(),p(ne=>!ne),l||m(false)),z.key==="Escape"&&l&&p(false);};return document.addEventListener("keydown",B),()=>document.removeEventListener("keydown",B)},[l]),useEffect(()=>{if(!l)return;let B=ne=>{let S=ne.target;L.current&&!L.current.contains(S)&&p(false);},z=setTimeout(()=>{document.addEventListener("mousedown",B);},100);return ()=>{clearTimeout(z),document.removeEventListener("mousedown",B);}},[l]),!Z)return null;let Oe={"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:!l&&jsxs(motion.button,{initial:{scale:0,opacity:0,rotate:-180},animate:{scale:1,opacity:1,rotate:0},exit:{scale:0,opacity:0,rotate:180},transition:{type:"spring",damping:20,stiffness:260},whileHover:{scale:1.12},whileTap:{scale:.9},className:`fixed ${Oe[O]} z-[99999] group`,style:{width:44,height:44,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:Ee,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:`1px solid ${we}`,color:"#2E94FF",cursor:"pointer",boxShadow:Be,overflow:"visible"},onClick:()=>p(true),children:[jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:`1px solid ${ze}`,animation:"ai-fab-pulse 3s ease-in-out infinite",pointerEvents:"none"}}),jsx("span",{style:{position:"absolute",inset:-6,borderRadius:"50%",border:`1px solid ${Qe}`,animation:"ai-fab-pulse 3s ease-in-out infinite 1.5s",pointerEvents:"none"}}),jsx(nm,{size:18}),jsx("span",{className:"pointer-events-none opacity-0 group-hover:opacity-100 transition-opacity duration-200",style:{position:"absolute",right:"100%",marginRight:10,whiteSpace:"nowrap",fontSize:11,fontWeight:500,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.05em",textTransform:"uppercase",color:pe,background:te,backdropFilter:"blur(8px)",padding:"4px 10px",borderRadius:6,border:`1px solid ${tt}`},children:"AI \xB7 \u2318K"}),jsx("style",{children:`
|
|
361
|
+
</Project>`,p=new Blob([l],{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=Ae.flattenTasks(e),a=t.filter(l=>l.startDate&&l.endDate);if(a.length===0)return [];let r=new Map,o=l=>{if(r.has(l.id))return;let p=l.startDate&&l.endDate?Ae.calculateDuration(l.startDate,l.endDate):0,d=0;if(l.dependencies&&l.dependencies.length>0)for(let g of l.dependencies){let b=t.find(h=>h.id===g);if(b){o(b);let h=r.get(g)?.ef||0;d=Math.max(d,h);}}let m=d+p;r.set(l.id,{es:d,ef:m});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(l=>l.ef)),n=new Map,i=l=>{if(n.has(l.id))return;let p=l.startDate&&l.endDate?Ae.calculateDuration(l.startDate,l.endDate):0,d=t.filter(b=>b.dependencies&&b.dependencies.includes(l.id)),m=s;if(d.length>0)for(let b of d){i(b);let h=n.get(b.id)?.ls||0;m=Math.min(m,h);}let g=m-p;n.set(l.id,{ls:g,lf:m});};a.forEach(i);let c=[];for(let l of a){let p=r.get(l.id),d=n.get(l.id);if(p&&d){let m=d.ls-p.es;Math.abs(m)<.01&&c.push(l.id);}}return c},calculateCriticalPathFull:e=>{let t=new Map,r=Ae.flattenTasks(e).filter(m=>m.startDate&&m.endDate);if(r.length===0)return t;let o=new Map(r.map(m=>[m.id,m])),s=new Map;for(let m of r)s.has(m.id)||s.set(m.id,[]);for(let m of r)if(m.dependencies){for(let g of m.dependencies)if(o.has(g)){let b=s.get(g);b&&b.push(m.id);}}let n=new Map;for(let m of r)n.set(m.id,0);for(let m of r)if(m.dependencies)for(let g of m.dependencies)o.has(g)&&n.set(m.id,(n.get(m.id)||0)+1);let i=new Map,c=[],l=[];for(let m of r)(n.get(m.id)||0)===0&&l.push(m.id);for(;l.length>0;){let m=l.shift();c.push(m);let g=o.get(m);if(!g||!g.startDate||!g.endDate)continue;let b=Ae.calculateDuration(g.startDate,g.endDate),h=0;if(g.dependencies)for(let f of g.dependencies){let y=i.get(f);y&&(h=Math.max(h,y.ef));}i.set(m,{es:h,ef:h+b});let v=s.get(m)||[];for(let f of v){let y=(n.get(f)||1)-1;n.set(f,y),y===0&&l.push(f);}}if(c.length<r.length)return t;let p=Math.max(...Array.from(i.values()).map(m=>m.ef)),d=new Map;for(let m=c.length-1;m>=0;m--){let g=c[m];if(!g)continue;let b=o.get(g);if(!b||!b.startDate||!b.endDate)continue;let h=Ae.calculateDuration(b.startDate,b.endDate),v=s.get(g)||[],f=p;if(v.length>0)for(let y of v){let w=d.get(y);w&&(f=Math.min(f,w.ls));}d.set(g,{ls:f-h,lf:f});}for(let m of c){let g=i.get(m),b=d.get(m),h=b.ls-g.es,v=s.get(m)||[],f;v.length>0?f=Math.min(...v.map(y=>i.get(y).es))-g.ef:f=p-g.ef,t.set(m,{earlyStart:g.es,earlyFinish:g.ef,lateStart:b.ls,lateFinish:b.lf,totalFloat:Math.round(h*100)/100,freeFloat:Math.max(0,Math.round(f*100)/100),isCritical:h<=.01});}return t},calculateSlack:(e,t)=>{let a=Ae.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(Ae.calculateCriticalPath(e).includes(t))return 0;let o=Ae.getDependentTasks(e,t);if(o.length===0){let i=Ae.getLatestEndDate(e);if(!i)return null;let c=Ae.calculateDuration(a.endDate,i);return Math.max(0,c)}let s=o.filter(i=>i.startDate).map(i=>i.startDate.getTime()).sort((i,c)=>i-c)[0];if(!s)return null;let n=Ae.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>Ae.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a,r)=>{let o=r||new Set;if(o.has(t))return e;o.add(t);let s=Ae.findTaskById(e,t);if(!s||!s.endDate)return e;let n=Ae.getDependentTasks(e,t);if(n.length===0)return e;let i=[...e];for(let c of n){if(o.has(c.id)||!c.startDate||!c.endDate)continue;let l=Ae.calculateDuration(c.startDate,c.endDate),p;if(a!==void 0?(p=new Date(c.startDate),p.setDate(p.getDate()+a)):(p=new Date(s.endDate),p.setDate(p.getDate()+1)),a!==void 0){let g=new Date(s.endDate),b=new Date(g);b.setDate(b.getDate()+1),p<b&&(p=b);}let d=Ae.calculateEndDate(p,l),m=g=>g.map(b=>b.id===c.id?{...b,startDate:p,endDate:d}:b.subtasks?{...b,subtasks:m(b.subtasks)}:b);i=m(i),i=Ae.autoScheduleDependents(i,c.id,a,o);}return i},calculateCascadePreview:(e,t,a,r,o,s,n,i)=>{if(a===0)return [];let c=[],l=o.getTime(),p=1e3*60*60*24,d=Ae.findTaskById(e,t);if(!d||!d.endDate)return [];let m=(g,b,h=new Set)=>{if(h.has(g))return;h.add(g);let v=Ae.getDependentTasks(e,g);for(let f of v){if(!f.startDate||!f.endDate)continue;let y=r.findIndex(A=>A.id===f.id);if(y===-1)continue;let w=f.startDate.getTime(),T=(f.endDate.getTime()-w)/p,S=(w-l)/p*s,C=S+b*s,I=Math.max(T*s,s),$=i+y*n+(n-18)/2;c.push({taskId:f.id,taskName:f.name,originalX:S,previewX:C,width:I,y:$,rowIndex:y,daysDelta:b,color:f.color}),m(f.id,b,h);}};return m(t,a),c},splitTask:(e,t,a,r=3)=>{let o=Ae.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 i=new Date(o.endDate);i.setDate(i.getDate()+r);let c=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:i}],l=p=>p.map(d=>d.id===o.id?{...d,endDate:i,segments:c}:d.subtasks?{...d,subtasks:l(d.subtasks)}:d);return l(e)}};function xi({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:i="en",templates:c,dependencyLineStyle:l="curved",showTaskBarLabels:p=true,onTaskClick:d,onTaskDblClick:m,onTaskContextMenu:g,onTaskDateChange:b,onDependencyCreate:h,onDependencyDelete:v,showBaseline:f,showCriticalPath:y=true,showDependencies:w=true,highlightWeekends:x=true,canEditTask:T}){let S=Er(),C=useRef(null),[I,$]=useState([]),[A,_]=useState(null),[E,me]=useState(null),[L,X]=useState(null),ee=useRef(false),[ze,O]=useState(new Set),[j,he]=useState(null),je=useCallback(H=>{if(L&&!ee.current){let de=H.target,N=false;for(;de&&de!==H.currentTarget;){if(de.getAttribute?.("data-dependency-line")==="true"||de.getAttribute?.("data-dependency-hover-overlay")==="true"){N=true;break}de=de.parentElement;}N||X(null);}},[L]),U=useCallback(H=>{me(H);},[]),oe=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),te=r==="day"?60:r==="week"?20:8,Fe=oe*te*n,we=H=>{let de=new Date(Date.UTC(H.getFullYear(),H.getMonth(),H.getDate())),N=de.getUTCDay()||7;de.setUTCDate(de.getUTCDate()+4-N);let Y=new Date(Date.UTC(de.getUTCFullYear(),0,1));return Math.ceil(((de.getTime()-Y.getTime())/864e5+1)/7)},Re=H=>{let de=H.getDay();return de===0||de===6},Ue=useCallback(H=>{let de=Math.round(H/(te*n)),N=new Date(o);return N.setDate(N.getDate()+de),N},[o,te,n]),Qe=useCallback((H,de)=>{if(de.startDate&&de.endDate)return;let N=H.currentTarget.ownerSVGElement;if(!N)return;let Y=N.createSVGPoint();Y.x=H.clientX,Y.y=H.clientY;let ie=Y.matrixTransform(N.getScreenCTM()?.inverse()),ke=Ue(ie.x),V=new Date(ke);V.setDate(V.getDate()+1),he(null),b?.(de,ke,V);},[Ue,b]),ae=useCallback((H,de,N)=>{let Y=H.currentTarget.ownerSVGElement;if(!Y)return;let ie=Y.createSVGPoint();ie.x=H.clientX,ie.y=H.clientY;let ke=ie.matrixTransform(Y.getScreenCTM()?.inverse()),V=Ue(ke.x),Ve=Math.round(ke.x/(te*n))*te*n;he({taskId:de.id,x:Ve,y:N*a+a/2,date:V});},[Ue,te,n,a]),tt=useCallback(()=>{he(null);},[]),pe=useMemo(()=>{let H=ie=>ie.map(ke=>{if(ke.subtasks&&ke.subtasks.length>0){let V=H(ke.subtasks),re=V.filter(Ve=>Ve.startDate&&Ve.endDate);if(re.length>0){let Ve=re.map(Ke=>Ke.startDate.getTime()),De=re.map(Ke=>Ke.endDate.getTime()),We=new Date(Math.min(...Ve)),Ne=new Date(Math.max(...De));return {...ke,subtasks:V,startDate:We,endDate:Ne}}return {...ke,subtasks:V}}return ke}),de=(ie,ke=[])=>{let V=[...ie].sort((re,Ve)=>(re.position??0)-(Ve.position??0));for(let re of V)ke.push(re),re.subtasks&&re.subtasks.length>0&&(re.isExpanded===void 0||re.isExpanded)&&de(re.subtasks,ke);return ke},N=H(e);return de(N)},[e]),at=useCallback(H=>{if(!H.startDate||!H.endDate)return {x:0,width:0};let de=H.startDate.getTime(),N=H.endDate.getTime(),Y=o.getTime(),ie=(de-Y)/(1e3*60*60*24),ke=(N-de)/(1e3*60*60*24)+1,V=ie*te*n,re=Math.max(te*n,40),Ve=Math.max(ke*te*n,re);return {x:V,width:Ve}},[o,te,n]),mt=useMemo(()=>pe.filter(H=>H.startDate&&H.endDate).map(H=>{let{x:de,width:N}=at(H),ie=pe.findIndex(ke=>ke.id===H.id)*a+(a-18)/2;return {id:H.id,x:de,y:ie,width:N,height:18}}),[pe,at]),Ft=useCallback((H,de,N)=>{if(!N){$([]),_(null);return}if(_({taskId:H,daysDelta:de}),de===0){$([]);return}let Y=Ae.calculateCascadePreview(e,H,de,pe,o,te*n,a,48);$(Y);},[e,pe,o,te,n,a,48]),Te=useCallback((H,de)=>{if(!A)return de;let N=te*n,Y=A.daysDelta*N;if(H===A.taskId)return {x:de.x+Y,width:de.width};let ie=I.find(ke=>ke.taskId===H);return ie?{x:ie.previewX,width:ie.width}:de},[A,I,te,n]),rt=useMemo(()=>{let H=[],de=new Date(o);for(;de<=s;){let ie=(de.getTime()-o.getTime())/864e5*te*n;if(r==="day")H.push({date:new Date(de),label:de.toLocaleDateString(i,{day:"numeric",month:"short"}),x:ie}),de.setDate(de.getDate()+1);else if(r==="week"){let ke=we(de);H.push({date:new Date(de),label:`${S.labels.week} ${ke}`,x:ie}),de.setDate(de.getDate()+7);}else H.push({date:new Date(de),label:de.toLocaleDateString(i,{month:"short",year:"numeric"}),x:ie}),de.setMonth(de.getMonth()+1);}return H},[o,s,r,te,n,i,S.labels.week]),lt=useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*te*n,[o,te,n]),Ze=Math.max(pe.length*a,552);return jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},children:[jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.glassHeader||t.bgSecondary,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.borderLight}`,boxSizing:"border-box"},children:jsxs("svg",{width:Math.max(Fe,1e3),height:47,style:{display:"block"},children:[jsx("rect",{x:0,y:0,width:Math.max(Fe,1e3),height:48,fill:t.glassHeader||t.bgSecondary}),rt.map((H,de)=>jsxs("g",{children:[de>0&&jsx("line",{x1:H.x,y1:0,x2:H.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsx("text",{x:H.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:H.label})]},`header-${de}`)),lt>=0&<<=Fe&&jsxs("g",{children:[jsx("circle",{cx:lt,cy:38,r:4,fill:t.today,opacity:1}),t.neonRedGlow&&jsx("circle",{cx:lt,cy:38,r:6,fill:"none",stroke:t.today,strokeWidth:1,opacity:.3}),t.neonRedGlow&&jsxs("g",{transform:`translate(${lt-18}, 2)`,children:[jsx("rect",{x:0,y:0,width:36,height:14,rx:2,fill:"rgba(0,0,0,0.8)",stroke:t.today,strokeWidth:.5,opacity:.8}),jsx("text",{x:18,y:10,textAnchor:"middle",fill:t.today,fontSize:"7",fontFamily:"'JetBrains Mono', monospace",fontWeight:"700",letterSpacing:"0.1em",children:S.labels.today.toUpperCase()})]})]})]})}),jsxs("svg",{ref:C,width:Math.max(Fe,1e3),height:Ze,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:je,children:[jsxs("defs",{children:[jsx("filter",{id:"shadow",children:jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})}),jsx("pattern",{id:"weekend-hatch",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.055)":"rgba(0,0,0,0.04)",strokeWidth:"4"})}),jsxs("pattern",{id:"bar-remaining-hatch",width:"10",height:"10",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:[jsx("rect",{x:"0",y:"0",width:"5",height:"10",fill:"#2E94FF",opacity:"0.18"}),jsx("rect",{x:"5",y:"0",width:"5",height:"10",fill:"#94A3B8",opacity:"0.12"})]})]}),jsx("rect",{x:0,y:0,width:Math.max(Fe,1e3),height:Ze,fill:t.bgPrimary}),pe.map((H,de)=>jsx("rect",{x:0,y:de*a,width:Math.max(Fe,1e3),height:a,fill:de%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-bg-${H.id}`)),rt.map((H,de)=>de>0?jsx("line",{x1:H.x,y1:0,x2:H.x,y2:pe.length*a,stroke:t.borderLight,strokeWidth:1,shapeRendering:"crispEdges",opacity:t.neonRedGlow?1:.1},`vgrid-${de}`):null),x&&rt.map((H,de)=>{let N=rt[de+1]?.x||Fe;return Re(H.date)?jsxs("g",{children:[jsx("rect",{x:H.x,y:0,width:N-H.x,height:pe.length*a,fill:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",style:{pointerEvents:"none"}}),jsx("rect",{x:H.x,y:0,width:N-H.x,height:pe.length*a,fill:"url(#weekend-hatch)",style:{pointerEvents:"none"}})]},`we-overlay-${de}`):null}),pe.map((H,de)=>{let N=H.startDate&&H.endDate;return jsx("g",{children:!N&&jsxs(Fragment,{children:[jsx("rect",{x:0,y:de*a,width:Fe,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:Y=>Qe(Y,H),onMouseMove:Y=>ae(Y,H,de),onMouseLeave:()=>{tt();}},`clickable-${H.id}`),j&&j.taskId===H.id&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx("line",{x1:j.x,y1:de*a+4,x2:j.x,y2:de*a+a-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsx("circle",{cx:j.x,cy:j.y,r:8,fill:t.accent,opacity:.9}),jsx("circle",{cx:j.x,cy:j.y,r:4,fill:"white",opacity:.9}),jsxs("g",{transform:`translate(${j.x}, ${de*a-8})`,children:[jsx("rect",{x:-40,y:-20,width:80,height:20,rx:4,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsx("text",{x:0,y:-6,textAnchor:"middle",fill:t.textPrimary,fontSize:"11",fontFamily:"Inter, sans-serif",fontWeight:"500",children:j.date.toLocaleDateString(i==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!j||j.taskId!==H.id)&&jsx("text",{x:lt>0?lt:100,y:de*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:S.labels.clickToSetDates},`placeholder-${H.id}`)]})},`row-group-${H.id}`)}),pe.map((H,de)=>{if(!H.startDate||!H.endDate)return null;let{x:N,width:Y}=at(H),ie=de*a+(a-18)/2,ke=H.subtasks&&H.subtasks.length>0&&!H.isMilestone;if(H.isMilestone)return jsx(hi,{task:H,x:N+Y/2,y:ie+12,theme:t,onClick:d},H.id);if(ke){let V=!t.bgPrimary||t.bgPrimary.startsWith("#0")||t.bgPrimary.startsWith("#1"),re=8,Ve=ie+(a-18)/2+(18-re)/2,De=4,We=H.progress||0,Ne=new Date;Ne.setHours(0,0,0,0);let Ke=H.startDate&&Ne>=H.startDate,ht=H.endDate&&(()=>{let ft=new Date(H.endDate);return ft.setHours(0,0,0,0),Ne>ft})(),dt=H.startDate&&Ne<H.startDate,nt=1;if(Ke&&H.startDate&&H.endDate&&!dt){let ft=new Date(H.startDate);ft.setHours(0,0,0,0);let At=new Date(H.endDate);At.setHours(0,0,0,0);let Ge=Math.max(1,(At.getTime()-ft.getTime())/(1e3*60*60*24)),pt=Math.min((Ne.getTime()-ft.getTime())/(1e3*60*60*24),Ge)/Ge*100;nt=pt>0?We/pt:1;}let et;We>=100?et="#00E5CC":dt?et="#4B5563":ht&&We<100?et="#EF4444":nt>=.95?et="#22C55E":nt>=.8?et="#F59E0B":et="#EF4444";let Lt=Math.max(We/100*Y,We>0?De*2:0),Pt=Y>100&&We>0,gt=H.isCriticalPath;return jsxs("g",{onClick:()=>d?.(H),onContextMenu:ft=>{ft.preventDefault(),ft.stopPropagation(),g?.(H,ft);},onMouseMove:ft=>{U({task:H,x:N,y:Ve,width:Y,height:re,showBelow:Ve<100,mouseX:ft.clientX,mouseY:ft.clientY});},onMouseLeave:()=>U(null),style:{cursor:"default",opacity:y?gt?1:.25:1,transition:"opacity 300ms ease"},children:[jsx("rect",{x:N,y:ie,width:Y,height:a,fill:"transparent",style:{pointerEvents:"all"}}),jsx("rect",{x:N,y:Ve,width:Y,height:re,rx:De,fill:V?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.08)"}),We>0&&jsx("rect",{x:N,y:Ve,width:Lt,height:re,rx:De,fill:et}),y&>&&jsx("rect",{x:N,y:Ve,width:Y,height:re,rx:De,fill:"none",stroke:"#EF4444",strokeWidth:2,style:{pointerEvents:"none",filter:"drop-shadow(0 0 6px rgba(239, 68, 68, 0.4))"}}),Pt&&jsxs("text",{x:N+Lt+6,y:Ve+re/2,dominantBaseline:"central",fill:V?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.55)",fontSize:"9",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[Math.round(We),"%"]})]},H.id)}return jsx(pi,{task:H,x:N,y:ie,width:Y,theme:t,dayWidth:te*n,startDate:o,templates:c,onClick:d,onDoubleClick:m,onContextMenu:g,onDateChange:b,onDependencyCreate:h,allTaskPositions:mt,onDragMove:Ft,onHoverChange:U,showBaseline:f,showTaskBarLabels:p,showCriticalPath:y,readOnly:T?!T(H):false},H.id)}),w&&pe.map((H,de)=>!H.dependencies||H.dependencies.length===0||!H.startDate||!H.endDate?null:H.dependencies.map(N=>{let Y=pe.find(et=>et.id===N);if(!Y||!Y.startDate||!Y.endDate)return null;let ie=pe.findIndex(et=>et.id===N),ke=Te(Y.id,at(Y)),V=Te(H.id,at(H)),re=ke.x+ke.width,Ve=ie*a+26,De=V.x,We=de*a+26,Ne=`dep-${N}-${H.id}`;if(ze.has(Ne))return null;let Ke=y&&H.isCriticalPath&&Y.isCriticalPath;return jsx(Qn,{x1:re,y1:Ve,x2:De,y2:We,theme:t,lineStyle:l,colorOverride:y?Ke?"#EF4444":"rgba(255,255,255,0.10)":void 0,strokeWidthOverride:y?Ke?2:1:void 0,glowFilter:Ke?"drop-shadow(0 0 4px rgba(239, 68, 68, 0.3))":void 0,onDelete:()=>v?.(H.id,N),onHoverChange:et=>{ee.current=et,et&&X({key:Ne,fromId:N,toId:H.id,exitX:re,exitY:Ve,enterX:De,enterY:We});}},Ne)})),I.map(H=>jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:H.previewX,y:H.y-48,width:H.width,height:18,rx:6,fill:H.color||t.accent,opacity:.15,stroke:t.accent,strokeWidth:1,strokeDasharray:"4 3"}),Math.abs(H.daysDelta)>0&&jsx("text",{x:H.previewX+H.width/2,y:H.y-48+9,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:H.daysDelta>0?`+${H.daysDelta}d`:`${H.daysDelta}d`})]},`cascade-preview-${H.taskId}`)),w&&L&&jsx(Qn,{x1:L.exitX,y1:L.exitY,x2:L.enterX,y2:L.enterY,theme:t,lineStyle:l,onDelete:()=>{let H=L.key;X(null),ee.current=false,O(de=>new Set(de).add(H)),v?.(L.toId,L.fromId);},hoverOverlayOnly:true,onHoverChange:H=>{ee.current=H,H||X(null);}},`${L.key}-hover-overlay`),lt>=0&<<=Fe&&jsxs("g",{style:{pointerEvents:"none"},children:[t.neonRedGlow&&jsx("line",{x1:lt,y1:0,x2:lt,y2:Ze,stroke:t.today,strokeWidth:6,opacity:.15}),jsx("line",{x1:lt,y1:0,x2:lt,y2:Ze,stroke:t.today,strokeWidth:1,opacity:1})]})]}),E&&jsx(rm,{tooltipData:E,theme:t,locale:i==="es"?"es":"en"})]})}var wv=['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=({size:e=16})=>jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:"M12 2l2.4 7.2L22 12l-7.6 2.8L12 22l-2.4-7.2L2 12l7.6-2.8L12 2z"})}),kv=()=>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"})}),Cv=()=>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"})}),Tv=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M5 12h14"})}),Nv=()=>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 ki({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:i,onDependencyDelete:c}){let[l,p]=useState(false),[d,m]=useState(false),[g,b]=useState([]),[h,v]=useState(""),[f,y]=useState(false),[w,x]=useState(true),[T,k]=useState(""),[S,C]=useState(-1),[I,$]=useState(false),[A,_]=useState(0),E=useRef(null),me=useRef(null),L=useRef(null),X=useRef(null),{enabled:ee=true,placeholder:ze='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:O="bottom-right",onCommand:j,suggestions:he=wv,maxHistory:je=50,persistHistory:U,mentionableUsers:oe=[]}=a,te=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",Fe=te?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",we=te?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.25)",Re=te?"0 0 20px rgba(46, 148, 255, 0.08), 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 0 12px rgba(46, 148, 255, 0.04)":"0 0 20px rgba(46, 148, 255, 0.06), 0 4px 12px rgba(0, 0, 0, 0.08)",Ue=te?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",Qe=te?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",ae=te?"rgba(10, 10, 10, 0.85)":"rgba(255, 255, 255, 0.95)",tt=te?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.2)",pe=te?"rgba(46, 148, 255, 0.9)":"#2E94FF",at=te?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",mt=te?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",Ft=te?"0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(46, 148, 255, 0.04), inset 0 1px 0 rgba(255,255,255,0.03)":"0 20px 60px rgba(0, 0, 0, 0.1), 0 0 20px rgba(46, 148, 255, 0.04)",Te=te?"rgba(46, 148, 255, 0.04)":"rgba(46, 148, 255, 0.03)",rt=te?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.08)",lt=te?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",Ze=te?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",H=te?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.85)",de=te?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",N=te?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)",Y=te?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",ie=te?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",ke="rgba(46, 148, 255, 0.04)",V=te?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.12)",re=te?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.5)",Ve=te?"rgba(46, 148, 255, 0.25)":"rgba(46, 148, 255, 0.3)",De=te?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",We=te?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.12)",Ne=te?"rgba(255, 255, 255, 0.04)":"rgba(0, 0, 0, 0.03)",Ke=te?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",ht=te?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",dt="rgba(46, 148, 255, 0.06)",nt=te?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",et=te?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.1)",Lt=te?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",Pt=te?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",gt=te?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",vt=te?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",ft=te?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",At=te?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",Ge=te?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",Oe=te?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",pt=te?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",le=te?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",fe=te?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",P=te?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",K=te?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",q=U?.storageKey||"gantt-ai-history",ce=U?.maxMessages??5,Se=oe.filter(B=>{if(!T)return true;let z=T.toLowerCase();return B.name.toLowerCase().includes(z)||B.email&&B.email.toLowerCase().includes(z)}).slice(0,5),Xe=useCallback(B=>{if(v(B),oe.length===0)return;let z=E.current;if(!z)return;let ne=z.selectionStart||B.length,D=B.slice(0,ne),Q=D.lastIndexOf("@");if(Q>=0&&((Q>0?D[Q-1]:" ")===" "||Q===0)){let Ee=D.slice(Q+1);if(Ee.length<=40){k(Ee),C(Q),$(true),_(0);return}}$(false),k(""),C(-1);},[oe.length]),_e=useCallback(B=>{let z=h.slice(0,S),ne=h.slice(S+1+T.length),D=`${z}@${B.name} ${ne}`;v(D),$(false),k(""),C(-1),setTimeout(()=>E.current?.focus(),0);},[h,S,T]),Be=useCallback(B=>{if(!I||Se.length===0)return false;if(B.key==="ArrowDown")return B.preventDefault(),_(z=>z<Se.length-1?z+1:0),true;if(B.key==="ArrowUp")return B.preventDefault(),_(z=>z>0?z-1:Se.length-1),true;if(B.key==="Enter"||B.key==="Tab"){B.preventDefault();let z=Se[A];return z&&_e(z),true}return B.key==="Escape"?($(false),true):false},[I,Se,A,_e]);useEffect(()=>{if(U?.enabled)try{let B=localStorage.getItem(q);if(B){let ne=JSON.parse(B).map(D=>({...D,timestamp:new Date(D.timestamp)}));b(ne.slice(-ce));}}catch(B){console.warn("[GanttAIAssistant] Failed to load persisted history:",B);}},[U?.enabled,q,ce]),useEffect(()=>{if(U?.enabled&&g.length>0)try{let B=g.filter(z=>!z.isLoading).slice(-ce);localStorage.setItem(q,JSON.stringify(B));}catch(B){console.warn("[GanttAIAssistant] Failed to persist history:",B);}},[g,U?.enabled,q,ce]),useEffect(()=>{me.current&&me.current.scrollIntoView({behavior:"smooth"});},[g]),useEffect(()=>{l&&!d&&E.current&&setTimeout(()=>E.current?.focus(),100);},[l,d]);let M=useCallback(B=>{if(B.success)switch(B.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":B.taskId&&B.updates&&o?.(B.taskId,B.updates);break;case "create_task":B.newTask&&s?.(B.newTask);break;case "delete_task":B.taskId&&n?.(B.taskId);break;case "link_tasks":B.dependencyFrom&&B.dependencyTo&&i?.(B.dependencyFrom,B.dependencyTo);break;case "unlink_tasks":B.taskId&&B.dependencyFrom&&c?.(B.taskId,B.dependencyFrom);break}},[o,s,n,i,c]),J=useCallback(async B=>{if(!B.trim()||f)return;let z={id:`user-${Date.now()}`,role:"user",content:B,timestamp:new Date};b(D=>[...D.slice(-(je-1)),z]),v(""),x(false),y(true);let ne={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};b(D=>[...D,ne]);try{if(j){let D=await j(B,e);b(Q=>{let Ce=Q.filter(yt=>!yt.isLoading),Ee={id:`assistant-${Date.now()}`,role:"assistant",content:D.message,timestamp:new Date,command:D};return [...Ce,Ee]}),M(D);}else b(D=>[...D.filter(Ce=>!Ce.isLoading),{id:`assistant-${Date.now()}`,role:"assistant",content:"AI handler not configured. Please provide an onCommand handler in the aiAssistant config.",timestamp:new Date}]);}catch(D){b(Q=>[...Q.filter(Ee=>!Ee.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${D instanceof Error?D.message:"Unknown error"}`,timestamp:new Date}]);}finally{y(false);}},[f,je,j,e,M]),ye=B=>{B.preventDefault(),J(h);},Ie=B=>{v(B),E.current?.focus();};if(useEffect(()=>{let B=z=>{(z.metaKey||z.ctrlKey)&&z.key==="k"&&(z.preventDefault(),p(ne=>!ne),l||m(false)),z.key==="Escape"&&l&&p(false);};return document.addEventListener("keydown",B),()=>document.removeEventListener("keydown",B)},[l]),useEffect(()=>{if(!l)return;let B=ne=>{let D=ne.target;L.current&&!L.current.contains(D)&&p(false);},z=setTimeout(()=>{document.addEventListener("mousedown",B);},100);return ()=>{clearTimeout(z),document.removeEventListener("mousedown",B);}},[l]),!ee)return null;let $e={"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:!l&&jsxs(motion.button,{initial:{scale:0,opacity:0,rotate:-180},animate:{scale:1,opacity:1,rotate:0},exit:{scale:0,opacity:0,rotate:180},transition:{type:"spring",damping:20,stiffness:260},whileHover:{scale:1.12},whileTap:{scale:.9},className:`fixed ${$e[O]} z-[99999] group`,style:{width:44,height:44,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:Fe,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:`1px solid ${we}`,color:"#2E94FF",cursor:"pointer",boxShadow:Re,overflow:"visible"},onClick:()=>p(true),children:[jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:`1px solid ${Ue}`,animation:"ai-fab-pulse 3s ease-in-out infinite",pointerEvents:"none"}}),jsx("span",{style:{position:"absolute",inset:-6,borderRadius:"50%",border:`1px solid ${Qe}`,animation:"ai-fab-pulse 3s ease-in-out infinite 1.5s",pointerEvents:"none"}}),jsx(sm,{size:18}),jsx("span",{className:"pointer-events-none opacity-0 group-hover:opacity-100 transition-opacity duration-200",style:{position:"absolute",right:"100%",marginRight:10,whiteSpace:"nowrap",fontSize:11,fontWeight:500,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.05em",textTransform:"uppercase",color:pe,background:ae,backdropFilter:"blur(8px)",padding:"4px 10px",borderRadius:6,border:`1px solid ${tt}`},children:"AI \xB7 \u2318K"}),jsx("style",{children:`
|
|
362
362
|
@keyframes ai-fab-pulse {
|
|
363
363
|
0%, 100% { transform: scale(1); opacity: 0.4; }
|
|
364
364
|
50% { transform: scale(1.15); opacity: 0; }
|
|
365
365
|
}
|
|
366
|
-
`})]})}),jsx(AnimatePresence,{children:l&&jsxs(motion.div,{ref:L,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 ${Oe[O]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:at,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${pt}`,boxShadow:Et},children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:Ce,borderBottom:`1px solid ${rt}`},children:[jsxs("div",{className:"flex items-center gap-2.5",children:[jsx("div",{style:{width:28,height:28,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:it,border:`1px solid ${Ze}`,color:"#2E94FF"},children:jsx(nm,{size:14})}),jsx("span",{style:{fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.06em",textTransform:"uppercase",color:H},children:"AI Assistant"})]}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{onClick:()=>m(B=>!B),className:"p-1.5 rounded-lg transition-colors",style:{color:de},onMouseEnter:B=>{B.currentTarget.style.background=Y,B.currentTarget.style.color=N;},onMouseLeave:B=>{B.currentTarget.style.background="transparent",B.currentTarget.style.color=de;},children:jsx(Cv,{})}),jsx("button",{onClick:()=>p(false),className:"p-1.5 rounded-lg transition-colors",style:{color:de},onMouseEnter:B=>{B.currentTarget.style.background=Y,B.currentTarget.style.color=N;},onMouseLeave:B=>{B.currentTarget.style.background="transparent",B.currentTarget.style.color=de;},children:jsx(kv,{})})]})]}),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:[g.length===0&&w&&jsxs("div",{className:"space-y-3",children:[jsx("p",{className:"text-xs text-center",style:{color:ie,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsx("div",{className:"flex flex-wrap gap-2",children:he.slice(0,4).map((B,z)=>jsx("button",{onClick:()=>Le(B),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:ke,color:ae,border:`1px solid ${V}`},onMouseEnter:ne=>{ne.currentTarget.style.borderColor=Ve,ne.currentTarget.style.color="#2E94FF";},onMouseLeave:ne=>{ne.currentTarget.style.borderColor=V,ne.currentTarget.style.color=ae;},children:B.length>30?B.slice(0,30)+"...":B},z))})]}),g.map(B=>jsx(motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${B.role==="user"?"justify-end":"justify-start"}`,children:jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${B.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:B.role==="user"?De:Ne,color:B.role==="user"?"#2E94FF":bt,border:B.role==="user"?`1px solid ${Ue}`:`1px solid ${Ke}`},children:[B.isLoading?jsx(Tv,{}):jsx("p",{className:"text-sm whitespace-pre-wrap",children:B.content}),B.command&&jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:B.command.success?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:B.command.success?"#10B981":"#EF4444",border:`1px solid ${B.command.success?"rgba(16,185,129,0.2)":"rgba(239,68,68,0.2)"}`},children:[B.command.success?"\u2713":"\u2717",jsx("span",{className:"capitalize",children:B.command.type.replace(/_/g," ")})]})]})},B.id)),jsx("div",{ref:me})]}),jsxs("form",{onSubmit:B=>{if(I&&Se.length>0){B.preventDefault();return}ye(B);},className:"p-3 relative",style:{borderTop:`1px solid ${lt}`},children:[jsx(AnimatePresence,{children:I&&Se.length>0&&jsx(motion.div,{ref:X,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:4},transition:{duration:.12},className:"absolute bottom-full left-3 right-3 mb-1 rounded-lg overflow-hidden z-10",style:{background:Pt,border:`1px solid ${Ge}`,boxShadow:Re,backdropFilter:"blur(12px)"},children:Se.map((B,z)=>jsxs("button",{type:"button",onClick:()=>_e(B),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:z===A?ut:"transparent",color:le},onMouseEnter:()=>_(z),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0",style:{background:P,border:`1px solid ${K}`,color:"#2E94FF"},children:B.name.split(" ").map(ne=>ne[0]).join("").slice(0,2).toUpperCase()}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-sm font-medium truncate",children:B.name}),B.email&&jsx("div",{className:"text-xs truncate",style:{color:fe},children:B.email})]})]},B.id))})}),jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:nt,border:`1px solid ${et}`},children:[jsx("input",{ref:E,type:"text",value:h,onChange:B=>Xe(B.target.value),onKeyDown:B=>{Ie(B);},placeholder:He,disabled:f,className:"flex-1 bg-transparent text-sm outline-none",style:{color:At,fontFamily:"Inter, sans-serif"}}),jsx("button",{type:"submit",disabled:!h.trim()||f,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:h.trim()?Mt:"transparent",color:h.trim()?"#2E94FF":yt,border:h.trim()?`1px solid ${mt}`:"1px solid transparent"},children:jsx(wv,{})})]}),jsx("p",{className:"text-[10px] text-center mt-2",style:{color:gt,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function sm(e,t=50){let[a,r]=useState({past:[],present:e,future:[]}),o=useRef(false),s=useCallback((l,p=true)=>{r(d=>{let m=typeof l=="function"?l(d.present):l;if(o.current)return {...d,present:m};if(!p)return {...d,present:m};let g=[...d.past,d.present];return g.length>t&&g.shift(),{past:g,present:m,future:[]}});},[t]),n=useCallback(()=>{r(l=>{if(l.past.length===0)return l;let p=l.past[l.past.length-1],d=l.past.slice(0,l.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:p,future:[l.present,...l.future]}});},[]),i=useCallback(()=>{r(l=>{if(l.future.length===0)return l;let p=l.future[0],d=l.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...l.past,l.present],present:p,future:d}});},[]),c=useCallback(()=>{r(l=>({past:[],present:l.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:i,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:c}}function im({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){useEffect(()=>{if(!o)return;let s=n=>{let i=navigator.platform.toUpperCase().indexOf("MAC")>=0,c=i?n.metaKey:n.ctrlKey;if(c&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!i&&c&&n.key==="y"){n.preventDefault(),t();return}if(i&&c&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var Ev={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${Pe.formatDate(e.startDate)} - ${Pe.formatDate(e.endDate)}`);let a=Pe.calculateDuration(e.startDate,e.endDate);t.push(`Duration: ${a} days`);}if(e.progress!==void 0&&t.push(`Progress: ${e.progress}%`),e.status&&t.push(`Status: ${e.status}`),e.assignees&&e.assignees.length>0){let a=e.assignees.map(r=>r.name).join(", ");t.push(`Assigned: ${a}`);}return e.dependencies&&e.dependencies.length>0&&t.push(`Dependencies: ${e.dependencies.length}`),t.join("<br/>")},taskLabel:e=>e.name,gridCell:(e,t,a)=>a,taskClass:e=>{let t=[];return e.isCriticalPath&&t.push("critical-path"),e.status==="completed"?t.push("completed"):e.status==="in-progress"?t.push("in-progress"):e.status==="todo"&&t.push("todo"),e.isMilestone&&t.push("milestone"),t.join(" ")},milestoneContent:e=>`\u25C6 ${e.name}`,dateFormat:e=>Pe.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function lm(e){return {...Ev,...e}}var Rv=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},um=forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:i="comfortable",showThemeSelector:c=true,showExportButton:l=true,projectName:p,availableUsers:d=[],templates:m,enableAutoCriticalPath:g=true,persistExpandedState:b,persistFilter:h,clearFiltersKey:v,aiAssistant:f,locale:y="en",customTranslations:w,showCreateTaskButton:x=false,createTaskLabel:C,onCreateTask:k,taskFilter:D,onTaskFilterChange:T,toolbarRightContent:I,showBaseline:$,viewMode:A,onViewModeChange:_,projectForecast:E,onThemeChange:me,onTaskClick:L,onTaskDblClick:X,onTaskContextMenu:Z,onTaskUpdate:He,onDependentTasksScheduled:O,onProgressChange:j,onTaskEdit:he,onTaskAddSubtask:je,onTaskMarkIncomplete:U,onTaskSetInProgress:re,onDependencyCreate:ee,onDependencyDelete:Ee,onBeforeTaskAdd:we,onAfterTaskAdd:Be,onBeforeTaskUpdate:ze,onAfterTaskUpdate:Qe,onBeforeTaskDelete:te,onAfterTaskDelete:tt,permissions:pe,onCopySnapshotLink:at}=a,Et=useContext(Zs)?.theme,[Ce,rt]=useState(Et||s||"dark"),[it,Ze]=useState(n),[H,de]=useState(i),[N,Y]=useState(1),[ie,ke]=useState("all"),[V,ae]=useState(A||"execution"),Ve=A??V,De=useCallback(F=>{ae(F),_?.(F);},[_]),Ue=$??Ve==="oracle",[Ne,Ke]=useState(a.showCriticalPath!==false),[bt,lt]=useState(a.showDependencies!==false),[nt,et]=useState(a.highlightWeekends!==false),At=useCallback(F=>{Ke(F),a.onShowCriticalPathChange?.(F);},[a.onShowCriticalPathChange]),Mt=useCallback(F=>{lt(F),a.onShowDependenciesChange?.(F);},[a.onShowDependenciesChange]),mt=useCallback(F=>{et(F),a.onHighlightWeekendsChange?.(F);},[a.onHighlightWeekendsChange]);useEffect(()=>{a.onTimeScaleChange?.(it);},[it]),useEffect(()=>{a.onZoomChange?.(N);},[N]);let yt=useRef(a.onDateRangeChange);yt.current=a.onDateRangeChange;let gt=useCallback(()=>h?typeof h=="string"?h:"gantt-filter-state":null,[h]),[Pt,Ge]=useState(()=>{if(!h)return "all";try{let F=typeof h=="string"?h:"gantt-filter-state",R=localStorage.getItem(F);if(R){let G=JSON.parse(R);if(G.taskFilter)return G.taskFilter}}catch(F){console.warn("[GanttBoard] Error loading filter state from localStorage:",F);}return "all"}),Re=D??Pt,ut=T??Ge,[le,fe]=useState(()=>{if(!h)return false;try{let F=typeof h=="string"?h:"gantt-filter-state",R=localStorage.getItem(F);if(R){let G=JSON.parse(R);if(typeof G.hideCompleted=="boolean")return G.hideCompleted}}catch(F){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",F);}return false});useEffect(()=>{let F=gt();if(F)try{let R={taskFilter:Re,hideCompleted:le};localStorage.setItem(F,JSON.stringify(R));}catch(R){console.warn("[GanttBoard] Error saving filter state to localStorage:",R);}},[Re,le,gt]);let P=useRef(v);useEffect(()=>{if(P.current!==v&&v!==void 0){Ge("all"),fe(false);let F=gt();if(F)try{localStorage.removeItem(F);}catch(R){console.warn("[GanttBoard] Error clearing filter state from localStorage:",R);}}P.current=v;},[v,gt]);let[K,q]=useState(0),[ce,Se]=useState(false),[Xe,_e]=useState(null),[Ie,M]=useState({isOpen:false,x:0,y:0,task:null}),[J,ye]=useState(null),[Le,Oe]=useState(null);useEffect(()=>{Et&&Et!==Ce&&rt(Et);},[Et]),useEffect(()=>{s&&s!==Ce&&rt(s);},[s]);let B=useCallback(F=>{rt(F),me?.(F);},[me]),{state:z,setState:ne,undo:S,redo:oe,canUndo:Te,canRedo:We,clearHistory:Tt}=sm(t,50),Nt=useMemo(()=>{let F=(R,G=0)=>{let Q=G;for(let xe of R)xe.subtasks?.length&&(Q=Math.max(Q,F(xe.subtasks,G+1)));return Q};return F(z)+1},[z]),la=useCallback(()=>b?typeof b=="string"?b:"gantt-expanded-tasks":null,[b]),aa=useRef(new Map),ya=useRef(false);if(!ya.current&&b){ya.current=true;let F=typeof b=="string"?b:"gantt-expanded-tasks";try{let R=localStorage.getItem(F);if(R){let G=JSON.parse(R);Array.isArray(G)&&(aa.current=new Map(G));}}catch(R){console.warn("[GanttBoard] Error loading expanded state from localStorage:",R);}}let Ut=useCallback(()=>{let F=la();if(F)try{let R=Array.from(aa.current.entries());localStorage.setItem(F,JSON.stringify(R));}catch(R){console.warn("[GanttBoard] Error saving expanded state to localStorage:",R);}},[la]),ua=useRef(0),Mn=useRef(z);useEffect(()=>{Mn.current=z;},[z]);let Ko=useRef(false),Fc=useCallback(F=>{ke(F),ua.current+=1,ne(R=>{let G=(xe,Me=0)=>xe.map(xt=>{let ot=F==="all"||Me<F-1;return xt.subtasks?.length&&aa.current.set(xt.id,ot),{...xt,isExpanded:ot,subtasks:xt.subtasks?G(xt.subtasks,Me+1):void 0}}),Q=G(R);return Ut(),Q});},[ne,Ut]);useEffect(()=>{if(ua.current>0){ua.current-=1;return}let F=G=>{let Q=new Map;for(let xe of G){let Me=xe.id;Q.get(Me)||Q.set(Me,xe);}return Array.from(Q.values())},R=G=>G.map(Q=>{let xe=aa.current.get(Q.id),Me=xe!==void 0?{...Q,isExpanded:xe}:Q;if(Me.subtasks?.length){let xt=F(Me.subtasks);return {...Me,subtasks:R(xt)}}return Me});if(aa.current.size>0)ne(yr(R(t)));else {let G=Q=>Q.map(xe=>xe.subtasks?.length?{...xe,subtasks:F(G(xe.subtasks))}:xe);ne(yr(G(t)));}},[t,ne]);let ys=useRef(t),Mc=useRef(true);useEffect(()=>{if(Mc.current){Mc.current=false,ys.current=z;return}if(Ko.current){Ko.current=false,ys.current=z;return}if(!r)return;let F=JSON.stringify(ys.current),R=JSON.stringify(z);F!==R&&(ys.current=z,r(z));},[z,r]);let ja=useMemo(()=>id(y,w),[y,w]),V0=useCallback(F=>[{id:"name",label:F.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:F.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:F.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:F.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:F.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:F.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:F.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:F.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[Yo,Xi]=useState(()=>V0(ja));useEffect(()=>{Xi(F=>F.map(R=>({...R,label:ja.columns[R.id==="name"?"taskName":R.id]||R.label})));},[ja]);let xs=useMemo(()=>Yo.filter(R=>R.visible).reduce((R,G)=>R+G.width,0),[Yo]),Pc=useRef(Yo.filter(F=>F.visible).map(F=>F.id).join(","));useEffect(()=>{let F=Yo.filter(Q=>Q.visible),R=F.map(Q=>Q.id).join(","),G=Pc.current;if(R!==G){let Q=F.some(Me=>Me.id!=="name"),xe=G.includes(",");Q?!xe&&Q&&_e(null):_e(null),Pc.current=R;}},[Yo]);let Ac=60,Lc=.6,G0=useMemo(()=>{let R=xs+Ac,G=typeof window<"u"?window.innerWidth*Lc:800,Q=Math.max(R,G);return Xe!==null?Math.max(200,Math.min(Xe,Q)):Math.max(200,R)},[Xe,xs]),ro=useRef(null),vs=useRef(null),Br=useRef(null),Pn=useRef(null),ea=useMemo(()=>Fp(Ce),[Ce]),_0=useMemo(()=>({theme:ea,themeName:Ce}),[ea,Ce]),Ic=useMemo(()=>lm(m),[m]),Ji=useMemo(()=>{if(!g)return z;let F=Pe.calculateCriticalPathFull(z),R=G=>G.map(Q=>{let xe=F.get(Q.id),Me=Q.subtasks?R(Q.subtasks):void 0,xt=Me?.some(pa=>pa.isCriticalPath||pa.subtasks&&pa.subtasks.some($t=>$t.isCriticalPath))||false,ot=xe?xe.isCritical:xt;return {...Q,isCriticalPath:ot,cpmData:xe||void 0,subtasks:Me}});return R(z)},[z,g]),j0=useMemo(()=>Pe.flattenTasks(z).some(R=>R.dependencies&&R.dependencies.length>0),[z]),Bc=useMemo(()=>{if(Re==="all"&&!le)return Ji;let F=R=>{let G=[];for(let Q of R){let xe=Q.subtasks?.length?F(Q.subtasks):void 0,Me=false;if(le)Me=Q.progress<100;else switch(Re){case "all":Me=true;break;case "incomplete":Me=Q.progress<100;break;case "in_progress":Me=Q.progress>0&&Q.progress<100;break;case "completed":Me=Q.progress===100;break}(Me||xe&&xe.length>0)&&G.push({...Q,subtasks:xe});}return G};return F(Ji)},[Ji,Re,le]),ws=Rv(H);im({undo:S,redo:oe,canUndo:Te,canRedo:We,enabled:true}),useImperativeHandle(o,()=>({getTask:F=>Pe.findTaskById(z,F),addTask:(F,R)=>{ne(G=>{if(!R)return [...G,{...F,level:0}];let Q=xe=>xe.map(Me=>Me.id===R?{...Me,subtasks:[...Me.subtasks||[],{...F,parentId:R,level:(Me.level||0)+1}],isExpanded:true}:Me.subtasks?{...Me,subtasks:Q(Me.subtasks)}:Me);return Q(G)});},updateTask:(F,R)=>{ne(G=>{let Q=xe=>xe.map(Me=>Me.id===F?{...Me,...R}:Me.subtasks?{...Me,subtasks:Q(Me.subtasks)}:Me);return Q(G)});},deleteTask:F=>{ne(R=>{let G=Q=>Q.filter(xe=>xe.id===F?false:(xe.subtasks&&(xe.subtasks=G(xe.subtasks)),true));return G(R)});},deleteTasks:F=>{ne(R=>gd(R,F));},duplicateTask:F=>{if(a.onTaskDuplicate){let R=Pe.findTaskById(z,F);R&&a.onTaskDuplicate(R);}else ne(R=>Xn(R,[F]).tasks);},splitTask:(F,R,G=3)=>{ne(Q=>Pe.splitTask(Q,F,R,G));},calculateEndDate:Pe.calculateEndDate,calculateDuration:Pe.calculateDuration,validateDependency:(F,R)=>!Pe.validateDependencies(z,F,R),getAllTasks:()=>Pe.flattenTasks(z),getTasksByStatus:F=>Pe.flattenTasks(z).filter(R=>R.status===F),getTasksByParent:F=>F?Pe.findTaskById(z,F)?.subtasks||[]:z.filter(G=>!G.parentId),getCriticalPath:()=>Pe.flattenTasks(z).filter(F=>F.isCriticalPath),indentTask:F=>{ne(R=>yr(ud(R,[F])));},outdentTask:F=>{ne(R=>yr(pd(R,[F])));},moveTask:(F,R)=>{ne(G=>md(G,[F],R));},createSubtask:async F=>{let{tasks:R,newTask:G}=hd(z,F);if(we){let Q=we({...G,parentId:F});if((Q instanceof Promise?await Q:Q)===false)return}ne(yr(R)),Be&&Be({...G,parentId:F});},scrollToTask:F=>{let G=Pe.flattenTasks(z).findIndex(Q=>Q.id===F);if(G!==-1&&ro.current){let Q=G*ws;ro.current.scrollTo({top:Q,behavior:"smooth"}),Br.current&&Br.current.scrollTo({top:Q,behavior:"smooth"});}},highlightTask:(F,R=2e3)=>{},expandTask:F=>{ne(R=>{let G=Q=>Q.map(xe=>xe.id===F?{...xe,isExpanded:true}:xe.subtasks?{...xe,subtasks:G(xe.subtasks)}:xe);return G(R)});},collapseTask:F=>{ne(R=>{let G=Q=>Q.map(xe=>xe.id===F?{...xe,isExpanded:false}:xe.subtasks?{...xe,subtasks:G(xe.subtasks)}:xe);return G(R)});},expandAll:()=>{ne(F=>{let R=G=>G.map(Q=>({...Q,isExpanded:true,subtasks:Q.subtasks?R(Q.subtasks):void 0}));return R(F)});},collapseAll:()=>{ne(F=>{let R=G=>G.map(Q=>({...Q,isExpanded:false,subtasks:Q.subtasks?R(Q.subtasks):void 0}));return R(F)});},collapseToLevel:F=>{Fc(F);},undo:S,redo:oe,canUndo:()=>Te,canRedo:()=>We,clearHistory:Tt,exportToPNG:async()=>{if(!Pn.current||!ro.current||!Br.current)throw new Error("Gantt container not found");let F=Pn.current,R=ro.current,G=vs.current||R.querySelector(".gantt-grid-scroll"),Q=Br.current,xe=G?.scrollTop||0,Me=Q.scrollTop,xt=F.style.overflow,ot=F.style.height,pa=R.style.overflow;try{let $t=G?.querySelector(".gantt-taskgrid-content"),Jt=Q.querySelector("svg"),_a=$t?.scrollHeight||G?.scrollHeight||600,lr=Jt?.getBoundingClientRect().height||Q.scrollHeight,So=(F.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(_a,lr)+20;G&&(G.scrollTop=0),Q.scrollTop=0,F.style.overflow="visible",F.style.height=`${So}px`,R.style.overflow="visible",await new Promise(Zo=>setTimeout(Zo,100));let Rr=await toPng(F,{backgroundColor:ea.bgPrimary,pixelRatio:2,filter:Zo=>{if(!(Zo instanceof Element))return !0;let ks=window.getComputedStyle(Zo),Ln=parseInt(ks.zIndex,10);return (isNaN(Ln)||Ln<50)&&ks.position!=="fixed"}});return await(await fetch(Rr)).blob()}finally{F.style.overflow=xt,F.style.height=ot,R.style.overflow=pa,G&&(G.scrollTop=xe),Q.scrollTop=Me;}},exportToPDF:async F=>{await Pe.exportToPDF(z,F);},exportToExcel:async F=>{await Pe.exportToExcel(z,F);},exportToJSON:()=>Pe.exportToJSON(z),exportToCSV:()=>Pe.exportToCSV(z),importFromJSON:F=>{let R=Pe.importFromJSON(F);ne(R);},getTasks:()=>z,refresh:()=>{ne(F=>[...F]);},clearAll:()=>{ne([]);}}),[z,S,oe,Te,We,Tt,ea,ws]);let K0=useCallback(F=>{Xi(R=>R.map(G=>G.id===F?{...G,visible:!G.visible}:G));},[]),Y0=useCallback((F,R)=>{Xi(G=>G.map(Q=>{if(Q.id!==F)return Q;let xe=Q.minWidth??100,Me=Q.maxWidth??800,xt=Math.max(xe,Math.min(Me,R));return {...Q,width:xt}}));},[]),q0=useCallback(F=>{ne(R=>{let G=bd(R,F),Q=xe=>{for(let Me of xe){if(Me.id===F){aa.current.set(F,Me.isExpanded??true);return}Me.subtasks?.length&&Q(Me.subtasks);}};return Q(G),Ut(),G}),a.onTaskToggleExpand?.(F);},[a,Ut]),qo=useCallback((F,R)=>{if(ze&&ze(F,R)===false)return;let Q=Pe.findTaskById(z,F)?.progress,xe=xt=>xt.map(ot=>ot.id===F?{...ot,...R}:ot.subtasks?{...ot,subtasks:xe(ot.subtasks)}:ot);ne(xe(z));let Me=Pe.findTaskById(xe(z),F);Me&&(He?.(Me),Qe?.(Me),R.progress!==void 0&&Q!==void 0&&R.progress!==Q&&j?.(F,Q,R.progress));},[z,He,ze,Qe,j]),X0=useCallback(F=>{F.length!==0&&(ua.current+=1,Ko.current=true,ne(R=>yr(ud(R,F))),a.onTaskIndent?.(F[0]));},[a]),J0=useCallback(F=>{F.length!==0&&(ua.current+=1,Ko.current=true,ne(R=>yr(pd(R,F))),a.onTaskOutdent?.(F[0]));},[a]),Q0=useCallback((F,R,G)=>{ua.current+=1,Ko.current=true,ne(Q=>yr(Kp(Q,F,R,G))),a.onTaskReparent?.(F,R,G);},[a]),Z0=useCallback((F,R)=>{F.length!==0&&(ua.current+=1,Ko.current=true,ne(G=>md(G,F,R)),a.onTaskMove?.(F[0],R));},[a]),Qi=useCallback(async F=>{let R=[];for(let G of F)te&&await Promise.resolve(te(G))===false||R.push(G);R.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(R):(ne(G=>yr(gd(G,R))),R.forEach(G=>a.onTaskDelete?.(G))),tt&&R.forEach(G=>tt(G)));},[a,te,tt]),ef=useCallback(F=>{a.onTaskDuplicate?F.forEach(R=>{let G=Pe.findTaskById(z,R);G&&a.onTaskDuplicate(G);}):ne(R=>Xn(R,F).tasks);},[a,z]),tf=useCallback((F,R)=>{ne(G=>{let{tasks:Q,newTask:xe}=jp(G,F,R);return we&&we(xe)===false?G:(a.onTaskCreate?.(xe.parentId,xe.position||0),Be?.(xe),Q)});},[a,we,Be]),af=useCallback((F,R)=>{ne(G=>fd(G,F,R)),a.onTaskRename?.(F,R);},[a]),Zi=useCallback(F=>{let{onTaskAddSubtask:R}=a;if(R){let G=si(z,F);if(G){R(G);return}}ne(G=>{let{tasks:Q}=hd(G,F);return a.onTaskCreate?.(F,0),Q});},[a,z]),rf=useCallback((F,R,G)=>{let Q=!F.startDate&&!F.endDate,xe=F.startDate?Math.round((R.getTime()-F.startDate.getTime())/(1e3*60*60*24)):0,Me=$t=>$t.map(Jt=>Jt.id===F.id?{...Jt,startDate:R,endDate:G,...F.segments&&{segments:F.segments}}:Jt.subtasks?{...Jt,subtasks:Me(Jt.subtasks)}:Jt),xt=Me(z),ot=xt;xt=Pe.autoScheduleDependents(xt,F.id,xe),xt=yr(xt),ne(xt);let pa={...F,startDate:R,endDate:G};if(Q&&a?.onTaskDateChange?a.onTaskDateChange(F,R,G):He?.(pa),O&&xe!==0){let $t=Pe.flattenTasks(ot),Jt=Pe.flattenTasks(xt),_a=[];for(let lr of Jt){if(lr.id===F.id)continue;let oo=$t.find(Rr=>Rr.id===lr.id);if(!oo)continue;let Qo=lr.startDate?.getTime()!==oo.startDate?.getTime(),So=lr.endDate?.getTime()!==oo.endDate?.getTime();(Qo||So)&&_a.push(lr);}_a.length>0&&O(_a);}},[z,He,O,a]),of=useCallback((F,R)=>{Z?.(F,R),M({isOpen:true,x:R.clientX,y:R.clientY,task:F});},[Z]),nf=useCallback((F,R)=>{let G=Pe.splitTask(z,F.id,R);ne(G),M({isOpen:false,x:0,y:0,task:null});},[z]),Rc=useCallback(F=>{let R=Pe.findTaskById(z,F.id)||F;X?.(R),he||ye(R);},[z,X,he]),Oc=useCallback((F,R,G)=>{let Q=new Map,xe=$t=>{$t.forEach(Jt=>{Jt.dependencies&&Q.set(Jt.id,Jt.dependencies),Jt.subtasks&&xe(Jt.subtasks);});};xe(G);let Me=Q.get(R)||[];Q.set(R,[...Me,F]);let xt=new Set,ot=new Set,pa=$t=>{if(!xt.has($t)){xt.add($t),ot.add($t);let Jt=Q.get($t)||[];for(let _a of Jt){if(!xt.has(_a)&&pa(_a))return true;if(ot.has(_a))return true}}return ot.delete($t),false};return pa(R)},[]),$c=useCallback((F,R)=>{if(Oc(F.id,R,Mn.current)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
366
|
+
`})]})}),jsx(AnimatePresence,{children:l&&jsxs(motion.div,{ref:L,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 ${$e[O]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:at,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${mt}`,boxShadow:Ft},children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:Te,borderBottom:`1px solid ${rt}`},children:[jsxs("div",{className:"flex items-center gap-2.5",children:[jsx("div",{style:{width:28,height:28,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:lt,border:`1px solid ${Ze}`,color:"#2E94FF"},children:jsx(sm,{size:14})}),jsx("span",{style:{fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.06em",textTransform:"uppercase",color:H},children:"AI Assistant"})]}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{onClick:()=>m(B=>!B),className:"p-1.5 rounded-lg transition-colors",style:{color:de},onMouseEnter:B=>{B.currentTarget.style.background=Y,B.currentTarget.style.color=N;},onMouseLeave:B=>{B.currentTarget.style.background="transparent",B.currentTarget.style.color=de;},children:jsx(Tv,{})}),jsx("button",{onClick:()=>p(false),className:"p-1.5 rounded-lg transition-colors",style:{color:de},onMouseEnter:B=>{B.currentTarget.style.background=Y,B.currentTarget.style.color=N;},onMouseLeave:B=>{B.currentTarget.style.background="transparent",B.currentTarget.style.color=de;},children:jsx(Cv,{})})]})]}),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:[g.length===0&&w&&jsxs("div",{className:"space-y-3",children:[jsx("p",{className:"text-xs text-center",style:{color:ie,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsx("div",{className:"flex flex-wrap gap-2",children:he.slice(0,4).map((B,z)=>jsx("button",{onClick:()=>Ie(B),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:ke,color:re,border:`1px solid ${V}`},onMouseEnter:ne=>{ne.currentTarget.style.borderColor=Ve,ne.currentTarget.style.color="#2E94FF";},onMouseLeave:ne=>{ne.currentTarget.style.borderColor=V,ne.currentTarget.style.color=re;},children:B.length>30?B.slice(0,30)+"...":B},z))})]}),g.map(B=>jsx(motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${B.role==="user"?"justify-end":"justify-start"}`,children:jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${B.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:B.role==="user"?De:Ne,color:B.role==="user"?"#2E94FF":ht,border:B.role==="user"?`1px solid ${We}`:`1px solid ${Ke}`},children:[B.isLoading?jsx(Nv,{}):jsx("p",{className:"text-sm whitespace-pre-wrap",children:B.content}),B.command&&jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:B.command.success?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:B.command.success?"#10B981":"#EF4444",border:`1px solid ${B.command.success?"rgba(16,185,129,0.2)":"rgba(239,68,68,0.2)"}`},children:[B.command.success?"\u2713":"\u2717",jsx("span",{className:"capitalize",children:B.command.type.replace(/_/g," ")})]})]})},B.id)),jsx("div",{ref:me})]}),jsxs("form",{onSubmit:B=>{if(I&&Se.length>0){B.preventDefault();return}ye(B);},className:"p-3 relative",style:{borderTop:`1px solid ${dt}`},children:[jsx(AnimatePresence,{children:I&&Se.length>0&&jsx(motion.div,{ref:X,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:4},transition:{duration:.12},className:"absolute bottom-full left-3 right-3 mb-1 rounded-lg overflow-hidden z-10",style:{background:At,border:`1px solid ${Ge}`,boxShadow:Oe,backdropFilter:"blur(12px)"},children:Se.map((B,z)=>jsxs("button",{type:"button",onClick:()=>_e(B),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:z===A?pt:"transparent",color:le},onMouseEnter:()=>_(z),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0",style:{background:P,border:`1px solid ${K}`,color:"#2E94FF"},children:B.name.split(" ").map(ne=>ne[0]).join("").slice(0,2).toUpperCase()}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-sm font-medium truncate",children:B.name}),B.email&&jsx("div",{className:"text-xs truncate",style:{color:fe},children:B.email})]})]},B.id))})}),jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:nt,border:`1px solid ${et}`},children:[jsx("input",{ref:E,type:"text",value:h,onChange:B=>Xe(B.target.value),onKeyDown:B=>{Be(B);},placeholder:ze,disabled:f,className:"flex-1 bg-transparent text-sm outline-none",style:{color:Lt,fontFamily:"Inter, sans-serif"}}),jsx("button",{type:"submit",disabled:!h.trim()||f,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:h.trim()?Pt:"transparent",color:h.trim()?"#2E94FF":vt,border:h.trim()?`1px solid ${gt}`:"1px solid transparent"},children:jsx(kv,{})})]}),jsx("p",{className:"text-[10px] text-center mt-2",style:{color:ft,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function im(e,t=50){let[a,r]=useState({past:[],present:e,future:[]}),o=useRef(false),s=useCallback((l,p=true)=>{r(d=>{let m=typeof l=="function"?l(d.present):l;if(o.current)return {...d,present:m};if(!p)return {...d,present:m};let g=[...d.past,d.present];return g.length>t&&g.shift(),{past:g,present:m,future:[]}});},[t]),n=useCallback(()=>{r(l=>{if(l.past.length===0)return l;let p=l.past[l.past.length-1],d=l.past.slice(0,l.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:p,future:[l.present,...l.future]}});},[]),i=useCallback(()=>{r(l=>{if(l.future.length===0)return l;let p=l.future[0],d=l.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...l.past,l.present],present:p,future:d}});},[]),c=useCallback(()=>{r(l=>({past:[],present:l.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:i,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:c}}function lm({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){useEffect(()=>{if(!o)return;let s=n=>{let i=navigator.platform.toUpperCase().indexOf("MAC")>=0,c=i?n.metaKey:n.ctrlKey;if(c&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!i&&c&&n.key==="y"){n.preventDefault(),t();return}if(i&&c&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var Fv={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${Ae.formatDate(e.startDate)} - ${Ae.formatDate(e.endDate)}`);let a=Ae.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=>Ae.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function dm(e){return {...Fv,...e}}var Ov=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},pm=forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:i="comfortable",showThemeSelector:c=true,showExportButton:l=true,projectName:p,availableUsers:d=[],templates:m,enableAutoCriticalPath:g=true,persistExpandedState:b,persistFilter:h,clearFiltersKey:v,aiAssistant:f,locale:y="en",customTranslations:w,showCreateTaskButton:x=false,createTaskLabel:T,onCreateTask:k,taskFilter:S,onTaskFilterChange:C,toolbarRightContent:I,showBaseline:$,viewMode:A,onViewModeChange:_,projectForecast:E,onThemeChange:me,onTaskClick:L,onTaskDblClick:X,onTaskContextMenu:ee,onTaskUpdate:ze,onDependentTasksScheduled:O,onProgressChange:j,onTaskEdit:he,onTaskAddSubtask:je,onTaskMarkIncomplete:U,onTaskSetInProgress:oe,onDependencyCreate:te,onDependencyDelete:Fe,onBeforeTaskAdd:we,onAfterTaskAdd:Re,onBeforeTaskUpdate:Ue,onAfterTaskUpdate:Qe,onBeforeTaskDelete:ae,onAfterTaskDelete:tt,permissions:pe,onCopySnapshotLink:at}=a,Ft=useContext(ei)?.theme,[Te,rt]=useState(Ft||s||"dark"),[lt,Ze]=useState(n),[H,de]=useState(i),[N,Y]=useState(1),[ie,ke]=useState("all"),[V,re]=useState(A||"execution"),Ve=A??V,De=useCallback(F=>{re(F),_?.(F);},[_]),We=$??Ve==="oracle",[Ne,Ke]=useState(a.showCriticalPath!==false),[ht,dt]=useState(a.showDependencies!==false),[nt,et]=useState(a.highlightWeekends!==false),Lt=useCallback(F=>{Ke(F),a.onShowCriticalPathChange?.(F);},[a.onShowCriticalPathChange]),Pt=useCallback(F=>{dt(F),a.onShowDependenciesChange?.(F);},[a.onShowDependenciesChange]),gt=useCallback(F=>{et(F),a.onHighlightWeekendsChange?.(F);},[a.onHighlightWeekendsChange]);useEffect(()=>{a.onTimeScaleChange?.(lt);},[lt]),useEffect(()=>{a.onZoomChange?.(N);},[N]);let vt=useRef(a.onDateRangeChange);vt.current=a.onDateRangeChange;let ft=useCallback(()=>h?typeof h=="string"?h:"gantt-filter-state":null,[h]),[At,Ge]=useState(()=>{if(!h)return "all";try{let F=typeof h=="string"?h:"gantt-filter-state",R=localStorage.getItem(F);if(R){let G=JSON.parse(R);if(G.taskFilter)return G.taskFilter}}catch(F){console.warn("[GanttBoard] Error loading filter state from localStorage:",F);}return "all"}),Oe=S??At,pt=C??Ge,[le,fe]=useState(()=>{if(!h)return false;try{let F=typeof h=="string"?h:"gantt-filter-state",R=localStorage.getItem(F);if(R){let G=JSON.parse(R);if(typeof G.hideCompleted=="boolean")return G.hideCompleted}}catch(F){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",F);}return false});useEffect(()=>{let F=ft();if(F)try{let R={taskFilter:Oe,hideCompleted:le};localStorage.setItem(F,JSON.stringify(R));}catch(R){console.warn("[GanttBoard] Error saving filter state to localStorage:",R);}},[Oe,le,ft]);let P=useRef(v);useEffect(()=>{if(P.current!==v&&v!==void 0){Ge("all"),fe(false);let F=ft();if(F)try{localStorage.removeItem(F);}catch(R){console.warn("[GanttBoard] Error clearing filter state from localStorage:",R);}}P.current=v;},[v,ft]);let[K,q]=useState(0),[ce,Se]=useState(false),[Xe,_e]=useState(null),[Be,M]=useState({isOpen:false,x:0,y:0,task:null}),[J,ye]=useState(null),[Ie,$e]=useState(null);useEffect(()=>{Ft&&Ft!==Te&&rt(Ft);},[Ft]),useEffect(()=>{s&&s!==Te&&rt(s);},[s]);let B=useCallback(F=>{rt(F),me?.(F);},[me]),{state:z,setState:ne,undo:D,redo:Q,canUndo:Ce,canRedo:Ee,clearHistory:yt}=im(t,50),st=useMemo(()=>{let F=(R,G=0)=>{let Z=G;for(let xe of R)xe.subtasks?.length&&(Z=Math.max(Z,F(xe.subtasks,G+1)));return Z};return F(z)+1},[z]),ta=useCallback(()=>b?typeof b=="string"?b:"gantt-expanded-tasks":null,[b]),oa=useRef(new Map),va=useRef(false);if(!va.current&&b){va.current=true;let F=typeof b=="string"?b:"gantt-expanded-tasks";try{let R=localStorage.getItem(F);if(R){let G=JSON.parse(R);Array.isArray(G)&&(oa.current=new Map(G));}}catch(R){console.warn("[GanttBoard] Error loading expanded state from localStorage:",R);}}let Ut=useCallback(()=>{let F=ta();if(F)try{let R=Array.from(oa.current.entries());localStorage.setItem(F,JSON.stringify(R));}catch(R){console.warn("[GanttBoard] Error saving expanded state to localStorage:",R);}},[ta]),pa=useRef(0),Mn=useRef(z);useEffect(()=>{Mn.current=z;},[z]);let Ko=useRef(false),Mc=useCallback(F=>{ke(F),pa.current+=1,ne(R=>{let G=(xe,Pe=0)=>xe.map(wt=>{let ot=F==="all"||Pe<F-1;return wt.subtasks?.length&&oa.current.set(wt.id,ot),{...wt,isExpanded:ot,subtasks:wt.subtasks?G(wt.subtasks,Pe+1):void 0}}),Z=G(R);return Ut(),Z});},[ne,Ut]);useEffect(()=>{if(pa.current>0){pa.current-=1;return}let F=G=>{let Z=new Map;for(let xe of G){let Pe=xe.id;Z.get(Pe)||Z.set(Pe,xe);}return Array.from(Z.values())},R=G=>G.map(Z=>{let xe=oa.current.get(Z.id),Pe=xe!==void 0?{...Z,isExpanded:xe}:Z;if(Pe.subtasks?.length){let wt=F(Pe.subtasks);return {...Pe,subtasks:R(wt)}}return Pe});if(oa.current.size>0)ne(yr(R(t)));else {let G=Z=>Z.map(xe=>xe.subtasks?.length?{...xe,subtasks:F(G(xe.subtasks))}:xe);ne(yr(G(t)));}},[t,ne]);let xs=useRef(t),Pc=useRef(true);useEffect(()=>{if(Pc.current){Pc.current=false,xs.current=z;return}if(Ko.current){Ko.current=false,xs.current=z;return}if(!r)return;let F=JSON.stringify(xs.current),R=JSON.stringify(z);F!==R&&(xs.current=z,r(z));},[z,r]);let Ka=useMemo(()=>ld(y,w),[y,w]),G0=useCallback(F=>[{id:"name",label:F.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:F.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:F.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:F.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:F.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:F.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:F.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:F.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[Yo,Ji]=useState(()=>G0(Ka));useEffect(()=>{Ji(F=>F.map(R=>({...R,label:Ka.columns[R.id==="name"?"taskName":R.id]||R.label})));},[Ka]);let vs=useMemo(()=>Yo.filter(R=>R.visible).reduce((R,G)=>R+G.width,0),[Yo]),Ac=useRef(Yo.filter(F=>F.visible).map(F=>F.id).join(","));useEffect(()=>{let F=Yo.filter(Z=>Z.visible),R=F.map(Z=>Z.id).join(","),G=Ac.current;if(R!==G){let Z=F.some(Pe=>Pe.id!=="name"),xe=G.includes(",");Z?!xe&&Z&&_e(null):_e(null),Ac.current=R;}},[Yo]);let Lc=60,Ic=.6,_0=useMemo(()=>{let R=vs+Lc,G=typeof window<"u"?window.innerWidth*Ic:800,Z=Math.max(R,G);return Xe!==null?Math.max(200,Math.min(Xe,Z)):Math.max(200,R)},[Xe,vs]),ro=useRef(null),ws=useRef(null),Br=useRef(null),Pn=useRef(null),aa=useMemo(()=>Mp(Te),[Te]),j0=useMemo(()=>({theme:aa,themeName:Te}),[aa,Te]),Bc=useMemo(()=>dm(m),[m]),Qi=useMemo(()=>{if(!g)return z;let F=Ae.calculateCriticalPathFull(z),R=G=>G.map(Z=>{let xe=F.get(Z.id),Pe=Z.subtasks?R(Z.subtasks):void 0,wt=Pe?.some(ma=>ma.isCriticalPath||ma.subtasks&&ma.subtasks.some($t=>$t.isCriticalPath))||false,ot=xe?xe.isCritical:wt;return {...Z,isCriticalPath:ot,cpmData:xe||void 0,subtasks:Pe}});return R(z)},[z,g]),K0=useMemo(()=>Ae.flattenTasks(z).some(R=>R.dependencies&&R.dependencies.length>0),[z]),Rc=useMemo(()=>{if(Oe==="all"&&!le)return Qi;let F=R=>{let G=[];for(let Z of R){let xe=Z.subtasks?.length?F(Z.subtasks):void 0,Pe=false;if(le)Pe=Z.progress<100;else switch(Oe){case "all":Pe=true;break;case "incomplete":Pe=Z.progress<100;break;case "in_progress":Pe=Z.progress>0&&Z.progress<100;break;case "completed":Pe=Z.progress===100;break}(Pe||xe&&xe.length>0)&&G.push({...Z,subtasks:xe});}return G};return F(Qi)},[Qi,Oe,le]),ks=Ov(H);lm({undo:D,redo:Q,canUndo:Ce,canRedo:Ee,enabled:true}),useImperativeHandle(o,()=>({getTask:F=>Ae.findTaskById(z,F),addTask:(F,R)=>{ne(G=>{if(!R)return [...G,{...F,level:0}];let Z=xe=>xe.map(Pe=>Pe.id===R?{...Pe,subtasks:[...Pe.subtasks||[],{...F,parentId:R,level:(Pe.level||0)+1}],isExpanded:true}:Pe.subtasks?{...Pe,subtasks:Z(Pe.subtasks)}:Pe);return Z(G)});},updateTask:(F,R)=>{ne(G=>{let Z=xe=>xe.map(Pe=>Pe.id===F?{...Pe,...R}:Pe.subtasks?{...Pe,subtasks:Z(Pe.subtasks)}:Pe);return Z(G)});},deleteTask:F=>{ne(R=>{let G=Z=>Z.filter(xe=>xe.id===F?false:(xe.subtasks&&(xe.subtasks=G(xe.subtasks)),true));return G(R)});},deleteTasks:F=>{ne(R=>fd(R,F));},duplicateTask:F=>{if(a.onTaskDuplicate){let R=Ae.findTaskById(z,F);R&&a.onTaskDuplicate(R);}else ne(R=>Xn(R,[F]).tasks);},splitTask:(F,R,G=3)=>{ne(Z=>Ae.splitTask(Z,F,R,G));},calculateEndDate:Ae.calculateEndDate,calculateDuration:Ae.calculateDuration,validateDependency:(F,R)=>!Ae.validateDependencies(z,F,R),getAllTasks:()=>Ae.flattenTasks(z),getTasksByStatus:F=>Ae.flattenTasks(z).filter(R=>R.status===F),getTasksByParent:F=>F?Ae.findTaskById(z,F)?.subtasks||[]:z.filter(G=>!G.parentId),getCriticalPath:()=>Ae.flattenTasks(z).filter(F=>F.isCriticalPath),indentTask:F=>{ne(R=>yr(pd(R,[F])));},outdentTask:F=>{ne(R=>yr(md(R,[F])));},moveTask:(F,R)=>{ne(G=>gd(G,[F],R));},createSubtask:async F=>{let{tasks:R,newTask:G}=yd(z,F);if(we){let Z=we({...G,parentId:F});if((Z instanceof Promise?await Z:Z)===false)return}ne(yr(R)),Re&&Re({...G,parentId:F});},scrollToTask:F=>{let G=Ae.flattenTasks(z).findIndex(Z=>Z.id===F);if(G!==-1&&ro.current){let Z=G*ks;ro.current.scrollTo({top:Z,behavior:"smooth"}),Br.current&&Br.current.scrollTo({top:Z,behavior:"smooth"});}},highlightTask:(F,R=2e3)=>{},expandTask:F=>{ne(R=>{let G=Z=>Z.map(xe=>xe.id===F?{...xe,isExpanded:true}:xe.subtasks?{...xe,subtasks:G(xe.subtasks)}:xe);return G(R)});},collapseTask:F=>{ne(R=>{let G=Z=>Z.map(xe=>xe.id===F?{...xe,isExpanded:false}:xe.subtasks?{...xe,subtasks:G(xe.subtasks)}:xe);return G(R)});},expandAll:()=>{ne(F=>{let R=G=>G.map(Z=>({...Z,isExpanded:true,subtasks:Z.subtasks?R(Z.subtasks):void 0}));return R(F)});},collapseAll:()=>{ne(F=>{let R=G=>G.map(Z=>({...Z,isExpanded:false,subtasks:Z.subtasks?R(Z.subtasks):void 0}));return R(F)});},collapseToLevel:F=>{Mc(F);},undo:D,redo:Q,canUndo:()=>Ce,canRedo:()=>Ee,clearHistory:yt,exportToPNG:async()=>{if(!Pn.current||!ro.current||!Br.current)throw new Error("Gantt container not found");let F=Pn.current,R=ro.current,G=ws.current||R.querySelector(".gantt-grid-scroll"),Z=Br.current,xe=G?.scrollTop||0,Pe=Z.scrollTop,wt=F.style.overflow,ot=F.style.height,ma=R.style.overflow;try{let $t=G?.querySelector(".gantt-taskgrid-content"),Qt=Z.querySelector("svg"),ja=$t?.scrollHeight||G?.scrollHeight||600,dr=Qt?.getBoundingClientRect().height||Z.scrollHeight,So=(F.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(ja,dr)+20;G&&(G.scrollTop=0),Z.scrollTop=0,F.style.overflow="visible",F.style.height=`${So}px`,R.style.overflow="visible",await new Promise(Zo=>setTimeout(Zo,100));let Rr=await toPng(F,{backgroundColor:aa.bgPrimary,pixelRatio:2,filter:Zo=>{if(!(Zo instanceof Element))return !0;let Cs=window.getComputedStyle(Zo),Ln=parseInt(Cs.zIndex,10);return (isNaN(Ln)||Ln<50)&&Cs.position!=="fixed"}});return await(await fetch(Rr)).blob()}finally{F.style.overflow=wt,F.style.height=ot,R.style.overflow=ma,G&&(G.scrollTop=xe),Z.scrollTop=Pe;}},exportToPDF:async F=>{await Ae.exportToPDF(z,F);},exportToExcel:async F=>{await Ae.exportToExcel(z,F);},exportToJSON:()=>Ae.exportToJSON(z),exportToCSV:()=>Ae.exportToCSV(z),importFromJSON:F=>{let R=Ae.importFromJSON(F);ne(R);},getTasks:()=>z,refresh:()=>{ne(F=>[...F]);},clearAll:()=>{ne([]);}}),[z,D,Q,Ce,Ee,yt,aa,ks]);let Y0=useCallback(F=>{Ji(R=>R.map(G=>G.id===F?{...G,visible:!G.visible}:G));},[]),q0=useCallback((F,R)=>{Ji(G=>G.map(Z=>{if(Z.id!==F)return Z;let xe=Z.minWidth??100,Pe=Z.maxWidth??800,wt=Math.max(xe,Math.min(Pe,R));return {...Z,width:wt}}));},[]),X0=useCallback(F=>{ne(R=>{let G=hd(R,F),Z=xe=>{for(let Pe of xe){if(Pe.id===F){oa.current.set(F,Pe.isExpanded??true);return}Pe.subtasks?.length&&Z(Pe.subtasks);}};return Z(G),Ut(),G}),a.onTaskToggleExpand?.(F);},[a,Ut]),qo=useCallback((F,R)=>{if(Ue&&Ue(F,R)===false)return;let Z=Ae.findTaskById(z,F)?.progress,xe=wt=>wt.map(ot=>ot.id===F?{...ot,...R}:ot.subtasks?{...ot,subtasks:xe(ot.subtasks)}:ot);ne(xe(z));let Pe=Ae.findTaskById(xe(z),F);Pe&&(ze?.(Pe),Qe?.(Pe),R.progress!==void 0&&Z!==void 0&&R.progress!==Z&&j?.(F,Z,R.progress));},[z,ze,Ue,Qe,j]),J0=useCallback(F=>{F.length!==0&&(pa.current+=1,Ko.current=true,ne(R=>yr(pd(R,F))),a.onTaskIndent?.(F[0]));},[a]),Q0=useCallback(F=>{F.length!==0&&(pa.current+=1,Ko.current=true,ne(R=>yr(md(R,F))),a.onTaskOutdent?.(F[0]));},[a]),Z0=useCallback((F,R,G)=>{pa.current+=1,Ko.current=true,ne(Z=>yr(Yp(Z,F,R,G))),a.onTaskReparent?.(F,R,G);},[a]),ef=useCallback((F,R)=>{F.length!==0&&(pa.current+=1,Ko.current=true,ne(G=>gd(G,F,R)),a.onTaskMove?.(F[0],R));},[a]),Zi=useCallback(async F=>{let R=[];for(let G of F)ae&&await Promise.resolve(ae(G))===false||R.push(G);R.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(R):(ne(G=>yr(fd(G,R))),R.forEach(G=>a.onTaskDelete?.(G))),tt&&R.forEach(G=>tt(G)));},[a,ae,tt]),tf=useCallback(F=>{a.onTaskDuplicate?F.forEach(R=>{let G=Ae.findTaskById(z,R);G&&a.onTaskDuplicate(G);}):ne(R=>Xn(R,F).tasks);},[a,z]),af=useCallback((F,R)=>{ne(G=>{let{tasks:Z,newTask:xe}=Kp(G,F,R);return we&&we(xe)===false?G:(a.onTaskCreate?.(xe.parentId,xe.position||0),Re?.(xe),Z)});},[a,we,Re]),rf=useCallback((F,R)=>{ne(G=>bd(G,F,R)),a.onTaskRename?.(F,R);},[a]),el=useCallback(F=>{let{onTaskAddSubtask:R}=a;if(R){let G=ii(z,F);if(G){R(G);return}}ne(G=>{let{tasks:Z}=yd(G,F);return a.onTaskCreate?.(F,0),Z});},[a,z]),of=useCallback((F,R,G)=>{let Z=!F.startDate&&!F.endDate,xe=F.startDate?Math.round((R.getTime()-F.startDate.getTime())/(1e3*60*60*24)):0,Pe=$t=>$t.map(Qt=>Qt.id===F.id?{...Qt,startDate:R,endDate:G,...F.segments&&{segments:F.segments}}:Qt.subtasks?{...Qt,subtasks:Pe(Qt.subtasks)}:Qt),wt=Pe(z),ot=wt;wt=Ae.autoScheduleDependents(wt,F.id,xe),wt=yr(wt),ne(wt);let ma={...F,startDate:R,endDate:G};if(Z&&a?.onTaskDateChange?a.onTaskDateChange(F,R,G):ze?.(ma),O&&xe!==0){let $t=Ae.flattenTasks(ot),Qt=Ae.flattenTasks(wt),ja=[];for(let dr of Qt){if(dr.id===F.id)continue;let oo=$t.find(Rr=>Rr.id===dr.id);if(!oo)continue;let Qo=dr.startDate?.getTime()!==oo.startDate?.getTime(),So=dr.endDate?.getTime()!==oo.endDate?.getTime();(Qo||So)&&ja.push(dr);}ja.length>0&&O(ja);}},[z,ze,O,a]),nf=useCallback((F,R)=>{ee?.(F,R),M({isOpen:true,x:R.clientX,y:R.clientY,task:F});},[ee]),sf=useCallback((F,R)=>{let G=Ae.splitTask(z,F.id,R);ne(G),M({isOpen:false,x:0,y:0,task:null});},[z]),Oc=useCallback(F=>{let R=Ae.findTaskById(z,F.id)||F;X?.(R),he||ye(R);},[z,X,he]),$c=useCallback((F,R,G)=>{let Z=new Map,xe=$t=>{$t.forEach(Qt=>{Qt.dependencies&&Z.set(Qt.id,Qt.dependencies),Qt.subtasks&&xe(Qt.subtasks);});};xe(G);let Pe=Z.get(R)||[];Z.set(R,[...Pe,F]);let wt=new Set,ot=new Set,ma=$t=>{if(!wt.has($t)){wt.add($t),ot.add($t);let Qt=Z.get($t)||[];for(let ja of Qt){if(!wt.has(ja)&&ma(ja))return true;if(ot.has(ja))return true}}return ot.delete($t),false};return ma(R)},[]),Hc=useCallback((F,R)=>{if($c(F.id,R,Mn.current)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
367
367
|
|
|
368
|
-
Task dependencies must flow in one direction only.`);return}let G=Q=>Q.map(xe=>{if(xe.id===R){let Me=xe.dependencies||[];if(!Me.includes(F.id))return {...xe,dependencies:[...Me,F.id]}}return xe.subtasks?{...xe,subtasks:G(xe.subtasks)}:xe});ua.current+=1,ne(Q=>G(Q)),ee?.(F.id,R);},[ee,Oc]),Hc=useCallback((F,R)=>{let G=Q=>Q.map(xe=>{if(xe.id===F&&xe.dependencies){let Me=xe.dependencies.filter(xt=>xt!==R);return {...xe,dependencies:Me}}return xe.subtasks?{...xe,subtasks:G(xe.subtasks)}:xe});ua.current+=1,ne(Q=>G(Q)),Ee?.(F,R);},[Ee]),{startDate:Xo,endDate:el}=useMemo(()=>{let F=z.filter(Me=>Me.startDate&&Me.endDate);if(F.length===0){let Me=new Date,xt=new Date(Me);xt.setDate(xt.getDate()-30);let ot=new Date(Me);return ot.setDate(ot.getDate()+60),{startDate:xt,endDate:ot}}let R=F.flatMap(Me=>[Me.startDate,Me.endDate]).filter(Me=>Me!==void 0),G=new Date(Math.min(...R.map(Me=>Me.getTime()))),Q=new Date(Math.max(...R.map(Me=>Me.getTime()))),xe=it==="day"?7:it==="week"?14:30;return G.setDate(G.getDate()-xe),Q.setDate(Q.getDate()+xe),{startDate:G,endDate:Q}},[z,it]);useEffect(()=>{yt.current?.(Xo,el);},[Xo,el]);let sf=useCallback(async()=>{if(!Pn.current||!ro.current||!Br.current)return;await new Promise(So=>setTimeout(So,200));let F=Pn.current,R=ro.current,G=vs.current||R.querySelector(".gantt-grid-scroll"),Q=Br.current,xe=G?.scrollTop||0,Me=G?.scrollLeft||0,xt=Q.scrollTop,ot=Q.scrollLeft,pa=F.style.overflow,$t=F.style.height,Jt=G?.style.overflow||"",_a=Q.style.overflow,lr=R.style.overflow,oo=F.style.width,Qo=Q.style.width;try{let So=G?.querySelector(".gantt-taskgrid-content"),Rr=Q.querySelector("svg"),al=Rr?.getAttribute("height")?parseInt(Rr.getAttribute("height"),10):Rr?.getBoundingClientRect().height||0,Zo=So?.scrollHeight||G?.scrollHeight||600,ks=Math.max(al,Q.scrollHeight),Ln=Rr?.getAttribute("width")?parseInt(Rr.getAttribute("width"),10):Rr?.getBoundingClientRect().width||Q.scrollWidth,ff=F.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,rl=Math.max(Zo,ks,al),Wc=ff+rl+50,Vc=(G?.offsetWidth||R.offsetWidth||300)+Ln+10;G&&(G.scrollTop=0,G.scrollLeft=0),Q.scrollTop=0,Q.scrollLeft=0,F.style.overflow="visible",F.style.height=`${Wc}px`,F.style.width=`${Vc}px`,R.style.overflow="visible",G&&(G.style.overflow="visible",G.style.height=`${rl+50}px`),Q.style.overflow="visible",Q.style.height=`${rl+50}px`,Q.style.width=`${Ln+10}px`,await new Promise(Cs=>setTimeout(Cs,150));let bf=await toPng(F,{backgroundColor:ea.bgPrimary,pixelRatio:2,width:Vc,height:Wc,skipFonts:!1,filter:Cs=>{if(!(Cs instanceof Element))return !0;let Gc=window.getComputedStyle(Cs),_c=parseInt(Gc.zIndex,10);return !(!isNaN(_c)&&_c>=50||Gc.position==="fixed")}}),ol=document.createElement("a");ol.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,ol.href=bf,ol.click();}finally{F.style.overflow=pa,F.style.height=$t,F.style.width=oo,R.style.overflow=lr,G&&(G.style.overflow=Jt,G.style.height="",G.scrollTop=xe,G.scrollLeft=Me),Q.style.overflow=_a,Q.style.height="",Q.style.width=Qo,Q.scrollTop=xt,Q.scrollLeft=ot;}},[ea]),lf=useCallback(async()=>{await Pe.exportToPDF(z);},[z]),df=useCallback(async()=>{let F=new Date,R=xe=>String(xe).padStart(2,"0"),G=`${F.getFullYear()}-${R(F.getMonth()+1)}-${R(F.getDate())}_${R(F.getHours())}${R(F.getMinutes())}`,Q=p?p.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await Pe.exportToExcel(z,`${Q}_${G}.xlsx`);},[z,p]),cf=useCallback(()=>{let F=Pe.exportToCSV(z),R=new Blob([F],{type:"text/csv;charset=utf-8;"}),G=document.createElement("a");G.href=URL.createObjectURL(R),G.download="gantt-chart.csv",G.click(),URL.revokeObjectURL(G.href);},[z]),uf=useCallback(()=>{let F=Pe.exportToJSON(z),R=new Blob([F],{type:"application/json;charset=utf-8;"}),G=document.createElement("a");G.href=URL.createObjectURL(R),G.download="gantt-chart.json",G.click(),URL.revokeObjectURL(G.href);},[z]),pf=useCallback(()=>{Pe.exportToMSProject(z,"Gantt Project","project.xml");},[z]),mf=F=>{F.preventDefault(),Se(true);},Jo=useRef(false),[tl,zc]=useState(false),An=useRef({x:0,y:0,scrollLeft:0,scrollTop:0});useEffect(()=>{let F=Br.current,R=ro.current?.querySelector(".gantt-grid-scroll");if(!F||!R)return;let G=()=>{if(Jo.current)return;Jo.current=true;let ot=F.scrollTop;q(ot),R.scrollTop=ot,requestAnimationFrame(()=>{Jo.current=false;});},Q=()=>{if(Jo.current)return;Jo.current=true;let ot=R.scrollTop;q(ot),F.scrollTop=ot,requestAnimationFrame(()=>{Jo.current=false;});},xe=ot=>{if(ce&&R){let $t=R.parentElement?.getBoundingClientRect()?.left||0,Jt=ot.clientX-$t,_a=200,lr=xs+Ac,oo=window.innerWidth*Lc,Qo=Math.max(lr,oo);Jt>=_a&&Jt<=Qo&&_e(Jt);}if(tl&&F){let pa=ot.clientX-An.current.x,$t=ot.clientY-An.current.y;F.scrollLeft=An.current.scrollLeft-pa,F.scrollTop=An.current.scrollTop-$t;}},Me=()=>{Se(false),zc(false);},xt=ot=>{if(ot.button!==0)return;let pa=ot.target;pa.closest("[data-task-bar]")||pa.closest("[data-dependency-line]")||pa.closest("button")||pa.closest('[role="button"]')||pa.tagName==="rect"&&pa.getAttribute("data-clickable")==="true"||(zc(true),An.current={x:ot.clientX,y:ot.clientY,scrollLeft:F.scrollLeft,scrollTop:F.scrollTop},ot.preventDefault());};return F.addEventListener("scroll",G),R.addEventListener("scroll",Q),F.addEventListener("mousedown",xt),document.addEventListener("mousemove",xe),document.addEventListener("mouseup",Me),()=>{F.removeEventListener("scroll",G),R.removeEventListener("scroll",Q),F.removeEventListener("mousedown",xt),document.removeEventListener("mousemove",xe),document.removeEventListener("mouseup",Me);}},[ce,tl,xs]);let Uc=useRef(false),gf=useRef(null);return useLayoutEffect(()=>{if(Uc.current||z.length===0||!Br.current)return;Uc.current=true,gf.current=Xo;let F=Br.current,R=new Date,G=it==="day"?60:it==="week"?20:8,Q=(R.getTime()-Xo.getTime())/(1e3*60*60*24),xe=F.clientWidth,xt=Q*G*N-xe/2;Q>=0&&xe>0&&(F.scrollLeft=Math.max(0,xt));},[z.length,Xo,it,N]),jsx(mn.Provider,{value:ja,children:jsx(dl.Provider,{value:_0,children:jsxs("div",{ref:Pn,className:"flex flex-col h-full w-full",style:{backgroundColor:ea.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...ea.dotGrid&&{backgroundImage:`radial-gradient(circle, ${ea.dotGrid} 1px, transparent 1px)`,backgroundSize:"24px 24px"},...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsx("div",{style:{position:"relative",zIndex:100},children:jsx(oi,{theme:ea,timeScale:it,onTimeScaleChange:Ze,zoom:N,onZoomChange:Y,currentTheme:Ce,onThemeChange:B,rowDensity:H,onRowDensityChange:de,showThemeSelector:c,showCreateTaskButton:x&&pe?.canCreateTask!==false&&!pe?.canCreateSubtaskOnly,createTaskLabel:C,onCreateTask:k,taskFilter:Re,onTaskFilterChange:ut,hideCompleted:le,onHideCompletedChange:fe,toolbarRightContent:I,wbsLevel:ie,onWbsLevelChange:Fc,maxWbsDepth:Nt,viewMode:Ve,onViewModeChange:De,projectForecast:E,onExportPNG:l?sf:void 0,onExportPDF:l?lf:void 0,onExportExcel:l?df:void 0,onExportCSV:l?cf:void 0,onExportJSON:l?uf:void 0,onExportMSProject:l?pf:void 0,showCriticalPath:Ne,onShowCriticalPathChange:At,showDependencies:bt,onShowDependenciesChange:Mt,highlightWeekends:nt,onHighlightWeekendsChange:mt,showBaseline:Ue,onShowBaselineChange:F=>{F&&Ve!=="oracle"&&De("oracle"),!F&&Ve==="oracle"&&De("execution");},onCopySnapshotLink:at,hasDependencies:j0})}),jsxs("div",{ref:ro,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsx("div",{ref:vs,className:"gantt-grid-scroll flex-shrink-0",style:{width:G0,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsx(li,{tasks:Bc,theme:ea,rowHeight:ws,availableUsers:d,templates:Ic,showCriticalPath:Ne,onTaskClick:L,onTaskDblClick:Rc,onTaskContextMenu:Z,onTaskToggle:q0,scrollTop:K,columns:Yo,onToggleColumn:K0,onColumnResize:Y0,onTaskUpdate:qo,onTaskIndent:X0,onTaskOutdent:J0,onTaskMove:Z0,onMultiTaskDelete:Qi,onTaskDuplicate:ef,onTaskCreate:tf,onTaskRename:af,onCreateSubtask:Zi,onOpenTaskModal:L?F=>L(F):void 0,onDeleteRequest:(F,R)=>Oe({taskId:F,taskName:R}),onTaskReparent:Q0,scrollContainerRef:vs})}),jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:ea.border,zIndex:15},onMouseDown:mf}),jsx("div",{ref:Br,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:tl?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsx(yi,{tasks:Bc,theme:ea,rowHeight:ws,timeScale:it,startDate:Xo,endDate:el,zoom:N,locale:y,templates:Ic,dependencyLineStyle:a?.dependencyLineStyle,showTaskBarLabels:a?.showTaskBarLabels!==false,onTaskClick:L,onTaskDblClick:Rc,onTaskContextMenu:of,onTaskDateChange:rf,onDependencyCreate:$c,onDependencyDelete:Hc,showBaseline:Ue,showCriticalPath:Ne,showDependencies:bt,highlightWeekends:nt,canEditTask:pe?.canEditTask})})]}),Ie.task&&jsx(bn,{isOpen:Ie.isOpen,x:Ie.x,y:Ie.y,theme:ea,onClose:()=>M({isOpen:false,x:0,y:0,task:null}),items:(()=>{let F=Ie.task;if(!F)return [];let R=Pe.findTaskById(z,F.id)||F,G=R.subtasks&&R.subtasks.length>0,Q=pe?.canCreateTask!==false,xe=pe?.canDeleteTask!==false;if(G){let $t=[],Jt=pe?.canDuplicateTask!==false;return Q&&$t.push({id:"addSubtask",label:ja.contextMenu?.addSubtask||"Add Subtask",icon:qt.Add,onClick:()=>{je?je(R):Zi(R.id);}}),Jt&&$t.push({id:"duplicate",label:ja.contextMenu?.duplicateTask||"Duplicate Task",icon:qt.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(R):ne(_a=>Xn(_a,[R.id]).tasks),M({isOpen:false,x:0,y:0,task:null});}}),xe&&($t.length>0&&$t.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),$t.push({id:"delete",label:ja.contextMenu?.deleteTask||"Delete Task",icon:qt.Delete,onClick:()=>{Oe({taskId:R.id,taskName:R.name});}})),$t}let Me=pe?.canUpdateTask!==false,xt=pe?.canDuplicateTask!==false,ot=[];return Me&&ot.push({id:"edit",label:ja.contextMenu?.editTask||"Edit Task",icon:qt.Pencil,onClick:()=>{he?he(R):ye(R);}}),Q&&ot.push({id:"addSubtask",label:ja.contextMenu?.addSubtask||"Add Subtask",icon:qt.Add,onClick:()=>{je?je(R):Zi(R.id);}}),ot.length>0&&Me&&ot.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),Me&&(ot.push({id:"markIncomplete",label:ja.contextMenu?.markIncomplete||"Mark Incomplete",icon:qt.MarkIncomplete,onClick:()=>{U?U(R):qo(R.id,{status:"todo",progress:0});},disabled:R.status==="todo"}),ot.push({id:"setInProgress",label:ja.contextMenu?.setInProgress||"Set In Progress",icon:qt.SetInProgress,onClick:()=>{re?re(R):qo(R.id,{status:"in-progress"});},disabled:R.status==="in-progress"}),ot.push({id:"markComplete",label:ja.contextMenu?.markComplete||"Mark Complete",icon:qt.MarkComplete,onClick:()=>{qo(R.id,{status:"completed",progress:100});},disabled:R.status==="completed"})),(xt||Me&&R.startDate&&R.endDate)&&ot.length>0&&ot.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),xt&&ot.push({id:"duplicate",label:ja.contextMenu?.duplicateTask||"Duplicate Task",icon:qt.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(R):ne($t=>Xn($t,[R.id]).tasks),M({isOpen:false,x:0,y:0,task:null});}}),Me&&R.startDate&&R.endDate&&ot.push({id:"split",label:ja.contextMenu?.splitTask||"Split Task",icon:qt.Split,onClick:()=>{let $t=R.startDate.getTime(),Jt=R.endDate.getTime(),_a=$t+(Jt-$t)/2,lr=new Date(_a);nf(R,lr);}}),xe&&(ot.length>0&&ot.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),ot.push({id:"delete",label:ja.contextMenu?.deleteTask||"Delete Task",icon:qt.Delete,onClick:()=>{Oe({taskId:R.id,taskName:R.name});}})),ot})()}),jsx(qr,{task:J,isOpen:!!J,onClose:()=>ye(null),onTaskUpdate:F=>{J&&(qo(J.id,F),ye(null));},theme:Ce==="light"?"light":"dark",locale:y==="es"?"es":"en",availableUsers:d,availableTasks:t}),jsx(AnimatePresence,{children:Le&&jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[10000] flex items-center justify-center p-4",style:{backgroundColor:"rgba(0, 0, 0, 0.6)"},onClick:()=>Oe(null),children:jsxs(motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:F=>F.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:ea.bgSecondary,border:`1px solid ${ea.border}`},children:[jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${ea.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:ea.textPrimary,fontFamily:"Inter, sans-serif"},children:[ja.contextMenu?.deleteTask||"Delete Task","?"]}),jsx("p",{className:"text-sm mt-1",style:{color:ea.textSecondary,fontFamily:"Inter, sans-serif"},children:y==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsx("div",{className:"px-6 py-4",children:jsxs("p",{className:"text-sm leading-relaxed",style:{color:ea.textSecondary,fontFamily:"Inter, sans-serif"},children:[y==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxs("span",{className:"font-semibold",style:{color:ea.textPrimary},children:['"',Le.taskName,'"']}),"."]})}),jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:ea.bgPrimary,borderTop:`1px solid ${ea.border}`},children:[jsx("button",{onClick:()=>Oe(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:ea.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:F=>{F.currentTarget.style.backgroundColor=ea.hoverBg;},onMouseLeave:F=>{F.currentTarget.style.backgroundColor="transparent";},children:y==="es"?"Cancelar":"Cancel"}),jsxs("button",{onClick:()=>{Qi([Le.taskId]),Oe(null);},className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:"#EF4444",fontFamily:"Inter, sans-serif"},onMouseEnter:F=>{F.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:F=>{F.currentTarget.style.backgroundColor="#EF4444";},children:[jsx(Trash2,{className:"w-4 h-4"}),y==="es"?"Eliminar":"Delete"]})]})]})})}),f?.enabled&&jsx(wi,{tasks:z,theme:ea,config:f,onTasksUpdate:ne,onTaskUpdate:qo,onTaskCreate:F=>{ne(R=>[...R,F]);},onTaskDelete:F=>{Qi([F]);},onDependencyCreate:(F,R)=>{let G=Pe.findTaskById(z,F);G&&$c(G,R);},onDependencyDelete:Hc})]})})})});function Kv(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function Yv(e){if(!e||e.trim()==="")return null;let t=e.trim().toLowerCase(),a=t.match(/(\d+)h\s*(\d+)m/);if(a&&a[1]&&a[2]){let i=parseInt(a[1],10),c=parseInt(a[2],10);return i*60+c}let r=t.match(/(\d+)h/);if(r&&r[1])return parseInt(r[1],10)*60;let o=t.match(/(\d+)m/);if(o&&o[1])return parseInt(o[1],10);let s=t.match(/(\d+)d/);if(s&&s[1])return parseInt(s[1],10)*480;let n=t.match(/^(\d+)$/);return n&&n[1]?parseInt(n[1],10)*60:null}var vd=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],wd=[{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:i=a?"edit":"create",theme:c="dark",customStatuses:l=[],availableTags:p=[],onCreateTag:d,attachments:m=[],onUploadAttachments:g,onDeleteAttachment:b,defaultStatus:h}){let v=[...vd,...l.filter(N=>!vd.some(Y=>Y.id===N.id))],f=dt[c]||dt.dark,[y,w]=useState(false),[x,C]=useState(false),[k,D]=useState(false),[T,I]=useState(false),[$,A]=useState({top:0,left:0}),[_,E]=useState(null),[me,L]=useState(new Date),[X$1,Z]=useState({top:0,left:0}),[He,O]=useState(false),[j,he]=useState([]),[je,U]=useState(false),[re,ee]=useState(""),Ee=useRef(null),we=useRef(null),Be=useRef(null),ze=useRef(null),Qe=useRef(null),[te,tt]=useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],tags:[]}),[pe,at]=useState({});useEffect(()=>{a?(tt({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||"#2E94FF",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&O(true)):(tt({name:"",description:"",progress:0,status:h||"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),O(false),he([]));},[a,e,h]),useEffect(()=>{let N=Y=>{Ee.current&&!Ee.current.contains(Y.target)&&w(false),we.current&&!we.current.contains(Y.target)&&C(false),Be.current&&!Be.current.contains(Y.target)&&D(false),ze.current&&!ze.current.contains(Y.target)&&I(false);};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[]);let pt=()=>{let N={};return te.name.trim()||(N.name="El nombre es requerido"),te.startDate&&te.endDate&&te.startDate>te.endDate&&(N.endDate="La fecha de fin debe ser posterior a la de inicio"),at(N),Object.keys(N).length===0},Et=async N=>{if(N.preventDefault(),!!pt())try{let Y=i==="create"&&j.length>0?{...te,pendingFiles:j}:te;await s(Y),he([]),t();}catch(Y){console.error("Error submitting task:",Y);}},Ce=(N,Y)=>{tt(ie=>{let ke={...ie,[N]:Y};if(N==="status"){let V=Y;V==="todo"?ke.progress=0:V==="in-progress"?(ie.progress===0||ie.progress===100)&&(ke.progress=50):V==="completed"||V==="closed"?ke.progress=100:(V==="in-review"||V==="review")&&(ke.progress=75);}if(N==="progress"){let V=typeof Y=="number"?Y:parseInt(Y,10);V===100&&ie.status!=="completed"?ke.status="completed":V>0&&V<100&&ie.status==="todo"?ke.status="in-progress":V===0&&ie.status!=="todo"&&(ke.status="todo");}return ke}),pe[N]&&at(ie=>{let ke={...ie};return delete ke[N],ke});},rt=v.find(N=>N.id===te.status)??vd[0],it=wd.find(N=>N.id===te.priority)??wd[1],Ze=Lo.find(N=>N.value===te.color)??Lo[0],H=c==="dark",de={backgroundColor:H?"#141414":f.bgSecondary,border:`1px solid ${H?"#262626":f.borderLight}`,color:f.textPrimary};return jsx(AnimatePresence,{children:e&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-50",style:{backgroundColor:H?"rgba(0, 0, 0, 0.5)":"rgba(0, 0, 0, 0.3)",backdropFilter:"blur(4px)",WebkitBackdropFilter:"blur(4px)"},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 pointer-events-auto overflow-hidden","data-theme":c,style:{backgroundColor:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,WebkitBackdropFilter:H?"blur(16px)":void 0,border:`1px solid ${f.border}`,boxShadow:H?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 32px rgba(0, 0, 0, 0.12)"},onClick:N=>N.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${f.border}`,fontFamily:"Inter, sans-serif"},children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:rt.color||f.accent}}),jsx("span",{style:{fontSize:13,fontWeight:500,color:f.textSecondary},children:i==="create"?"Nueva tarea":"Editar tarea"})]}),jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:f.textTertiary},onMouseEnter:N=>{N.currentTarget.style.backgroundColor=f.hoverBg,N.currentTarget.style.color=f.textPrimary;},onMouseLeave:N=>{N.currentTarget.style.backgroundColor="transparent",N.currentTarget.style.color=f.textTertiary;},disabled:n,children:jsx(X,{className:"w-4 h-4"})})]}),jsxs("form",{onSubmit:Et,className:"max-h-[calc(100vh-200px)] overflow-y-auto",style:{fontFamily:"Inter, sans-serif"},children:[jsxs("div",{className:"p-5 space-y-4",children:[jsxs("div",{children:[jsx("input",{type:"text",value:te.name,onChange:N=>Ce("name",N.target.value),className:"w-full bg-transparent border-none focus:outline-none focus:ring-0",style:{color:f.textPrimary,fontSize:22,fontWeight:700,fontFamily:"Inter, sans-serif",opacity:te.name?1:void 0},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),pe.name&&jsxs("p",{className:"mt-1 text-xs text-red-400 flex items-center gap-1",children:[jsx(AlertCircle,{className:"w-3 h-3"}),pe.name]})]}),jsx("div",{children:jsx("textarea",{value:te.description||"",onChange:N=>Ce("description",N.target.value),className:"w-full bg-transparent border-none focus:outline-none focus:ring-0 resize-none",style:{color:f.textSecondary,fontSize:13,fontFamily:"Inter, sans-serif"},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})}),jsx("div",{style:{borderTop:`1px solid ${f.borderLight}`}}),jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxs("div",{ref:Ee,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&w(!y),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...de,borderColor:rt.color,backgroundColor:`${rt.color}15`},disabled:n,children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:rt.color}}),jsx("span",{style:{color:rt.color},children:rt.title}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:rt.color}})]}),jsx(AnimatePresence,{children:y&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg overflow-hidden",style:{backgroundColor:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:v.map(N=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:Y=>Y.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:Y=>Y.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ce("status",N.id),w(false);},children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:N.color}}),N.title,te.status===N.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},N.id))})})]}),jsxs("div",{ref:we,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:de,disabled:n,children:[jsx(Flag,{className:"w-3.5 h-3.5",style:{color:it.color}}),jsx("span",{children:it.label}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:f.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 overflow-hidden",style:{backgroundColor:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:wd.map(N=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:Y=>Y.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:Y=>Y.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ce("priority",N.id),C(false);},children:[jsx("span",{children:N.icon}),N.label,te.priority===N.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},N.id))})})]}),o.length>0&&jsxs("div",{ref:Be,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&D(!k),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:de,disabled:n,children:[te.assignees&&te.assignees.length>0?jsxs(Fragment,{children:[jsx("div",{className:"flex -space-x-1",children:te.assignees.slice(0,3).map((N,Y)=>jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:N.color||f.accent,borderColor:f.bgSecondary},children:N.initials},Y))}),te.assignees.length>3&&jsxs("span",{style:{color:f.textTertiary},children:["+",te.assignees.length-3]})]}):jsxs(Fragment,{children:[jsx(Users,{className:"w-3.5 h-3.5",style:{color:f.textTertiary}}),jsx("span",{style:{color:f.textTertiary},children:"Asignar"})]}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsx(AnimatePresence,{children:k&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg",style:{backgroundColor:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:o.map(N=>{let Y=te.assignees?.some(ie=>ie.name===N.name);return jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:ie=>ie.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:ie=>ie.currentTarget.style.backgroundColor="transparent",onClick:()=>{let ie=Y?(te.assignees||[]).filter(ke=>ke.name!==N.name):[...te.assignees||[],{name:N.name,avatar:N.avatar,initials:N.name.split(" ").map(ke=>ke[0]).join("").toUpperCase().slice(0,2),color:f.accent}];Ce("assignees",ie);},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:f.accent},children:N.name.charAt(0).toUpperCase()}),jsx("span",{className:"truncate flex-1 text-left",children:N.name}),jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:Y&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:f.accent}})})]},N.id)})})})]}),jsxs("div",{ref:ze,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>{if(!n)if(T)I(false);else {if(ze.current){let N=ze.current.getBoundingClientRect(),Y=window.innerHeight,ie=120,V=Y-N.bottom<ie?N.top-ie-8:N.bottom+8;A({top:V,left:N.left});}I(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:de,disabled:n,children:[jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:te.color}}),jsx("span",{children:Ze.name}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsx(AnimatePresence,{children:T&&jsxs(Ht,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>I(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${$.top}px`,left:`${$.left}px`,zIndex:99999,backgroundColor:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:N=>N.stopPropagation(),children:jsx("div",{style:{padding:"6px 8px"},children:jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:Lo.slice(0,18).map(N=>{let Y=te.color===N.value;return jsx("button",{type:"button",onClick:ie=>{ie.preventDefault(),ie.stopPropagation(),Ce("color",N.value),I(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:N.name,children:jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:N.value,outline:Y?`2px solid ${N.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},N.value)})})})})]})})]}),p.length>0||d?jsx(lo,{selectedTags:te.tags||[],availableTags:p,onChange:N=>Ce("tags",N),onCreateTag:d,theme:f,disabled:n}):null]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Calendar,{className:"w-4 h-4",style:{color:f.textTertiary}}),jsxs("div",{ref:Qe,className:"flex items-center gap-2 flex-1 relative",children:[jsx("button",{type:"button",onClick:()=>{if(!n&&!te.isMilestone)if(_==="start")E(null);else {if(Qe.current){let N=Qe.current.getBoundingClientRect(),Y=window.innerHeight,ie=320,V=Y-N.bottom<ie?N.top-ie-8:N.bottom+8;Z({top:V,left:N.left});}E("start"),L(te.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...de,opacity:te.isMilestone?.5:1,cursor:te.isMilestone?"not-allowed":"pointer"},disabled:n||te.isMilestone,children:te.startDate?te.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsx("span",{style:{color:f.textTertiary},children:"\u2192"}),jsx("button",{type:"button",onClick:()=>{if(!n&&!te.isMilestone)if(_==="end")E(null);else {if(Qe.current){let N=Qe.current.getBoundingClientRect(),Y=window.innerHeight,ie=320,V=Y-N.bottom<ie?N.top-ie-8:N.bottom+8;Z({top:V,left:N.left});}E("end"),L(te.endDate||te.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...de,opacity:te.isMilestone?.5:1,cursor:te.isMilestone?"not-allowed":"pointer"},disabled:n||te.isMilestone,children:te.endDate?te.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsx(AnimatePresence,{children:_&&jsxs(Ht,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>E(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:`${X$1.top}px`,left:`${X$1.left}px`,zIndex:99999,backgroundColor:H?"#0a0a0a":f.bgPrimary,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 24px rgba(0, 0, 0, 0.12)"},onClick:N=>N.stopPropagation(),children:[jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${H?"#262626":f.border}`},children:[(()=>{let N=new Date,Y=new Date(N);Y.setDate(N.getDate()+1);let ie=new Date(N);ie.setDate(N.getDate()+7);let ke=new Date(N);return ke.setDate(N.getDate()+14),[{label:"Hoy",date:N},{label:"Ma\xF1ana",date:Y},{label:"Pr\xF3xima semana",date:ie},{label:"2 semanas",date:ke}].map((ae,Ve)=>jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:f.textPrimary},onMouseEnter:De=>De.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:De=>De.currentTarget.style.backgroundColor="transparent",onClick:()=>{_==="start"?(Ce("startDate",ae.date),(!te.endDate||ae.date>te.endDate)&&Ce("endDate",ae.date),E("end")):(Ce("endDate",ae.date),(!te.startDate||ae.date<te.startDate)&&Ce("startDate",ae.date),E(null));},children:ae.label},Ve))})(),jsx("div",{style:{borderTop:`1px solid ${f.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:N=>N.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:N=>N.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ce("startDate",void 0),Ce("endDate",void 0),E(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:()=>L(new Date(me.getFullYear(),me.getMonth()-1)),className:"p-1 rounded",onMouseEnter:N=>N.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:N=>N.currentTarget.style.backgroundColor="transparent",children:jsx(ChevronLeft,{className:"w-4 h-4",style:{color:f.textSecondary}})}),jsx("span",{className:"text-sm font-medium",style:{color:f.textPrimary,fontFamily:"JetBrains Mono, monospace"},children:me.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>L(new Date(me.getFullYear(),me.getMonth()+1)),className:"p-1 rounded",onMouseEnter:N=>N.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:N=>N.currentTarget.style.backgroundColor="transparent",children:jsx(ChevronRight,{className:"w-4 h-4",style:{color:f.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((N,Y)=>jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:f.textTertiary},children:N},Y))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let N=me.getFullYear(),Y=me.getMonth(),ie=new Date(N,Y,1).getDay(),ke=new Date(N,Y+1,0).getDate(),V=new Date,ae=[];for(let De=ie-1;De>=0;De--)ae.push({day:new Date(N,Y,-De).getDate(),date:new Date(N,Y-1,new Date(N,Y,-De).getDate()),isCurrentMonth:false});for(let De=1;De<=ke;De++)ae.push({day:De,date:new Date(N,Y,De),isCurrentMonth:true});let Ve=42-ae.length;for(let De=1;De<=Ve;De++)ae.push({day:De,date:new Date(N,Y+1,De),isCurrentMonth:false});return ae.map((De,Ue)=>{let Ne=De.date.toDateString()===V.toDateString(),Ke=te.startDate?.toDateString()===De.date.toDateString(),bt=te.endDate?.toDateString()===De.date.toDateString(),lt=te.startDate&&te.endDate&&De.date>=te.startDate&&De.date<=te.endDate;return jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:De.isCurrentMonth?Ke||bt?"#FFF":f.textPrimary:f.textTertiary,backgroundColor:Ke?f.accent:bt?"#7C3AED":lt?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Ne&&!Ke&&!bt?`inset 0 0 0 1px ${f.accent}`:"none"},onClick:()=>{_==="start"?(Ce("startDate",De.date),te.endDate&&De.date>te.endDate&&Ce("endDate",De.date),E("end")):(Ce("endDate",De.date),te.startDate&&De.date<te.startDate&&Ce("startDate",De.date),E(null));},children:De.day},Ue)})})()})]})]})]})})]}),pe.endDate&&jsx("span",{className:"text-xs text-red-400",children:pe.endDate})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:"w-4 h-4",style:{color:f.textTertiary}}),jsxs("div",{className:"flex items-center gap-3 flex-1",children:[jsx("input",{type:"range",min:"0",max:"100",step:"5",value:te.progress,onChange:N=>Ce("progress",parseInt(N.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:f.bgSecondary,accentColor:te.progress<30?"#EF4444":te.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:`${te.progress<30?"#EF4444":te.progress<70?"#F59E0B":"#10B981"}20`,color:te.progress<30?"#EF4444":te.progress<70?"#F59E0B":"#10B981",fontFamily:"JetBrains Mono, monospace"},children:[te.progress,"%"]})]})]}),jsxs("div",{children:[jsxs("button",{type:"button",onClick:()=>O(!He),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:f.textTertiary},children:[jsx(ChevronDown,{className:`w-3 h-3 transition-transform ${He?"rotate-180":""}`}),"Opciones avanzadas"]}),jsx(AnimatePresence,{children:He&&jsx(motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxs("div",{className:"pt-3 space-y-3",children:[jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:f.textTertiary},children:[jsx("path",{d:"M12 6v6l4 2"}),jsx("circle",{cx:"12",cy:"12",r:"10"})]}),jsx("span",{className:"text-xs",style:{color:f.textTertiary},children:"Duraci\xF3n estimada"})]}),jsx("input",{type:"text",placeholder:"ej: 8 (=8h), 2h 30m, 1d",value:te.effortMinutes?Kv(te.effortMinutes):"",onChange:N=>{let Y=Yv(N.target.value);Ce("effortMinutes",Y);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`}}),jsx("p",{className:"text-xs mt-1",style:{color:f.textTertiary},children:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)"})]}),(g||m.length>0||i==="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:f.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:f.textTertiary},children:["Adjuntos ",i==="create"?j.length>0&&`(${j.length})`:m.length>0&&`(${m.length})`]})]}),i==="create"?jsx(Ur,{cardId:"pending",attachments:j.map((N,Y)=>({id:`pending-${Y}`,cardId:"pending",name:N.name,size:N.size,type:N.type,url:URL.createObjectURL(N),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:N=>he(Y=>[...Y,...N]),onDelete:N=>{let Y=parseInt(N.replace("pending-",""),10);he(ie=>ie.filter((ke,V)=>V!==Y));},maxSizeMB:10,maxFiles:20}):jsx(Ur,{cardId:a?.id||"new",attachments:m,onUpload:g&&a?.id?N=>g(a.id,N):void 0,onDelete:b,maxSizeMB:10,maxFiles:20}),i==="create"&&j.length>0&&jsxs("p",{className:"text-xs mt-1",style:{color:f.textTertiary},children:[j.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors",onMouseEnter:N=>N.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:N=>N.currentTarget.style.backgroundColor="transparent",children:[jsx("input",{type:"checkbox",checked:te.isMilestone,onChange:N=>Ce("isMilestone",N.target.checked),className:"w-4 h-4 rounded",style:{accentColor:f.accent},disabled:n}),jsx(Milestone,{className:"w-4 h-4 text-yellow-500"}),jsx("span",{className:"text-sm",style:{color:f.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxs("div",{className:"relative",children:[jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:f.textTertiary},children:[jsx(Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),te.dependencies&&te.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:te.dependencies.map(N=>{let Y=r.find(ie=>ie.id===N);return jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${f.accent}20`,color:f.accent},children:[Y?.name||N.slice(0,8),jsx("button",{type:"button",onClick:()=>{let ie=(te.dependencies||[]).filter(ke=>ke!==N);Ce("dependencies",ie);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:n,children:jsx(X,{className:"w-3 h-3"})})]},N)})}),jsxs("button",{type:"button",onClick:()=>{U(!je),ee("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textSecondary},disabled:n,children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:"Agregar dependencia"})]}),jsx(AnimatePresence,{children:je&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{U(false),ee("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 rounded-lg overflow-hidden min-w-[280px] max-h-[280px]",style:{backgroundColor:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:[jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${f.border}`},children:jsx("input",{type:"text",value:re,onChange:N=>ee(N.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:f.bgSecondary,color:f.textPrimary},autoFocus:true})}),jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(N=>N.id!==a?.id).filter(N=>re===""||N.name.toLowerCase().includes(re.toLowerCase())).map(N=>{let Y=te.dependencies?.includes(N.id);return jsxs("button",{type:"button",onClick:()=>{let ie=te.dependencies||[],ke;Y?ke=ie.filter(V=>V!==N.id):ke=[...ie,N.id],Ce("dependencies",ke);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:Y?`${f.accent}10`:"transparent"},onMouseEnter:ie=>{Y||(ie.currentTarget.style.backgroundColor=f.hoverBg);},onMouseLeave:ie=>{ie.currentTarget.style.backgroundColor=Y?`${f.accent}10`:"transparent";},children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:Y?f.accent:"transparent",borderColor:Y?f.accent:f.borderLight},children:Y&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:"block truncate",style:{color:f.textPrimary},children:N.name}),jsx("span",{className:"text-[10px]",style:{color:f.textTertiary},children:N.id.slice(0,8)})]})]},N.id)}),r.filter(N=>N.id!==a?.id).length===0&&jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:f.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${f.border}`,fontFamily:"Inter, sans-serif"},children:[jsx("button",{type:"button",onClick:t,className:"px-4 py-2 rounded-lg transition-colors",style:{color:f.textSecondary,fontSize:13},onMouseEnter:N=>N.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:N=>N.currentTarget.style.backgroundColor="transparent",disabled:n,children:"Cancelar"}),jsx("button",{type:"submit",disabled:n,className:"px-4 py-2 font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:f.accent,color:"#FFF",fontSize:13},onMouseEnter:N=>!n&&(N.currentTarget.style.opacity="0.9"),onMouseLeave:N=>!n&&(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:i==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var bm=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
|
|
368
|
+
Task dependencies must flow in one direction only.`);return}let G=Z=>Z.map(xe=>{if(xe.id===R){let Pe=xe.dependencies||[];if(!Pe.includes(F.id))return {...xe,dependencies:[...Pe,F.id]}}return xe.subtasks?{...xe,subtasks:G(xe.subtasks)}:xe});pa.current+=1,ne(Z=>G(Z)),te?.(F.id,R);},[te,$c]),zc=useCallback((F,R)=>{let G=Z=>Z.map(xe=>{if(xe.id===F&&xe.dependencies){let Pe=xe.dependencies.filter(wt=>wt!==R);return {...xe,dependencies:Pe}}return xe.subtasks?{...xe,subtasks:G(xe.subtasks)}:xe});pa.current+=1,ne(Z=>G(Z)),Fe?.(F,R);},[Fe]),{startDate:Xo,endDate:tl}=useMemo(()=>{let F=z.filter(Pe=>Pe.startDate&&Pe.endDate);if(F.length===0){let Pe=new Date,wt=new Date(Pe);wt.setDate(wt.getDate()-30);let ot=new Date(Pe);return ot.setDate(ot.getDate()+60),{startDate:wt,endDate:ot}}let R=F.flatMap(Pe=>[Pe.startDate,Pe.endDate]).filter(Pe=>Pe!==void 0),G=new Date(Math.min(...R.map(Pe=>Pe.getTime()))),Z=new Date(Math.max(...R.map(Pe=>Pe.getTime()))),xe=lt==="day"?7:lt==="week"?14:30;return G.setDate(G.getDate()-xe),Z.setDate(Z.getDate()+xe),{startDate:G,endDate:Z}},[z,lt]);useEffect(()=>{vt.current?.(Xo,tl);},[Xo,tl]);let lf=useCallback(async()=>{if(!Pn.current||!ro.current||!Br.current)return;await new Promise(So=>setTimeout(So,200));let F=Pn.current,R=ro.current,G=ws.current||R.querySelector(".gantt-grid-scroll"),Z=Br.current,xe=G?.scrollTop||0,Pe=G?.scrollLeft||0,wt=Z.scrollTop,ot=Z.scrollLeft,ma=F.style.overflow,$t=F.style.height,Qt=G?.style.overflow||"",ja=Z.style.overflow,dr=R.style.overflow,oo=F.style.width,Qo=Z.style.width;try{let So=G?.querySelector(".gantt-taskgrid-content"),Rr=Z.querySelector("svg"),rl=Rr?.getAttribute("height")?parseInt(Rr.getAttribute("height"),10):Rr?.getBoundingClientRect().height||0,Zo=So?.scrollHeight||G?.scrollHeight||600,Cs=Math.max(rl,Z.scrollHeight),Ln=Rr?.getAttribute("width")?parseInt(Rr.getAttribute("width"),10):Rr?.getBoundingClientRect().width||Z.scrollWidth,bf=F.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,ol=Math.max(Zo,Cs,rl),Vc=bf+ol+50,Gc=(G?.offsetWidth||R.offsetWidth||300)+Ln+10;G&&(G.scrollTop=0,G.scrollLeft=0),Z.scrollTop=0,Z.scrollLeft=0,F.style.overflow="visible",F.style.height=`${Vc}px`,F.style.width=`${Gc}px`,R.style.overflow="visible",G&&(G.style.overflow="visible",G.style.height=`${ol+50}px`),Z.style.overflow="visible",Z.style.height=`${ol+50}px`,Z.style.width=`${Ln+10}px`,await new Promise(Ts=>setTimeout(Ts,150));let hf=await toPng(F,{backgroundColor:aa.bgPrimary,pixelRatio:2,width:Gc,height:Vc,skipFonts:!1,filter:Ts=>{if(!(Ts instanceof Element))return !0;let _c=window.getComputedStyle(Ts),jc=parseInt(_c.zIndex,10);return !(!isNaN(jc)&&jc>=50||_c.position==="fixed")}}),nl=document.createElement("a");nl.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,nl.href=hf,nl.click();}finally{F.style.overflow=ma,F.style.height=$t,F.style.width=oo,R.style.overflow=dr,G&&(G.style.overflow=Qt,G.style.height="",G.scrollTop=xe,G.scrollLeft=Pe),Z.style.overflow=ja,Z.style.height="",Z.style.width=Qo,Z.scrollTop=wt,Z.scrollLeft=ot;}},[aa]),df=useCallback(async()=>{await Ae.exportToPDF(z);},[z]),cf=useCallback(async()=>{let F=new Date,R=xe=>String(xe).padStart(2,"0"),G=`${F.getFullYear()}-${R(F.getMonth()+1)}-${R(F.getDate())}_${R(F.getHours())}${R(F.getMinutes())}`,Z=p?p.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await Ae.exportToExcel(z,`${Z}_${G}.xlsx`);},[z,p]),uf=useCallback(()=>{let F=Ae.exportToCSV(z),R=new Blob([F],{type:"text/csv;charset=utf-8;"}),G=document.createElement("a");G.href=URL.createObjectURL(R),G.download="gantt-chart.csv",G.click(),URL.revokeObjectURL(G.href);},[z]),pf=useCallback(()=>{let F=Ae.exportToJSON(z),R=new Blob([F],{type:"application/json;charset=utf-8;"}),G=document.createElement("a");G.href=URL.createObjectURL(R),G.download="gantt-chart.json",G.click(),URL.revokeObjectURL(G.href);},[z]),mf=useCallback(()=>{Ae.exportToMSProject(z,"Gantt Project","project.xml");},[z]),gf=F=>{F.preventDefault(),Se(true);},Jo=useRef(false),[al,Uc]=useState(false),An=useRef({x:0,y:0,scrollLeft:0,scrollTop:0});useEffect(()=>{let F=Br.current,R=ro.current?.querySelector(".gantt-grid-scroll");if(!F||!R)return;let G=()=>{if(Jo.current)return;Jo.current=true;let ot=F.scrollTop;q(ot),R.scrollTop=ot,requestAnimationFrame(()=>{Jo.current=false;});},Z=()=>{if(Jo.current)return;Jo.current=true;let ot=R.scrollTop;q(ot),F.scrollTop=ot,requestAnimationFrame(()=>{Jo.current=false;});},xe=ot=>{if(ce&&R){let $t=R.parentElement?.getBoundingClientRect()?.left||0,Qt=ot.clientX-$t,ja=200,dr=vs+Lc,oo=window.innerWidth*Ic,Qo=Math.max(dr,oo);Qt>=ja&&Qt<=Qo&&_e(Qt);}if(al&&F){let ma=ot.clientX-An.current.x,$t=ot.clientY-An.current.y;F.scrollLeft=An.current.scrollLeft-ma,F.scrollTop=An.current.scrollTop-$t;}},Pe=()=>{Se(false),Uc(false);},wt=ot=>{if(ot.button!==0)return;let ma=ot.target;ma.closest("[data-task-bar]")||ma.closest("[data-dependency-line]")||ma.closest("button")||ma.closest('[role="button"]')||ma.tagName==="rect"&&ma.getAttribute("data-clickable")==="true"||(Uc(true),An.current={x:ot.clientX,y:ot.clientY,scrollLeft:F.scrollLeft,scrollTop:F.scrollTop},ot.preventDefault());};return F.addEventListener("scroll",G),R.addEventListener("scroll",Z),F.addEventListener("mousedown",wt),document.addEventListener("mousemove",xe),document.addEventListener("mouseup",Pe),()=>{F.removeEventListener("scroll",G),R.removeEventListener("scroll",Z),F.removeEventListener("mousedown",wt),document.removeEventListener("mousemove",xe),document.removeEventListener("mouseup",Pe);}},[ce,al,vs]);let Wc=useRef(false),ff=useRef(null);return useLayoutEffect(()=>{if(Wc.current||z.length===0||!Br.current)return;Wc.current=true,ff.current=Xo;let F=Br.current,R=new Date,G=lt==="day"?60:lt==="week"?20:8,Z=(R.getTime()-Xo.getTime())/(1e3*60*60*24),xe=F.clientWidth,wt=Z*G*N-xe/2;Z>=0&&xe>0&&(F.scrollLeft=Math.max(0,wt));},[z.length,Xo,lt,N]),jsx(mn.Provider,{value:Ka,children:jsx(cl.Provider,{value:j0,children:jsxs("div",{ref:Pn,className:"flex flex-col h-full w-full",style:{backgroundColor:aa.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...aa.dotGrid&&{backgroundImage:`radial-gradient(circle, ${aa.dotGrid} 1px, transparent 1px)`,backgroundSize:"24px 24px"},...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsx("div",{style:{position:"relative",zIndex:100},children:jsx(ni,{theme:aa,timeScale:lt,onTimeScaleChange:Ze,zoom:N,onZoomChange:Y,currentTheme:Te,onThemeChange:B,rowDensity:H,onRowDensityChange:de,showThemeSelector:c,showCreateTaskButton:x&&pe?.canCreateTask!==false&&!pe?.canCreateSubtaskOnly,createTaskLabel:T,onCreateTask:k,taskFilter:Oe,onTaskFilterChange:pt,hideCompleted:le,onHideCompletedChange:fe,toolbarRightContent:I,wbsLevel:ie,onWbsLevelChange:Mc,maxWbsDepth:st,viewMode:Ve,onViewModeChange:De,projectForecast:E,onExportPNG:l?lf:void 0,onExportPDF:l?df:void 0,onExportExcel:l?cf:void 0,onExportCSV:l?uf:void 0,onExportJSON:l?pf:void 0,onExportMSProject:l?mf:void 0,showCriticalPath:Ne,onShowCriticalPathChange:Lt,showDependencies:ht,onShowDependenciesChange:Pt,highlightWeekends:nt,onHighlightWeekendsChange:gt,showBaseline:We,onShowBaselineChange:F=>{F&&Ve!=="oracle"&&De("oracle"),!F&&Ve==="oracle"&&De("execution");},onCopySnapshotLink:at,hasDependencies:K0})}),jsxs("div",{ref:ro,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsx("div",{ref:ws,className:"gantt-grid-scroll flex-shrink-0",style:{width:_0,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsx(di,{tasks:Rc,theme:aa,rowHeight:ks,availableUsers:d,templates:Bc,showCriticalPath:Ne,onTaskClick:L,onTaskDblClick:Oc,onTaskContextMenu:ee,onTaskToggle:X0,scrollTop:K,columns:Yo,onToggleColumn:Y0,onColumnResize:q0,onTaskUpdate:qo,onTaskIndent:J0,onTaskOutdent:Q0,onTaskMove:ef,onMultiTaskDelete:Zi,onTaskDuplicate:tf,onTaskCreate:af,onTaskRename:rf,onCreateSubtask:el,onOpenTaskModal:L?F=>L(F):void 0,onDeleteRequest:(F,R)=>$e({taskId:F,taskName:R}),onTaskReparent:Z0,scrollContainerRef:ws})}),jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:aa.border,zIndex:15},onMouseDown:gf}),jsx("div",{ref:Br,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:al?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsx(xi,{tasks:Rc,theme:aa,rowHeight:ks,timeScale:lt,startDate:Xo,endDate:tl,zoom:N,locale:y,templates:Bc,dependencyLineStyle:a?.dependencyLineStyle,showTaskBarLabels:a?.showTaskBarLabels!==false,onTaskClick:L,onTaskDblClick:Oc,onTaskContextMenu:nf,onTaskDateChange:of,onDependencyCreate:Hc,onDependencyDelete:zc,showBaseline:We,showCriticalPath:Ne,showDependencies:ht,highlightWeekends:nt,canEditTask:pe?.canEditTask})})]}),Be.task&&jsx(bn,{isOpen:Be.isOpen,x:Be.x,y:Be.y,theme:aa,onClose:()=>M({isOpen:false,x:0,y:0,task:null}),items:(()=>{let F=Be.task;if(!F)return [];let R=Ae.findTaskById(z,F.id)||F,G=R.subtasks&&R.subtasks.length>0,Z=pe?.canCreateTask!==false,xe=pe?.canDeleteTask!==false;if(G){let $t=[],Qt=pe?.canDuplicateTask!==false;return Z&&$t.push({id:"addSubtask",label:Ka.contextMenu?.addSubtask||"Add Subtask",icon:Xt.Add,onClick:()=>{je?je(R):el(R.id);}}),Qt&&$t.push({id:"duplicate",label:Ka.contextMenu?.duplicateTask||"Duplicate Task",icon:Xt.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(R):ne(ja=>Xn(ja,[R.id]).tasks),M({isOpen:false,x:0,y:0,task:null});}}),xe&&($t.length>0&&$t.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),$t.push({id:"delete",label:Ka.contextMenu?.deleteTask||"Delete Task",icon:Xt.Delete,onClick:()=>{$e({taskId:R.id,taskName:R.name});}})),$t}let Pe=pe?.canUpdateTask!==false,wt=pe?.canDuplicateTask!==false,ot=[];return Pe&&ot.push({id:"edit",label:Ka.contextMenu?.editTask||"Edit Task",icon:Xt.Pencil,onClick:()=>{he?he(R):ye(R);}}),Z&&ot.push({id:"addSubtask",label:Ka.contextMenu?.addSubtask||"Add Subtask",icon:Xt.Add,onClick:()=>{je?je(R):el(R.id);}}),ot.length>0&&Pe&&ot.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),Pe&&(ot.push({id:"markIncomplete",label:Ka.contextMenu?.markIncomplete||"Mark Incomplete",icon:Xt.MarkIncomplete,onClick:()=>{U?U(R):qo(R.id,{status:"todo",progress:0});},disabled:R.status==="todo"}),ot.push({id:"setInProgress",label:Ka.contextMenu?.setInProgress||"Set In Progress",icon:Xt.SetInProgress,onClick:()=>{oe?oe(R):qo(R.id,{status:"in-progress"});},disabled:R.status==="in-progress"}),ot.push({id:"markComplete",label:Ka.contextMenu?.markComplete||"Mark Complete",icon:Xt.MarkComplete,onClick:()=>{qo(R.id,{status:"completed",progress:100});},disabled:R.status==="completed"})),(wt||Pe&&R.startDate&&R.endDate)&&ot.length>0&&ot.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),wt&&ot.push({id:"duplicate",label:Ka.contextMenu?.duplicateTask||"Duplicate Task",icon:Xt.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(R):ne($t=>Xn($t,[R.id]).tasks),M({isOpen:false,x:0,y:0,task:null});}}),Pe&&R.startDate&&R.endDate&&ot.push({id:"split",label:Ka.contextMenu?.splitTask||"Split Task",icon:Xt.Split,onClick:()=>{let $t=R.startDate.getTime(),Qt=R.endDate.getTime(),ja=$t+(Qt-$t)/2,dr=new Date(ja);sf(R,dr);}}),xe&&(ot.length>0&&ot.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),ot.push({id:"delete",label:Ka.contextMenu?.deleteTask||"Delete Task",icon:Xt.Delete,onClick:()=>{$e({taskId:R.id,taskName:R.name});}})),ot})()}),jsx(qr,{task:J,isOpen:!!J,onClose:()=>ye(null),onTaskUpdate:F=>{J&&(qo(J.id,F),ye(null));},theme:Te==="light"?"light":"dark",locale:y==="es"?"es":"en",availableUsers:d,availableTasks:t}),jsx(AnimatePresence,{children:Ie&&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:()=>$e(null),children:jsxs(motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:F=>F.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:aa.bgSecondary,border:`1px solid ${aa.border}`},children:[jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${aa.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:aa.textPrimary,fontFamily:"Inter, sans-serif"},children:[Ka.contextMenu?.deleteTask||"Delete Task","?"]}),jsx("p",{className:"text-sm mt-1",style:{color:aa.textSecondary,fontFamily:"Inter, sans-serif"},children:y==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsx("div",{className:"px-6 py-4",children:jsxs("p",{className:"text-sm leading-relaxed",style:{color:aa.textSecondary,fontFamily:"Inter, sans-serif"},children:[y==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxs("span",{className:"font-semibold",style:{color:aa.textPrimary},children:['"',Ie.taskName,'"']}),"."]})}),jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:aa.bgPrimary,borderTop:`1px solid ${aa.border}`},children:[jsx("button",{onClick:()=>$e(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:aa.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:F=>{F.currentTarget.style.backgroundColor=aa.hoverBg;},onMouseLeave:F=>{F.currentTarget.style.backgroundColor="transparent";},children:y==="es"?"Cancelar":"Cancel"}),jsxs("button",{onClick:()=>{Zi([Ie.taskId]),$e(null);},className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:"#EF4444",fontFamily:"Inter, sans-serif"},onMouseEnter:F=>{F.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:F=>{F.currentTarget.style.backgroundColor="#EF4444";},children:[jsx(Trash2,{className:"w-4 h-4"}),y==="es"?"Eliminar":"Delete"]})]})]})})}),f?.enabled&&jsx(ki,{tasks:z,theme:aa,config:f,onTasksUpdate:ne,onTaskUpdate:qo,onTaskCreate:F=>{ne(R=>[...R,F]);},onTaskDelete:F=>{Zi([F]);},onDependencyCreate:(F,R)=>{let G=Ae.findTaskById(z,F);G&&Hc(G,R);},onDependencyDelete:zc})]})})})});function Yv(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function qv(e){if(!e||e.trim()==="")return null;let t=e.trim().toLowerCase(),a=t.match(/(\d+)h\s*(\d+)m/);if(a&&a[1]&&a[2]){let i=parseInt(a[1],10),c=parseInt(a[2],10);return i*60+c}let r=t.match(/(\d+)h/);if(r&&r[1])return parseInt(r[1],10)*60;let o=t.match(/(\d+)m/);if(o&&o[1])return parseInt(o[1],10);let s=t.match(/(\d+)d/);if(s&&s[1])return parseInt(s[1],10)*480;let n=t.match(/^(\d+)$/);return n&&n[1]?parseInt(n[1],10)*60:null}var wd=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],kd=[{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 bm({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:i=a?"edit":"create",theme:c="dark",customStatuses:l=[],availableTags:p=[],onCreateTag:d,attachments:m=[],onUploadAttachments:g,onDeleteAttachment:b,defaultStatus:h}){let v=[...wd,...l.filter(N=>!wd.some(Y=>Y.id===N.id))],f=ct[c]||ct.dark,[y,w]=useState(false),[x,T]=useState(false),[k,S]=useState(false),[C,I]=useState(false),[$,A]=useState({top:0,left:0}),[_,E]=useState(null),[me,L]=useState(new Date),[X$1,ee]=useState({top:0,left:0}),[ze,O]=useState(false),[j,he]=useState([]),[je,U]=useState(false),[oe,te]=useState(""),Fe=useRef(null),we=useRef(null),Re=useRef(null),Ue=useRef(null),Qe=useRef(null),[ae,tt]=useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],tags:[]}),[pe,at]=useState({});useEffect(()=>{a?(tt({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||"#2E94FF",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&O(true)):(tt({name:"",description:"",progress:0,status:h||"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),O(false),he([]));},[a,e,h]),useEffect(()=>{let N=Y=>{Fe.current&&!Fe.current.contains(Y.target)&&w(false),we.current&&!we.current.contains(Y.target)&&T(false),Re.current&&!Re.current.contains(Y.target)&&S(false),Ue.current&&!Ue.current.contains(Y.target)&&I(false);};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[]);let mt=()=>{let N={};return ae.name.trim()||(N.name="El nombre es requerido"),ae.startDate&&ae.endDate&&ae.startDate>ae.endDate&&(N.endDate="La fecha de fin debe ser posterior a la de inicio"),at(N),Object.keys(N).length===0},Ft=async N=>{if(N.preventDefault(),!!mt())try{let Y=i==="create"&&j.length>0?{...ae,pendingFiles:j}:ae;await s(Y),he([]),t();}catch(Y){console.error("Error submitting task:",Y);}},Te=(N,Y)=>{tt(ie=>{let ke={...ie,[N]:Y};if(N==="status"){let V=Y;V==="todo"?ke.progress=0:V==="in-progress"?(ie.progress===0||ie.progress===100)&&(ke.progress=50):V==="completed"||V==="closed"?ke.progress=100:(V==="in-review"||V==="review")&&(ke.progress=75);}if(N==="progress"){let V=typeof Y=="number"?Y:parseInt(Y,10);V===100&&ie.status!=="completed"?ke.status="completed":V>0&&V<100&&ie.status==="todo"?ke.status="in-progress":V===0&&ie.status!=="todo"&&(ke.status="todo");}return ke}),pe[N]&&at(ie=>{let ke={...ie};return delete ke[N],ke});},rt=v.find(N=>N.id===ae.status)??wd[0],lt=kd.find(N=>N.id===ae.priority)??kd[1],Ze=Lo.find(N=>N.value===ae.color)??Lo[0],H=c==="dark",de={backgroundColor:H?"#141414":f.bgSecondary,border:`1px solid ${H?"#262626":f.borderLight}`,color:f.textPrimary};return jsx(AnimatePresence,{children:e&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-50",style:{backgroundColor:H?"rgba(0, 0, 0, 0.5)":"rgba(0, 0, 0, 0.3)",backdropFilter:"blur(4px)",WebkitBackdropFilter:"blur(4px)"},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 pointer-events-auto overflow-hidden","data-theme":c,style:{backgroundColor:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,WebkitBackdropFilter:H?"blur(16px)":void 0,border:`1px solid ${f.border}`,boxShadow:H?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 32px rgba(0, 0, 0, 0.12)"},onClick:N=>N.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${f.border}`,fontFamily:"Inter, sans-serif"},children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:rt.color||f.accent}}),jsx("span",{style:{fontSize:13,fontWeight:500,color:f.textSecondary},children:i==="create"?"Nueva tarea":"Editar tarea"})]}),jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:f.textTertiary},onMouseEnter:N=>{N.currentTarget.style.backgroundColor=f.hoverBg,N.currentTarget.style.color=f.textPrimary;},onMouseLeave:N=>{N.currentTarget.style.backgroundColor="transparent",N.currentTarget.style.color=f.textTertiary;},disabled:n,children:jsx(X,{className:"w-4 h-4"})})]}),jsxs("form",{onSubmit:Ft,className:"max-h-[calc(100vh-200px)] overflow-y-auto",style:{fontFamily:"Inter, sans-serif"},children:[jsxs("div",{className:"p-5 space-y-4",children:[jsxs("div",{children:[jsx("input",{type:"text",value:ae.name,onChange:N=>Te("name",N.target.value),className:"w-full bg-transparent border-none focus:outline-none focus:ring-0",style:{color:f.textPrimary,fontSize:22,fontWeight:700,fontFamily:"Inter, sans-serif",opacity:ae.name?1:void 0},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),pe.name&&jsxs("p",{className:"mt-1 text-xs text-red-400 flex items-center gap-1",children:[jsx(AlertCircle,{className:"w-3 h-3"}),pe.name]})]}),jsx("div",{children:jsx("textarea",{value:ae.description||"",onChange:N=>Te("description",N.target.value),className:"w-full bg-transparent border-none focus:outline-none focus:ring-0 resize-none",style:{color:f.textSecondary,fontSize:13,fontFamily:"Inter, sans-serif"},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})}),jsx("div",{style:{borderTop:`1px solid ${f.borderLight}`}}),jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxs("div",{ref:Fe,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&w(!y),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...de,borderColor:rt.color,backgroundColor:`${rt.color}15`},disabled:n,children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:rt.color}}),jsx("span",{style:{color:rt.color},children:rt.title}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:rt.color}})]}),jsx(AnimatePresence,{children:y&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg overflow-hidden",style:{backgroundColor:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:v.map(N=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:Y=>Y.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:Y=>Y.currentTarget.style.backgroundColor="transparent",onClick:()=>{Te("status",N.id),w(false);},children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:N.color}}),N.title,ae.status===N.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},N.id))})})]}),jsxs("div",{ref:we,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&T(!x),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:de,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:f.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 overflow-hidden",style:{backgroundColor:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:kd.map(N=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:Y=>Y.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:Y=>Y.currentTarget.style.backgroundColor="transparent",onClick:()=>{Te("priority",N.id),T(false);},children:[jsx("span",{children:N.icon}),N.label,ae.priority===N.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},N.id))})})]}),o.length>0&&jsxs("div",{ref:Re,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&S(!k),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:de,disabled:n,children:[ae.assignees&&ae.assignees.length>0?jsxs(Fragment,{children:[jsx("div",{className:"flex -space-x-1",children:ae.assignees.slice(0,3).map((N,Y)=>jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:N.color||f.accent,borderColor:f.bgSecondary},children:N.initials},Y))}),ae.assignees.length>3&&jsxs("span",{style:{color:f.textTertiary},children:["+",ae.assignees.length-3]})]}):jsxs(Fragment,{children:[jsx(Users,{className:"w-3.5 h-3.5",style:{color:f.textTertiary}}),jsx("span",{style:{color:f.textTertiary},children:"Asignar"})]}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsx(AnimatePresence,{children:k&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg",style:{backgroundColor:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:o.map(N=>{let Y=ae.assignees?.some(ie=>ie.name===N.name);return jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:ie=>ie.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:ie=>ie.currentTarget.style.backgroundColor="transparent",onClick:()=>{let ie=Y?(ae.assignees||[]).filter(ke=>ke.name!==N.name):[...ae.assignees||[],{name:N.name,avatar:N.avatar,initials:N.name.split(" ").map(ke=>ke[0]).join("").toUpperCase().slice(0,2),color:f.accent}];Te("assignees",ie);},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:f.accent},children:N.name.charAt(0).toUpperCase()}),jsx("span",{className:"truncate flex-1 text-left",children:N.name}),jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:Y&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:f.accent}})})]},N.id)})})})]}),jsxs("div",{ref:Ue,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>{if(!n)if(C)I(false);else {if(Ue.current){let N=Ue.current.getBoundingClientRect(),Y=window.innerHeight,ie=120,V=Y-N.bottom<ie?N.top-ie-8:N.bottom+8;A({top:V,left:N.left});}I(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:de,disabled:n,children:[jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:ae.color}}),jsx("span",{children:Ze.name}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsx(AnimatePresence,{children:C&&jsxs(Ht,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>I(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${$.top}px`,left:`${$.left}px`,zIndex:99999,backgroundColor:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:N=>N.stopPropagation(),children:jsx("div",{style:{padding:"6px 8px"},children:jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:Lo.slice(0,18).map(N=>{let Y=ae.color===N.value;return jsx("button",{type:"button",onClick:ie=>{ie.preventDefault(),ie.stopPropagation(),Te("color",N.value),I(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:N.name,children:jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:N.value,outline:Y?`2px solid ${N.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},N.value)})})})})]})})]}),p.length>0||d?jsx(lo,{selectedTags:ae.tags||[],availableTags:p,onChange:N=>Te("tags",N),onCreateTag:d,theme:f,disabled:n}):null]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Calendar,{className:"w-4 h-4",style:{color:f.textTertiary}}),jsxs("div",{ref:Qe,className:"flex items-center gap-2 flex-1 relative",children:[jsx("button",{type:"button",onClick:()=>{if(!n&&!ae.isMilestone)if(_==="start")E(null);else {if(Qe.current){let N=Qe.current.getBoundingClientRect(),Y=window.innerHeight,ie=320,V=Y-N.bottom<ie?N.top-ie-8:N.bottom+8;ee({top:V,left:N.left});}E("start"),L(ae.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...de,opacity:ae.isMilestone?.5:1,cursor:ae.isMilestone?"not-allowed":"pointer"},disabled:n||ae.isMilestone,children:ae.startDate?ae.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsx("span",{style:{color:f.textTertiary},children:"\u2192"}),jsx("button",{type:"button",onClick:()=>{if(!n&&!ae.isMilestone)if(_==="end")E(null);else {if(Qe.current){let N=Qe.current.getBoundingClientRect(),Y=window.innerHeight,ie=320,V=Y-N.bottom<ie?N.top-ie-8:N.bottom+8;ee({top:V,left:N.left});}E("end"),L(ae.endDate||ae.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...de,opacity:ae.isMilestone?.5:1,cursor:ae.isMilestone?"not-allowed":"pointer"},disabled:n||ae.isMilestone,children:ae.endDate?ae.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsx(AnimatePresence,{children:_&&jsxs(Ht,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>E(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:`${X$1.top}px`,left:`${X$1.left}px`,zIndex:99999,backgroundColor:H?"#0a0a0a":f.bgPrimary,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 24px rgba(0, 0, 0, 0.12)"},onClick:N=>N.stopPropagation(),children:[jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${H?"#262626":f.border}`},children:[(()=>{let N=new Date,Y=new Date(N);Y.setDate(N.getDate()+1);let ie=new Date(N);ie.setDate(N.getDate()+7);let ke=new Date(N);return ke.setDate(N.getDate()+14),[{label:"Hoy",date:N},{label:"Ma\xF1ana",date:Y},{label:"Pr\xF3xima semana",date:ie},{label:"2 semanas",date:ke}].map((re,Ve)=>jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:f.textPrimary},onMouseEnter:De=>De.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:De=>De.currentTarget.style.backgroundColor="transparent",onClick:()=>{_==="start"?(Te("startDate",re.date),(!ae.endDate||re.date>ae.endDate)&&Te("endDate",re.date),E("end")):(Te("endDate",re.date),(!ae.startDate||re.date<ae.startDate)&&Te("startDate",re.date),E(null));},children:re.label},Ve))})(),jsx("div",{style:{borderTop:`1px solid ${f.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:N=>N.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:N=>N.currentTarget.style.backgroundColor="transparent",onClick:()=>{Te("startDate",void 0),Te("endDate",void 0),E(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:()=>L(new Date(me.getFullYear(),me.getMonth()-1)),className:"p-1 rounded",onMouseEnter:N=>N.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:N=>N.currentTarget.style.backgroundColor="transparent",children:jsx(ChevronLeft,{className:"w-4 h-4",style:{color:f.textSecondary}})}),jsx("span",{className:"text-sm font-medium",style:{color:f.textPrimary,fontFamily:"JetBrains Mono, monospace"},children:me.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>L(new Date(me.getFullYear(),me.getMonth()+1)),className:"p-1 rounded",onMouseEnter:N=>N.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:N=>N.currentTarget.style.backgroundColor="transparent",children:jsx(ChevronRight,{className:"w-4 h-4",style:{color:f.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((N,Y)=>jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:f.textTertiary},children:N},Y))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let N=me.getFullYear(),Y=me.getMonth(),ie=new Date(N,Y,1).getDay(),ke=new Date(N,Y+1,0).getDate(),V=new Date,re=[];for(let De=ie-1;De>=0;De--)re.push({day:new Date(N,Y,-De).getDate(),date:new Date(N,Y-1,new Date(N,Y,-De).getDate()),isCurrentMonth:false});for(let De=1;De<=ke;De++)re.push({day:De,date:new Date(N,Y,De),isCurrentMonth:true});let Ve=42-re.length;for(let De=1;De<=Ve;De++)re.push({day:De,date:new Date(N,Y+1,De),isCurrentMonth:false});return re.map((De,We)=>{let Ne=De.date.toDateString()===V.toDateString(),Ke=ae.startDate?.toDateString()===De.date.toDateString(),ht=ae.endDate?.toDateString()===De.date.toDateString(),dt=ae.startDate&&ae.endDate&&De.date>=ae.startDate&&De.date<=ae.endDate;return jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:De.isCurrentMonth?Ke||ht?"#FFF":f.textPrimary:f.textTertiary,backgroundColor:Ke?f.accent:ht?"#7C3AED":dt?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Ne&&!Ke&&!ht?`inset 0 0 0 1px ${f.accent}`:"none"},onClick:()=>{_==="start"?(Te("startDate",De.date),ae.endDate&&De.date>ae.endDate&&Te("endDate",De.date),E("end")):(Te("endDate",De.date),ae.startDate&&De.date<ae.startDate&&Te("startDate",De.date),E(null));},children:De.day},We)})})()})]})]})]})})]}),pe.endDate&&jsx("span",{className:"text-xs text-red-400",children:pe.endDate})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:"w-4 h-4",style:{color:f.textTertiary}}),jsxs("div",{className:"flex items-center gap-3 flex-1",children:[jsx("input",{type:"range",min:"0",max:"100",step:"5",value:ae.progress,onChange:N=>Te("progress",parseInt(N.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:f.bgSecondary,accentColor:ae.progress<30?"#EF4444":ae.progress<70?"#F59E0B":"#10B981"},disabled:n}),jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${ae.progress<30?"#EF4444":ae.progress<70?"#F59E0B":"#10B981"}20`,color:ae.progress<30?"#EF4444":ae.progress<70?"#F59E0B":"#10B981",fontFamily:"JetBrains Mono, monospace"},children:[ae.progress,"%"]})]})]}),jsxs("div",{children:[jsxs("button",{type:"button",onClick:()=>O(!ze),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:f.textTertiary},children:[jsx(ChevronDown,{className:`w-3 h-3 transition-transform ${ze?"rotate-180":""}`}),"Opciones avanzadas"]}),jsx(AnimatePresence,{children:ze&&jsx(motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxs("div",{className:"pt-3 space-y-3",children:[jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:f.textTertiary},children:[jsx("path",{d:"M12 6v6l4 2"}),jsx("circle",{cx:"12",cy:"12",r:"10"})]}),jsx("span",{className:"text-xs",style:{color:f.textTertiary},children:"Duraci\xF3n estimada"})]}),jsx("input",{type:"text",placeholder:"ej: 8 (=8h), 2h 30m, 1d",value:ae.effortMinutes?Yv(ae.effortMinutes):"",onChange:N=>{let Y=qv(N.target.value);Te("effortMinutes",Y);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`}}),jsx("p",{className:"text-xs mt-1",style:{color:f.textTertiary},children:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)"})]}),(g||m.length>0||i==="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:f.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:f.textTertiary},children:["Adjuntos ",i==="create"?j.length>0&&`(${j.length})`:m.length>0&&`(${m.length})`]})]}),i==="create"?jsx(Ur,{cardId:"pending",attachments:j.map((N,Y)=>({id:`pending-${Y}`,cardId:"pending",name:N.name,size:N.size,type:N.type,url:URL.createObjectURL(N),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:N=>he(Y=>[...Y,...N]),onDelete:N=>{let Y=parseInt(N.replace("pending-",""),10);he(ie=>ie.filter((ke,V)=>V!==Y));},maxSizeMB:10,maxFiles:20}):jsx(Ur,{cardId:a?.id||"new",attachments:m,onUpload:g&&a?.id?N=>g(a.id,N):void 0,onDelete:b,maxSizeMB:10,maxFiles:20}),i==="create"&&j.length>0&&jsxs("p",{className:"text-xs mt-1",style:{color:f.textTertiary},children:[j.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors",onMouseEnter:N=>N.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:N=>N.currentTarget.style.backgroundColor="transparent",children:[jsx("input",{type:"checkbox",checked:ae.isMilestone,onChange:N=>Te("isMilestone",N.target.checked),className:"w-4 h-4 rounded",style:{accentColor:f.accent},disabled:n}),jsx(Milestone,{className:"w-4 h-4 text-yellow-500"}),jsx("span",{className:"text-sm",style:{color:f.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxs("div",{className:"relative",children:[jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:f.textTertiary},children:[jsx(Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),ae.dependencies&&ae.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:ae.dependencies.map(N=>{let Y=r.find(ie=>ie.id===N);return jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${f.accent}20`,color:f.accent},children:[Y?.name||N.slice(0,8),jsx("button",{type:"button",onClick:()=>{let ie=(ae.dependencies||[]).filter(ke=>ke!==N);Te("dependencies",ie);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:n,children:jsx(X,{className:"w-3 h-3"})})]},N)})}),jsxs("button",{type:"button",onClick:()=>{U(!je),te("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textSecondary},disabled:n,children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:"Agregar dependencia"})]}),jsx(AnimatePresence,{children:je&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{U(false),te("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 rounded-lg overflow-hidden min-w-[280px] max-h-[280px]",style:{backgroundColor:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:[jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${f.border}`},children:jsx("input",{type:"text",value:oe,onChange:N=>te(N.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:f.bgSecondary,color:f.textPrimary},autoFocus:true})}),jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(N=>N.id!==a?.id).filter(N=>oe===""||N.name.toLowerCase().includes(oe.toLowerCase())).map(N=>{let Y=ae.dependencies?.includes(N.id);return jsxs("button",{type:"button",onClick:()=>{let ie=ae.dependencies||[],ke;Y?ke=ie.filter(V=>V!==N.id):ke=[...ie,N.id],Te("dependencies",ke);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:Y?`${f.accent}10`:"transparent"},onMouseEnter:ie=>{Y||(ie.currentTarget.style.backgroundColor=f.hoverBg);},onMouseLeave:ie=>{ie.currentTarget.style.backgroundColor=Y?`${f.accent}10`:"transparent";},children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:Y?f.accent:"transparent",borderColor:Y?f.accent:f.borderLight},children:Y&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:"block truncate",style:{color:f.textPrimary},children:N.name}),jsx("span",{className:"text-[10px]",style:{color:f.textTertiary},children:N.id.slice(0,8)})]})]},N.id)}),r.filter(N=>N.id!==a?.id).length===0&&jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:f.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${f.border}`,fontFamily:"Inter, sans-serif"},children:[jsx("button",{type:"button",onClick:t,className:"px-4 py-2 rounded-lg transition-colors",style:{color:f.textSecondary,fontSize:13},onMouseEnter:N=>N.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:N=>N.currentTarget.style.backgroundColor="transparent",disabled:n,children:"Cancelar"}),jsx("button",{type:"submit",disabled:n,className:"px-4 py-2 font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:f.accent,color:"#FFF",fontSize:13},onMouseEnter:N=>!n&&(N.currentTarget.style.opacity="0.9"),onMouseLeave:N=>!n&&(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:i==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var hm=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
|
|
369
369
|
|
|
370
370
|
AVAILABLE COMMANDS:
|
|
371
371
|
1. move_task - Move a task to a different date
|
|
@@ -406,39 +406,39 @@ Tasks have: id, name, startDate, endDate, progress, status, dependencies[], assi
|
|
|
406
406
|
|
|
407
407
|
Always try to match task names case-insensitively and handle partial matches.
|
|
408
408
|
If you can't find a task by name, search through the provided task list.
|
|
409
|
-
If ambiguous, ask for clarification in the message field.`;function
|
|
410
|
-
${
|
|
409
|
+
If ambiguous, ask for clarification in the message field.`;function ym(e){return `CURRENT TASKS:
|
|
410
|
+
${xm(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(`
|
|
411
411
|
`)}
|
|
412
412
|
|
|
413
|
-
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 to(e,t){let a=ym(e),r=t.toLowerCase().trim(),o=a.find(i=>i.name.toLowerCase()===r);if(o)return o;let s=a.find(i=>i.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(i=>{let c=i.name.toLowerCase();return n.every(l=>c.includes(l))})}function kd(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 m=new Date(r);return m.setDate(m.getDate()+1),m}if(a==="yesterday"||a==="ayer"){let m=new Date(r);return m.setDate(m.getDate()-1),m}if(a==="next week"||a==="la pr\xF3xima semana"){let m=new Date(r);return m.setDate(m.getDate()+7),m}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 g={sunday:0,domingo:0,monday:1,lunes:1,tuesday:2,martes:2,wednesday:3,mi\u00E9rcoles:3,miercoles:3,thursday:4,jueves:4,friday:5,viernes:5,saturday:6,s\u00E1bado:6,sabado:6}[o[1].toLowerCase()];if(g!==void 0){let b=new Date(r),h=b.getDay(),v=g-h;return v<=0&&(v+=7),b.setDate(b.getDate()+v),b}}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 m=parseInt(s[1],10),g=s[2].toLowerCase(),b=new Date(r);return g==="day"||g==="d\xEDa"||g==="dias"?b.setDate(b.getDate()+m):g==="week"||g==="semana"||g==="semanas"?b.setDate(b.getDate()+m*7):(g==="month"||g==="mes"||g==="meses")&&b.setMonth(b.getMonth()+m),b}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let i=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(i&&i[1]&&i[2]&&i[3]){let m=parseInt(i[1],10),g=parseInt(i[2],10)-1,b=parseInt(i[3],10);return new Date(b,g,m)}let c={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},l=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(l&&l[1]&&l[2]){let m=parseInt(l[1],10),g=c[l[2].toLowerCase()],b=l[3]?parseInt(l[3],10):r.getFullYear();if(g!==void 0)return new Date(b,g,m)}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 m=p[d[1].toLowerCase()],g=parseInt(d[2],10),b=d[3]?parseInt(d[3],10):r.getFullYear();if(m!==void 0)return new Date(b,m,g)}return null}function Cd(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 Td(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 xm(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 vm(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let l=r[1].trim(),p=r[2].trim(),d=to(t,l),m=kd(p);if(!d)return {type:"move_task",taskName:l,message:`Could not find a task named "${l}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!m)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 g=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,b=new Date(m);return b.setDate(b.getDate()+g),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:m,endDate:b},message:`Moved "${d.name}" to ${m.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let l=o[1].trim(),p=o[2].trim(),d=to(t,l),m=Cd(p);if(!d)return {type:"resize_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"};if(!m||!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 g=new Date(d.endDate);return g.setDate(g.getDate()+m),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:g},message:`Extended "${d.name}" by ${m} days. New end date: ${g.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let l=s[1].trim(),p=s[2].trim(),d=to(t,l),m=Td(p);return d?m===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:m},message:`Set "${d.name}" progress to ${m}%.`,success:true}:{type:"set_progress",taskName:l,message:`Could not find a task named "${l}".`,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 l=n[1].trim(),p=n[2].trim(),d=to(t,l);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:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}let i=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(i&&i[1]&&i[2]){let l=i[1].trim(),p=i[2].trim(),d=to(t,l),m=to(t,p);return d?m?{type:"link_tasks",taskId:m.id,taskName:m.name,dependencyFrom:d.id,dependencyTo:m.id,message:`Linked "${d.name}" \u2192 "${m.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:l,message:`Could not find a task named "${l}".`,success:false,error:"Source task not found"}}let c=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]){let l=c[1].trim(),p=to(t,l);return p?{type:"delete_task",taskId:p.id,taskName:p.name,message:`Deleted "${p.name}".`,success:true}:{type:"delete_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}return null}function wm(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 qv(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 Xv(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Ti(e,t=[],a=[]){let r=e.assignedUserIds?.map(p=>{let d=a.find(m=>m.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=>Ti(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},i=n(e.startDate),c=n(e.endDate),l=e.metadata?.isMilestone===true||i&&c&&Math.abs(c.getTime()-i.getTime())<=864e5;return {id:e.id,name:e.title,startDate:i,endDate:c,progress:e.progress||0,status:qv(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:l,isCriticalPath:e.metadata?.isCriticalPath===true}}function km(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:Xv(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function Cm(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Ti(r,e,t))}var Nd={columns:{name:"Task ID / Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Executed",tags:"Tags",scheduleVariance:"Sched / Var",hoursBar:"Hours (Spent / Allocated)",teamLoad:"Team Load",blockers:"Blockers",weight:"Weight"},toolbar:{search:"Search",searchPlaceholder:"Search tasks...",filter:"Filter",clearFilters:"Clear Filters",export:"Export",columns:"Columns",newTask:"New Task"},filters:{status:"Status",assignees:"Assignees",dateRange:"Date Range",showCompleted:"Show Completed",all:"All",none:"None"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",viewDetails:"View Details"},empty:{noTasks:"No tasks yet",noResults:"No tasks match your filters",addFirstTask:"Add your first task"},pagination:{showing:"Showing",of:"of",tasks:"tasks",previous:"Previous",next:"Next"},bulk:{selected:"selected",delete:"Delete",move:"Move to",assignTo:"Assign to"}},Dd={columns:{name:"ID Tarea / Nombre",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",tags:"Etiquetas",scheduleVariance:"Prog / Var",hoursBar:"Horas (Usado / Asignado)",teamLoad:"Equipo",blockers:"Bloqueantes",weight:"Peso"},toolbar:{search:"Buscar",searchPlaceholder:"Buscar tareas...",filter:"Filtrar",clearFilters:"Limpiar Filtros",export:"Exportar",columns:"Columnas",newTask:"Nueva Tarea"},filters:{status:"Estado",assignees:"Asignados",dateRange:"Rango de Fechas",showCompleted:"Mostrar Completadas",all:"Todos",none:"Ninguno"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",viewDetails:"Ver Detalles"},empty:{noTasks:"Sin tareas a\xFAn",noResults:"Ninguna tarea coincide con los filtros",addFirstTask:"Agrega tu primera tarea"},pagination:{showing:"Mostrando",of:"de",tasks:"tareas",previous:"Anterior",next:"Siguiente"},bulk:{selected:"seleccionadas",delete:"Eliminar",move:"Mover a",assignTo:"Asignar a"}},Ni={en:Nd,es:Dd};function Sd(e){return Ni[e]||Ni.en}function Di(e,t){let a=Sd(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 Ed=[{value:"todo",icon:Circle,color:"text-gray-400"},{value:"in-progress",icon:PlayCircle,color:"text-[#3B9EFF]"},{value:"completed",icon:CheckCircle2,color:"text-[#3BF06E]"}];function Tm(e){let t=e?.toLowerCase()||"todo";return t==="inprogress"||t==="in-progress"||t==="in_progress"?"in-progress":t==="completed"||t==="done"||t==="complete"?"completed":"todo"}function Nm({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=useState(false),i=useRef(null);useEffect(()=>{let g=b=>{i.current&&!i.current.contains(b.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]);let c=Tm(e),l=Ed[0],p=Ed.find(g=>g.value===c)??l,d=p.icon,m=g=>{switch(Tm(g)){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return o||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(d,{className:u("w-4 h-4 flex-shrink-0",p.color)}),jsx("span",{className:u("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:m(e)})]}):jsxs("div",{ref:i,className:"relative",children:[jsxs("button",{onClick:g=>{g.stopPropagation(),n(!s);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(d,{className:u("w-4 h-4 flex-shrink-0",p.color)}),jsx("span",{className:u("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:m(e)}),jsx(ChevronDown,{className:u("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:u("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:Ed.map(g=>{let b=g.icon;return jsxs("button",{onClick:h=>{h.stopPropagation(),t(g.value),n(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",c===g.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx(b,{className:u("w-4 h-4",g.color)}),jsx("span",{className:a?"text-white":"text-gray-900",children:m(g.value)})]},g.value)})})]})}var Fd=[{value:"urgent",label:{en:"Urgent",es:"Urgente"},color:"text-[#FF2D20]",bg:"bg-[#FF2D20]"},{value:"high",label:{en:"High",es:"Alta"},color:"text-[#FF2D20]",bg:"bg-[#FF2D20]"},{value:"medium",label:{en:"Medium",es:"Media"},color:"text-[#FFD60A]",bg:"bg-[#FFD60A]"},{value:"low",label:{en:"Low",es:"Baja"},color:"text-[#3B9EFF]",bg:"bg-[#3B9EFF]"},{value:"none",label:{en:"None",es:"Ninguna"},color:"text-gray-400",bg:"bg-gray-400"}];function Sm({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=useState(false),i=useRef(null);useEffect(()=>{let p=d=>{i.current&&!i.current.contains(d.target)&&n(false);};return s&&document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]);let c=Fd.find(p=>p.value===e)??Fd[4],l=r==="es"?"es":"en";return o||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(Flag,{className:u("w-4 h-4",c.color)}),jsx("span",{className:u("text-sm",a?"text-white/60":"text-gray-500"),children:c.label[l]})]}):jsxs("div",{ref:i,className:"relative",children:[jsxs("button",{onClick:p=>{p.stopPropagation(),n(!s);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(Flag,{className:u("w-4 h-4",c.color)}),jsx("span",{className:u("text-sm",a?"text-white/60":"text-gray-500"),children:c.label[l]}),jsx(ChevronDown,{className:u("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:u("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:Fd.map(p=>jsxs("button",{onClick:d=>{d.stopPropagation(),t(p.value),n(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===p.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("div",{className:u("w-2 h-2 rounded-full",p.bg)}),jsx("span",{className:a?"text-white":"text-gray-900",children:p.label[l]})]},p.value))})]})}function as(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Md(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 Pm({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false}){let[n,i]=useState(false),[c,l]=useState(""),p=useRef(null),d=useRef(null);useEffect(()=>{let h=v=>{p.current&&!p.current.contains(v.target)&&(i(false),l(""));};return n&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[n]),useEffect(()=>{n&&d.current&&d.current.focus();},[n]);let m=t.filter(h=>h.name.toLowerCase().includes(c.toLowerCase())),g=h=>e.some(v=>v.name===h),b=h=>{if(a){if(g(h.name))a(e.filter(v=>v.name!==h.name));else {let v={name:h.name,initials:as(h.name),color:h.color||Md(h.name).replace("bg-","").replace("-500",""),avatar:h.avatarUrl,id:h.id};a([...e,v]);}i(false),l("");}};return s||!a?e.length===0?jsx("span",{className:u("text-sm",r?"text-white/30":"text-gray-400"),children:"-"}):jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((h,v)=>jsx("div",{className:u("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0D0D0D]":"border-white",!h.avatar&&Md(h.name)),style:h.color&&!h.avatar?{backgroundColor:h.color}:void 0,title:h.name,children:h.avatar?jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials||as(h.name)},`${h.name}-${v}`)),e.length>3&&jsxs("div",{className:u("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#1A1A1A] border-[#0D0D0D] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxs("div",{ref:p,className:"relative",children:[jsx("button",{onClick:h=>{h.stopPropagation(),i(!n);},className:u("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:e.length===0?jsxs(Fragment,{children:[jsx(User,{className:u("w-4 h-4",r?"text-white/30":"text-gray-400")}),jsx(Plus,{className:u("w-3 h-3",r?"text-white/30":"text-gray-400")})]}):jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((h,v)=>jsx("div",{className:u("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0D0D0D]":"border-white",!h.avatar&&Md(h.name)),style:h.color&&!h.avatar?{backgroundColor:h.color}:void 0,children:h.avatar?jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials||as(h.name)},`${h.name}-${v}`)),e.length>2&&jsxs("span",{className:u("text-xs ml-1",r?"text-white/60":"text-gray-500"),children:["+",e.length-2]})]})}),n&&jsxs("div",{className:"absolute z-50 top-full left-0 mt-1.5 rounded-lg overflow-hidden",style:{width:260,backgroundColor:r?"rgba(17, 17, 17, 0.98)":"rgba(255, 255, 255, 0.98)",border:`1px solid ${r?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.1)"}`,boxShadow:r?"0 8px 24px rgba(0,0,0,0.5)":"0 8px 24px rgba(0,0,0,0.12)"},children:[jsxs("div",{className:"flex items-center gap-1.5",style:{padding:"8px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:[jsx(Search,{className:"flex-shrink-0",style:{width:14,height:14,color:r?"rgba(255,255,255,0.20)":"#94A3B8"}}),jsx("input",{ref:d,type:"text",value:c,onChange:h=>l(h.target.value),placeholder:o==="es"?"Buscar miembros...":"Search members...",onClick:h=>h.stopPropagation(),style:{flex:1,fontSize:12,color:r?"rgba(255,255,255,0.92)":"#0F172A",backgroundColor:"transparent",border:"none",outline:"none",fontFamily:"Inter, sans-serif"}})]}),e.length>0&&jsx("div",{className:"flex flex-wrap gap-1",style:{padding:"6px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:e.map((h,v)=>jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:h.color?`${h.color}20`:r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:h.color||(r?"#fff":"#334155")},children:[jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:h.color||"#3B82F6",fontSize:8,fontWeight:700,color:"#fff"},children:h.avatar?jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials||as(h.name)}),h.name.split(" ")[0],jsx("button",{onClick:f=>{f.stopPropagation(),a(e.filter(y=>y.name!==h.name));},className:"flex items-center justify-center",style:{width:14,height:14,borderRadius:3,border:"none",background:"transparent",color:"inherit",cursor:"pointer",opacity:.7},children:jsx(X,{style:{width:10,height:10}})})]},`${h.name}-${v}`))}),jsx("div",{style:{maxHeight:200,overflowY:"auto",padding:4},children:m.length===0?jsx("div",{style:{padding:"12px 10px",fontSize:12,color:r?"rgba(255,255,255,0.35)":"#94A3B8",textAlign:"center"},children:o==="es"?"No se encontraron miembros":"No members found"}):m.map(h=>{let v=g(h.name);return jsxs("button",{onClick:f=>{f.stopPropagation(),b(h);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:v?r?"rgba(0, 127, 255, 0.12)":"rgba(59, 130, 246, 0.08)":"transparent",color:r?"rgba(255,255,255,0.92)":"#0F172A",fontSize:12,textAlign:"left",transition:"background-color 0.1s"},onMouseEnter:f=>{v||(f.currentTarget.style.backgroundColor=r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:f=>{v||(f.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:24,height:24,borderRadius:"50%",backgroundColor:h.color||"#3B82F6",fontSize:9,fontWeight:700,color:"#fff"},children:h.avatarUrl?jsx("img",{src:h.avatarUrl,alt:h.name,className:"w-full h-full rounded-full object-cover"}):as(h.name)}),jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:h.name}),v&&jsx("div",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:4,backgroundColor:"rgba(96, 165, 250, 0.2)"},children:jsx("div",{style:{width:8,height:8,borderRadius:2,backgroundColor:"#60A5FA"}})})]},h.id)})})]})]})}function Im({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:o="end",isDark:s,locale:n,disabled:i=false,placeholder:c}){let[l,p]=useState(false),[d,m]=useState(o),[g,b]=useState(()=>{let D=o==="start"?e:t;if(D){let T=D instanceof Date?D:new Date(D);return new Date(T.getFullYear(),T.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),h=useRef(null),v=e?e instanceof Date?e:new Date(e):null,f=t?t instanceof Date?t:new Date(t):null;useEffect(()=>{let D=T=>{h.current&&!h.current.contains(T.target)&&p(false);};return l&&document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[l]),useEffect(()=>{l&&m(r?o:"start");},[l,r,o]);let y=D=>D?D.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):c||"-",w=useCallback(()=>{let D=g.getFullYear(),T=g.getMonth(),I=new Date(D,T,1),A=new Date(D,T+1,0).getDate(),_=I.getDay(),E=[],L=new Date(D,T,0).getDate();for(let Z=_-1;Z>=0;Z--)E.push({date:new Date(D,T-1,L-Z),isCurrentMonth:false});for(let Z=1;Z<=A;Z++)E.push({date:new Date(D,T,Z),isCurrentMonth:true});let X=42-E.length;for(let Z=1;Z<=X;Z++)E.push({date:new Date(D,T+1,Z),isCurrentMonth:false});return E},[g]),x=D=>{if(r)o==="start"?a(D,f||void 0):a(v||void 0,D),p(false);else if(d==="start"){let T=f&&D>f?D:f;a(D,T||void 0),m("end");}else {let T=v&&D<v?D:v;a(T||void 0,D),p(false);}},C=()=>{let D=new Date,T=new Date(D);T.setDate(D.getDate()+1);let I=new Date(D);I.setDate(D.getDate()+((6-D.getDay()+7)%7||7));let $=new Date(D);$.setDate(D.getDate()+((1-D.getDay()+7)%7||7));let A=new Date(D);A.setDate(D.getDate()+(6-D.getDay()+7)%7+7);let _=new Date(D);_.setDate(D.getDate()+14);let E=new Date(D);return E.setDate(D.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:D,display:D.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:T,display:T.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:I,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:$,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:A,display:A.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:_,display:_.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:E,display:E.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(i){let D=r&&o==="start"?v:f;return jsxs("div",{className:"flex items-center gap-2",children:[jsx(Calendar,{className:u("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:u("text-sm",s?"text-white/60":"text-gray-500"),children:y(D)})]})}let k=r&&o==="start"?v:f;return jsxs("div",{ref:h,className:"relative",children:[jsxs("button",{onClick:D=>{D.stopPropagation(),p(!l);let T=o==="start"?v:f;T&&b(new Date(T.getFullYear(),T.getMonth(),1));},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(Calendar,{className:u("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:u("text-sm",s?"text-white/60":"text-gray-500"),children:y(k)})]}),l&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>p(false)}),jsxs("div",{className:u("absolute z-50 top-full left-0 mt-1 rounded-xl shadow-2xl overflow-hidden flex",s?"bg-[#1A1A1A] border border-[#222]":"bg-white border border-gray-200"),onClick:D=>D.stopPropagation(),children:[jsxs("div",{className:u("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[C().map((D,T)=>jsxs("button",{className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>x(D.date),children:[jsx("span",{children:D.label}),jsx("span",{className:u("text-xs",s?"text-white/30":"text-gray-400"),children:D.display})]},T)),jsx("div",{className:u("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxs("button",{onClick:()=>{r?o==="start"?a(void 0,f||void 0):a(v||void 0,void 0):a(void 0,void 0),p(false);},className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:n==="es"?"Quitar fecha":"Clear date"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[!r&&jsx("div",{className:u("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/[0.03] text-white/60":"bg-gray-100 text-gray-600"),children:d==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("span",{className:u("font-medium",s?"text-white":"text-gray-900"),children:g.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>b(new Date),className:u("p-1 rounded text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>b(new Date(g.getFullYear(),g.getMonth()-1)),className:u("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:u("w-4 h-4",s?"text-white":"text-gray-600")})}),jsx("button",{onClick:()=>b(new Date(g.getFullYear(),g.getMonth()+1)),className:u("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:u("w-4 h-4",s?"text-white":"text-gray-600")})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(D=>jsx("div",{className:u("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:D},D))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:w().map((D,T)=>{let I=D.date.toDateString()===new Date().toDateString(),$=v?.toDateString()===D.date.toDateString(),A=f?.toDateString()===D.date.toDateString(),_=$||A,E=!r&&v&&f&&D.date>=v&&D.date<=f;return jsx("button",{onClick:()=>x(new Date(D.date)),className:u("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!D.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),D.isCurrentMonth&&(s?"text-white":"text-gray-900"),I&&"ring-2 ring-[#007BFF]",$&&"bg-[#007BFF] text-white",A&&!$&&"bg-[#7C3AED] text-white",E&&!_&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!_&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:D.date.getDate()},T)})})]})]})]})]})}function Fi({value:e,onChange:t,isDark:a,locale:r,disabled:o=false,dateField:s="end",startDate:n,endDate:i}){let c=e?e instanceof Date?e:new Date(e):null;return jsx(Im,{startDate:s==="start"?c:n||null,endDate:s==="end"?c:i||null,onChange:(m,g)=>{t&&t(s==="start"?m:g);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:o||!t,placeholder:"-"})}function Cn(e=600){let[t,a]=useState(false),r=useRef(null),o=useCallback(()=>{r.current&&clearTimeout(r.current),a(true),r.current=setTimeout(()=>{a(false);},e);},[e]);return useEffect(()=>()=>{r.current&&clearTimeout(r.current);},[]),{isFlashing:t,triggerFlash:o}}function Mi(e,t={}){let{enabled:a=true,duration:r=400,steps:o=8}=t,[s,n]=useState(e),[i,c]=useState(false),l=useRef(e),p=useRef([]);return useEffect(()=>{if(p.current.forEach(clearTimeout),p.current=[],!a||e===l.current||e===void 0){n(e),l.current=e;return}let d=l.current??0,m=e,g=m-d,b=r/o;c(true);for(let h=1;h<=o;h++){let v=setTimeout(()=>{let f=h/o,y=1-Math.pow(1-f,3),w=Math.round(d+g*y);n(w),h===o&&(c(false),n(m));},b*h);p.current.push(v);}return l.current=e,()=>{p.current.forEach(clearTimeout),p.current=[];}},[e,a,r,o]),{displayValue:s,isAnimating:i}}function Bm(e,t={}){let{delay:a=1500,onCancel:r}=t,[o,s]=useState(null),[n,i]=useState(0),c=useRef(null),l=useRef(null),p=useCallback(g=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current),s(g),i(0);let b=Date.now();l.current=setInterval(()=>{let h=Date.now()-b,v=Math.min(h/a*100,100);i(v);},16),c.current=setTimeout(()=>{l.current&&clearInterval(l.current),e?.(g),s(null),i(0);},a);},[a,e]),d=useCallback(()=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current),s(null),i(0),r?.();},[r]);return useEffect(()=>()=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current);},[]),{pendingValue:o,isPending:o!==null,progress:n,startChange:p,cancelChange:d}}function Om({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:o=true,enableSaveFlash:s=true}){let[n,i]=useState(false),[c,l]=useState(""),p=useRef(null),{isFlashing:d,triggerFlash:m}=Cn(),{displayValue:g,isAnimating:b}=Mi(e,{enabled:o,duration:300,steps:6}),h=x=>{if(r||!t)return;x.stopPropagation();let C=x.currentTarget.getBoundingClientRect(),k=x.clientX-C.left,D=Math.round(k/C.width*100),T=Math.max(0,Math.min(100,D));T!==e&&(t(T),s&&m());},v=useCallback(x=>{r||!t||(x.stopPropagation(),l(String(e)),i(true));},[r,t,e]);useEffect(()=>{n&&p.current&&(p.current.focus(),p.current.select());},[n]);let f=useCallback(()=>{i(false);let x=parseInt(c,10);if(!isNaN(x)&&t){let C=Math.max(0,Math.min(100,x));C!==e&&(t(C),s&&m());}},[c,t,e,s,m]),y=useCallback(x=>{x.key==="Enter"&&f(),x.key==="Escape"&&i(false);},[f]),w=g??e;return jsxs("div",{className:u("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-[background-color] duration-300",d&&(a?"bg-[#3BF06E]/30":"bg-[#3BF06E]/20")),children:[jsx("div",{onClick:h,className:u("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/[0.05]":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsx("div",{className:u("h-full rounded-full transition-[width]",w===100?"bg-[#3BF06E]":"bg-[#3B9EFF]",b&&"transition-none"),style:{width:`${w}%`}})}),n?jsxs("div",{className:"flex items-center gap-0.5",onClick:x=>x.stopPropagation(),children:[jsx("input",{ref:p,value:c,onChange:x=>l(x.target.value.replace(/[^0-9]/g,"")),onBlur:f,onKeyDown:y,maxLength:3,className:u("w-8 text-xs text-right tabular-nums font-mono rounded border px-1 py-0 outline-none",a?"bg-white/10 border-white/20 text-white focus:border-blue-400":"bg-white border-gray-300 text-gray-900 focus:border-blue-500")}),jsx("span",{className:u("text-xs font-mono",a?"text-white/40":"text-gray-400"),children:"%"})]}):jsxs("span",{onClick:v,className:u("text-xs w-8 text-right tabular-nums font-mono rounded px-1",a?"text-white/60":"text-gray-500",!r&&t&&"cursor-pointer hover:bg-white/[0.08]",b&&"font-medium scale-105"),title:!r&&t?"Click to edit":void 0,children:[w,"%"]})]})}function zm({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=useState(false),[i,c]=useState(e),l=useRef(null);useEffect(()=>{s&&l.current&&(l.current.focus(),l.current.select());},[s]),useEffect(()=>{c(e);},[e]);let p=()=>{i!==e&&t?.(i),n(false);},d=m=>{m.key==="Enter"?p():m.key==="Escape"&&(c(e),n(false));};return o||!t?jsx("span",{className:u("text-sm truncate",a?"text-white/60":"text-gray-500"),children:e||r}):s?jsx("input",{ref:l,type:"text",value:i,onChange:m=>c(m.target.value),onBlur:p,onKeyDown:d,onClick:m=>m.stopPropagation(),className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):jsx("button",{onClick:m=>{m.stopPropagation(),n(true);},className:u("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-white/30":"text-gray-400")),children:e||r})}function Vm({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false,enableSlotMachine:i=true,enableSaveFlash:c=true}){let[l,p]=useState(false),[d,m]=useState(e?.toString()||""),g=useRef(null),{isFlashing:b,triggerFlash:h}=Cn(),{displayValue:v,isAnimating:f}=Mi(e,{enabled:i&&!l});useEffect(()=>{l&&g.current&&(g.current.focus(),g.current.select());},[l]),useEffect(()=>{m(e?.toString()||"");},[e]);let y=()=>{let x=parseFloat(d);if(!isNaN(x)){let C=x;o!==void 0&&(C=Math.max(o,C)),s!==void 0&&(C=Math.min(s,C)),C!==e&&(t?.(C),c&&h());}p(false);},w=x=>{x.key==="Enter"?y():x.key==="Escape"&&(m(e?.toString()||""),p(false));};return n||!t?jsx("span",{className:u("text-sm font-mono",a?"text-white/60":"text-gray-500",f&&"font-medium"),children:v!==void 0?v:r}):l?jsx("input",{ref:g,type:"number",value:d,onChange:x=>m(x.target.value),onBlur:y,onKeyDown:w,onClick:x=>x.stopPropagation(),min:o,max:s,className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):jsx("button",{onClick:x=>{x.stopPropagation(),p(true);},className:u("text-sm text-left w-full px-2 py-1 rounded transition-[background-color] duration-300",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",v===void 0&&(a?"text-white/30":"text-gray-400"),b&&(a?"bg-green-500/30":"bg-green-500/20"),f&&"font-medium scale-105"),children:v!==void 0?v:r})}function Gm({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,i]=useState(false),c=useRef(null);return useEffect(()=>{let l=p=>{c.current&&!c.current.contains(p.target)&&i(false);};return n&&document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[n]),s||!a?jsx("span",{className:u("text-sm",r?"text-white/60":"text-gray-500"),children:e||o}):jsxs("div",{ref:c,className:"relative",children:[jsxs("button",{onClick:l=>{l.stopPropagation(),i(!n);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx("span",{className:u("text-sm flex-1 text-left truncate",r?"text-white/60":"text-gray-500",!e&&(r?"text-white/30":"text-gray-400")),children:e||o}),jsx(ChevronDown,{className:u("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")})]}),n&&jsx("div",{className:u("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsx("p",{className:u("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:"No options"}):t.map(l=>jsxs("button",{onClick:p=>{p.stopPropagation(),a(l),i(false);},className:u("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===l&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:r?"text-white":"text-gray-900",children:l}),e===l&&jsx(Check,{className:"w-4 h-4 text-[#007BFF]"})]},l))})]})}function jm({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:o=true,confirmDelay:s=1500}){let{pendingValue:n,isPending:i,progress:c,startChange:l,cancelChange:p}=Bm(t,{delay:s}),d=g=>{g.stopPropagation(),!r&&t&&(o?i?p():l(!e):t(!e));},m=i?n:e;return jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxs("button",{onClick:d,disabled:r||!t,className:u("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-[border-color,background-color,box-shadow]",m?"bg-[#007BFF] border-[#007BFF]":a?"border-[#333] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed",i&&"ring-2 ring-offset-1",i&&m&&"ring-green-500/50",i&&!m&&"ring-red-500/50",i&&(a?"ring-offset-[#050505]":"ring-offset-white")),children:[i&&jsx("svg",{className:"absolute inset-0 w-full h-full -rotate-90",viewBox:"0 0 20 20",children:jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:m?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${c/100*50.26} 50.26`,className:"transition-all duration-100"})}),i?jsx(Loader2,{className:"w-3 h-3 text-white animate-spin"}):m?jsx(Check,{className:"w-3 h-3 text-white"}):null]}),i&&jsx("button",{onClick:g=>{g.stopPropagation(),p();},className:u("w-4 h-4 rounded-full flex items-center justify-center transition-colors",a?"bg-red-500/20 hover:bg-red-500/40 text-red-400":"bg-red-100 hover:bg-red-200 text-red-500"),title:"Cancelar",children:jsx(X,{className:"w-3 h-3"})})]})}function qm({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsx("span",{className:u("text-sm",t?"text-white/30":"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-[9px] font-mono uppercase tracking-wide rounded",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.05)":"#F3F4F6",color:s.color||(t?"rgba(255,255,255,0.5)":"#6B7280")},children:s.name},s.id)),o>0&&jsxs("span",{className:u("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/[0.05] text-white/60":"bg-gray-100 text-gray-500"),children:["+",o]})]})}function I2(e,t="en"){if(e==null||e===0||!e||Number(e)===0)return "-";let a=Math.floor(e/60),r=e%60;return a===0?`${r}m`:r===0?`${a}h`:`${a}h ${r}m`}function B2(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a&&a[1]&&a[2]){let i=parseInt(a[1],10),c=parseInt(a[2],10);return i*60+c}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r&&r[1]){let i=parseFloat(r[1]),c=r[2]?parseInt(r[2],10):0;return Math.round(i*60)+c}let o=t.match(/^(\d+\.?\d*)\s*h$/);if(o&&o[1])return Math.round(parseFloat(o[1])*60);let s=t.match(/^(\d+)\s*(m|min)$/);if(s&&s[1])return parseInt(s[1],10);let n=parseFloat(t);return isNaN(n)?null:Math.round(n*60)}function mr({value:e,onChange:t,isDark:a,locale:r="en",placeholder:o,disabled:s=false,enableSaveFlash:n=true,isBlurred:i=false,lens:c="hours",hourlyRate:l=0}){let[p,d]=useState(false),[m,g]=useState(""),b=useRef(null),{isFlashing:h,triggerFlash:v}=Cn(),f=c==="financial"&&l>0,y=f&&e?`$${Math.round(e/60*l).toLocaleString("en-US")}`:I2(e,r);useEffect(()=>{p&&b.current&&(b.current.focus(),b.current.select());},[p]),useEffect(()=>{if(e){let k=Math.floor(e/60),D=e%60;k>0&&D>0?g(`${k}h ${D}m`):k>0?g(`${k}h`):g(`${D}m`);}else g("");},[e,p]);let w=()=>{let k=B2(m);k!==e&&(t?.(k),n&&v()),d(false);},x=k=>{k.key==="Enter"?w():k.key==="Escape"&&d(false);};if(i)return jsxs("div",{className:"flex items-center gap-1.5",title:r==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data",children:[jsx(Clock,{className:u("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:u("text-sm select-none blur-[4px] opacity-60 pointer-events-none",a?"text-white/60":"text-gray-500"),"aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"})]});let C=f?DollarSign:Clock;return s||!t?jsxs("div",{className:"flex items-center gap-1.5",children:[e!=null&&e>0&&jsx(C,{className:u("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:u("text-sm font-mono",a?"text-white/60":"text-gray-500",(!e||e===0)&&(a?"text-white/30":"text-gray-400")),children:y})]}):p?jsx("input",{ref:b,type:"text",value:m,onChange:k=>g(k.target.value),onBlur:w,onKeyDown:x,onClick:k=>k.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white placeholder:text-white/30":"bg-white border-[#007BFF] text-gray-900 placeholder:text-gray-400")}):jsxs("button",{onClick:k=>{k.stopPropagation(),d(true);},className:u("flex items-center gap-1 text-sm text-left w-full px-1.5 py-1 rounded transition-[background-color] duration-300 overflow-hidden",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e!=null&&e>0?a?"text-white/60":"text-gray-600":a?"text-white/30":"text-gray-400",h&&(a?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsx(C,{className:u("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:"truncate font-mono",children:y})]})}function Zm({startDate:e,endDate:t,scheduleVariance:a,isDark:r,locale:o="en",hasTimeAllocated:s=true}){if(!e&&!t)return jsx("span",{className:u("text-[11px] font-mono",r?"text-white/30":"text-gray-400"),children:"-"});let n=c=>c.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),i=()=>{if(a==null)return null;let c=o==="es";return a===0?s?jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#3B9EFF",fontWeight:600},children:c?"En Tiempo":"On Track"}):jsx("span",{className:"font-mono",style:{fontSize:"10px",color:r?"rgba(255,255,255,0.3)":"#94A3B8",fontWeight:500},children:c?"Tiempo no asignado":"No time allocated"}):a>0?jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#3BF06E",fontWeight:600},children:["+",a,"d ",c?"Adelante":"Early"]}):jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#FF2D20",fontWeight:600},children:[a,"d ",c?"Atraso":"Delay"]})};return jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxs("span",{className:u("text-[11px] font-mono",r?"text-white/60":"text-gray-500"),children:[e?n(e):"\u2014",jsx("span",{className:r?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?n(t):"\u2014"]}),i()]})}function tg({task:e,isDark:t,locale:a="en",onLogTime:r,onEstimateUpdate:o,onSoldEffortUpdate:s,onOpenTimeLog:n,lens:i="hours",hourlyRate:c=0}){let l=a==="es",p=i==="financial"&&c>0,d=Z=>p?`$${Math.round(Z*c).toLocaleString("en-US")}`:`${Z}h`,[m,g]=useState(false),[b,h]=useState(false),[v,f]=useState(null),y=useRef(null),w=e.timeLoggedMinutes||0,x=e.effortMinutes||0,C=e.soldEffortMinutes||0,k=Math.round(w/60*10)/10,D=Math.round(x/60*10)/10,T=x>0?w/x*100:0,I=T>100?Math.round((w-x)/60*10)/10:0,$=T>100?"#EF4444":"#00E5CC";useEffect(()=>{if(!b&&!v)return;let Z=He=>{y.current&&!y.current.contains(He.target)&&(h(false),f(null));};return document.addEventListener("mousedown",Z),()=>document.removeEventListener("mousedown",Z)},[b,v]);let A=Z=>{if(Z.stopPropagation(),r&&!o&&!s){f("log");return}if(r||o||s){h(He=>!He),f(null);return}n&&n(e);},_=Z=>{h(false),f(Z);},E=async(Z,He)=>{v==="log"&&r&&Z?r(e,Z,He):v==="estimate"&&o?o(e,Z):v==="quoted"&&s&&s(e,Z),f(null);},me=r||o||s||n,L=[{mode:"log",icon:Clock,label:l?"Registrar tiempo":"Log time",show:!!r},{mode:"estimate",icon:Target,label:l?"Estimaci\xF3n":"Estimate",show:!!o},{mode:"quoted",icon:DollarSign,label:l?"T. Ofertado":"Quoted time",show:!!s}].filter(Z=>Z.show),X=v==="estimate"?x:v==="quoted"?C:void 0;return x===0&&w===0&&C===0?jsxs("div",{ref:y,className:"relative flex items-center gap-2",onClick:Z=>Z.stopPropagation(),onMouseEnter:()=>g(true),onMouseLeave:()=>g(false),children:[jsx("span",{className:u("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),m&&me&&jsx("button",{onClick:A,className:"flex items-center justify-center w-6 h-6 rounded-md transition-colors",style:{color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent"},onMouseEnter:Z=>{Z.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",Z.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Z=>{Z.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",Z.currentTarget.style.backgroundColor="transparent";},title:l?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:b&&jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:L.map(Z=>jsxs("button",{onClick:He=>{He.stopPropagation(),_(Z.mode);},className:"w-full flex items-center gap-2 px-3 py-2 text-left transition-colors",style:{fontSize:11,fontFamily:"'JetBrains Mono', monospace",color:t?"rgba(255,255,255,0.7)":"#374151",background:"transparent",border:"none",cursor:"pointer"},onMouseEnter:He=>{He.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:He=>{He.target.style.background="transparent";},children:[jsx(Z.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),Z.label]},Z.mode))})}),jsx(AnimatePresence,{children:v&&jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsx($r,{mode:v,locale:a,isDark:t,currentValue:X||void 0,onSave:E,onClose:()=>f(null)})})})})]}):jsxs("div",{ref:y,className:"relative flex items-center gap-2 w-full",onClick:Z=>Z.stopPropagation(),onMouseEnter:()=>g(true),onMouseLeave:()=>g(false),children:[jsxs("div",{className:"flex flex-col gap-1 flex-1 min-w-0",style:{padding:"8px 12px",borderRadius:"4px",border:t?"1px solid #333":"1px solid #E5E7EB",backgroundColor:t?"#1A1A1A":"#F9FAFB"},children:[jsxs("div",{className:"flex items-center gap-1.5",children:[jsx("span",{className:"font-mono",style:{fontSize:13,fontWeight:700,color:t?"#FFFFFF":"#111827"},children:d(k)}),x>0&&jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",d(D)]}),I>0&&jsxs("span",{className:"font-mono px-1.5 py-0.5 rounded",style:{fontSize:10,color:"#EF4444",backgroundColor:"rgba(239,68,68,0.15)"},children:["+",d(I)," Over"]})]}),x>0&&jsx("div",{className:"w-full overflow-hidden",style:{height:3,backgroundColor:t?"#333":"#E5E7EB",borderRadius:2},children:jsx("div",{style:{height:"100%",width:`${Math.min(T,100)}%`,backgroundColor:$,borderRadius:2,transition:"width 0.3s"}})})]}),me&&jsx("button",{onClick:A,className:"flex-shrink-0 flex items-center justify-center w-7 h-7 rounded-md transition-all duration-150",style:{opacity:m?1:0,pointerEvents:m?"auto":"none",color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent",border:"none"},onMouseEnter:Z=>{Z.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",Z.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Z=>{Z.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",Z.currentTarget.style.backgroundColor="transparent";},title:l?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:b&&jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:L.map(Z=>jsxs("button",{onClick:He=>{He.stopPropagation(),_(Z.mode);},className:"w-full flex items-center gap-2 px-3 py-2 text-left transition-colors",style:{fontSize:11,fontFamily:"'JetBrains Mono', monospace",color:t?"rgba(255,255,255,0.7)":"#374151",background:"transparent",border:"none",cursor:"pointer"},onMouseEnter:He=>{He.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:He=>{He.target.style.background="transparent";},children:[jsx(Z.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),Z.label]},Z.mode))})}),jsx(AnimatePresence,{children:v&&jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsx($r,{mode:v,locale:a,isDark:t,currentValue:X||void 0,onSave:E,onClose:()=>f(null)})})})})]})}function W2(e){let t=new Map;function a(r){if(r.assignees)for(let o of r.assignees)o.name&&!t.has(o.name)&&t.set(o.name,o);if(r.subtasks)for(let o of r.subtasks)a(o);}return a(e),Array.from(t.values())}function V2(e){return e>100?{bg:"rgba(239,68,68,0.15)",text:"#EF4444"}:e>=86?{bg:"rgba(245,158,11,0.15)",text:"#F59E0B"}:e>=61?{bg:"rgba(0,229,204,0.15)",text:"#00E5CC"}:{bg:"rgba(34,197,94,0.15)",text:"#22C55E"}}function ag({assignee:e,size:t=28,isDark:a}){let r=t===28?"w-7 h-7":t===24?"w-6 h-6":"w-5 h-5",o=t===28?"text-[10px]":"text-[9px]";return e.avatar?jsx("img",{src:e.avatar,alt:e.name,className:u(r,"rounded-full object-cover ring-1 flex-shrink-0",a?"ring-white/10":"ring-gray-200")}):jsx("div",{className:u(r,"rounded-full flex items-center justify-center font-bold text-white ring-1 flex-shrink-0",o,a?"ring-white/10":"ring-gray-200"),style:{backgroundColor:e.color||"#6B7280"},children:e.initials||e.name?.charAt(0)?.toUpperCase()||"?"})}function rg({task:e,isDark:t,locale:a="en"}){let r=a==="es",o=!!e.hasChildren,s=e.assignees?.[0],n=e.teamLoad;if(o){let p=W2(e);if(p.length===0)return null;let d=p.slice(0,3),m=p.length-3;return jsxs("div",{className:"flex items-center",children:[jsx("div",{className:"flex -space-x-2",children:d.map((g,b)=>jsx(ag,{assignee:g,size:24,isDark:t},g.name+b))}),m>0&&jsxs("span",{className:u("ml-1 text-[10px] font-mono",t?"text-white/40":"text-gray-400"),title:p.slice(3).map(g=>g.name).join(", "),children:["+",m]})]})}if(!s)return jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:u("w-7 h-7 rounded-full flex items-center justify-center flex-shrink-0",t?"bg-white/5":"bg-gray-100"),children:jsx(User,{className:"w-3.5 h-3.5",style:{color:"#4B5563"}})}),jsx("span",{className:u("text-[11px]",t?"text-white/30":"text-gray-400"),children:r?"Sin asignar":"Unassigned"})]});let i=n?.percentage??0,c=!!n&&i>0,l=c?V2(i):null;return jsxs("div",{className:"flex flex-col gap-1",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(ag,{assignee:s,size:28,isDark:t}),jsx("span",{className:u("text-[13px] truncate",t?"text-white":"text-gray-900"),style:{maxWidth:"100px"},children:s.name})]}),c&&l&&jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono uppercase tracking-wide w-fit font-semibold",style:{backgroundColor:l.bg,color:l.text},children:[i,"% LOAD"]})]})}var G2={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function ng({blockers:e,isDark:t,locale:a="en"}){return !e||e.length===0?jsx("span",{className:u("text-[9px] font-mono uppercase tracking-wide",t?"text-white/20":"text-gray-400"),children:a==="es"?"Ninguno":"None"}):jsx("div",{className:"flex items-center gap-1 flex-wrap",children:e.map((r,o)=>jsxs("span",{className:u("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",G2[r.severity]),children:[r.type," #",r.id]},`${r.type}-${r.id}-${o}`))})}function l1(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function d1(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 dg({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:i,onColumnHide:c,onColumnSort:l,availableUsers:p=[],onOpenTimeLog:d,onReportBlocker:m,onCopyTaskLink:g}){let b=useRef(null),h=r==="es"?ig.es:ig.en;if(useEffect(()=>{let x=k=>{b.current&&!b.current.contains(k.target)&&t();},C=k=>{k.key==="Escape"&&t();};return document.addEventListener("mousedown",x),document.addEventListener("keydown",C),()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",C);}},[t]),!e.isOpen)return null;let v=()=>{if(!e.task)return [];let x=[];return o&&x.push({id:"edit",label:h.edit,icon:jsx(Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),x.push({id:"sep1",label:"",icon:null,separator:true}),i&&(x.push({id:"status",label:h.changeStatus,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:h.todo,icon:jsx(Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{i({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:h.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4 text-blue-500"}),onClick:()=>{i({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:h.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{i({...e.task,status:"completed",progress:100}),t();}}]}),x.push({id:"priority",label:h.changePriority,icon:jsx(Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:h.urgent,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{i({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:h.high,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{i({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:h.medium,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{i({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:h.low,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{i({...e.task,priority:"low"}),t();}}]}),p.length>0&&x.push({id:"assign",label:h.assignUser,icon:jsx(Users,{className:"w-4 h-4"}),submenu:p.slice(0,5).map(C=>({id:`assign-${C.id}`,label:C.name,icon:jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-blue-500",children:C.name.charAt(0).toUpperCase()}),onClick:()=>{let k=e.task.assignees||[],T=k.some(I=>I.name===C.name)?k.filter(I=>I.name!==C.name):[...k,{name:C.name,initials:l1(C.name),color:C.color||d1(C.name),avatar:C.avatarUrl}];i({...e.task,assignees:T}),t();}}))})),d&&x.push({id:"log-time",label:h.logTime,icon:jsx(Clock,{className:"w-4 h-4"}),onClick:()=>{d(e.task),t();}}),m&&x.push({id:"report-blocker",label:h.reportBlocker,icon:jsx(AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{m(e.task),t();}}),g&&x.push({id:"copy-link",label:h.copyLink,icon:jsx(Link2,{className:"w-4 h-4"}),onClick:()=>{g(e.task),t();}}),x.push({id:"sep2",label:"",icon:null,separator:true}),s&&x.push({id:"duplicate",label:h.duplicate,icon:jsx(Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),n&&x.push({id:"delete",label:h.delete,icon:jsx(Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),x},f=()=>{if(!e.columnId)return [];let x=[];return l&&(x.push({id:"sort-asc",label:h.sortAsc,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{l(e.columnId,"asc"),t();}}),x.push({id:"sort-desc",label:h.sortDesc,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{l(e.columnId,"desc"),t();}})),c&&e.columnId!=="name"&&(x.push({id:"sep-hide",label:"",icon:null,separator:true}),x.push({id:"hide",label:h.hideColumn,icon:jsx(EyeOff,{className:"w-4 h-4"}),onClick:()=>{c(e.columnId),t();}})),x},y=e.type==="task"?v():f(),w={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsx("div",{ref:b,style:w,className:u("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:y.map(x=>x.separator?jsx("div",{className:u("my-1 h-px",a?"bg-white/[0.05]":"bg-gray-200")},x.id):x.submenu?jsx(c1,{item:x,isDark:a},x.id):jsxs("button",{onClick:x.onClick,className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",x.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsx("span",{className:u(x.danger?"text-red-500":a?"text-white/60":"text-gray-400"),children:x.icon}),x.label]},x.id))})}function c1({item:e,isDark:t}){let[a,r]=useState(false),o=useRef();return jsxs("div",{className:"relative",onMouseEnter:()=>{o.current&&clearTimeout(o.current),r(true);},onMouseLeave:()=>{o.current=setTimeout(()=>r(false),150);},children:[jsxs("button",{className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-white/60":"text-gray-400",children:e.icon}),jsx("span",{className:"flex-1",children:e.label}),jsx(ChevronRight,{className:u("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),a&&e.submenu&&jsx("div",{className:u("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:e.submenu.map(i=>jsxs("button",{onClick:i.onClick,className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-white/60":"text-gray-400",children:i.icon}),i.label]},i.id))})]})}var ig={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",logTime:"Log Time",reportBlocker:"Report Blocker",copyLink:"Copy Link"},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",logTime:"Registrar Tiempo",reportBlocker:"Reportar Bloqueante",copyLink:"Copiar Enlace"}};var yg={name:jsx(Type,{className:"w-4 h-4"}),status:jsx(CircleDot,{className:"w-4 h-4"}),priority:jsx(Flag,{className:"w-4 h-4"}),assignees:jsx(Users,{className:"w-4 h-4"}),startDate:jsx(Calendar,{className:"w-4 h-4"}),endDate:jsx(CalendarCheck,{className:"w-4 h-4"}),progress:jsx(BarChart,{className:"w-4 h-4"}),tags:jsx(Tag,{className:"w-4 h-4"}),estimatedTime:jsx(Clock,{className:"w-4 h-4"}),quotedTime:jsx(FileText,{className:"w-4 h-4"}),elapsedTime:jsx(Timer,{className:"w-4 h-4"}),effortMinutes:jsx(Clock,{className:"w-4 h-4"}),timeLoggedMinutes:jsx(Timer,{className:"w-4 h-4"}),soldEffortMinutes:jsx(FileText,{className:"w-4 h-4"}),scheduleVariance:jsx(CalendarClock,{className:"w-4 h-4"}),hoursBar:jsx(BarChart3,{className:"w-4 h-4"}),teamLoad:jsx(Users,{className:"w-4 h-4"}),blockers:jsx(AlertTriangle,{className:"w-4 h-4"}),weight:jsx(BarChart,{className:"w-4 h-4"}),text:jsx(Type,{className:"w-4 h-4"}),number:jsx(Hash,{className:"w-4 h-4"}),date:jsx(Calendar,{className:"w-4 h-4"}),dropdown:jsx(ChevronDown,{className:"w-4 h-4"}),checkbox:jsx(CheckSquare,{className:"w-4 h-4"})},D1=["name","status","priority","assignees","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"];function vg({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:i}){let[c,l]=useState(""),[p,d]=useState(null),m=useRef(null),g=i==="es"?xg.es:xg.en;if(useLayoutEffect(()=>{if(!e||!m.current)return;let x=()=>{if(!m.current)return;let C=m.current.getBoundingClientRect(),D=window.innerHeight-C.top-20;d(Math.max(300,D));};return requestAnimationFrame(x),window.addEventListener("resize",x),()=>window.removeEventListener("resize",x)},[e]),useEffect(()=>{if(!e)return;let x=setTimeout(()=>{let C=D=>{m.current&&!m.current.contains(D.target)&&t();},k=D=>{D.key==="Escape"&&t();};document.addEventListener("mousedown",C),document.addEventListener("keydown",k),m._cleanup=()=>{document.removeEventListener("mousedown",C),document.removeEventListener("keydown",k);};},100);return ()=>{clearTimeout(x),m._cleanup&&m._cleanup();}},[e,t]),!e)return null;let b=x=>g.columns[x]||x,h=x=>{if(x==="name")return;let C=a.map(k=>k.id===x?{...k,visible:!k.visible}:k);o(C);},v=(x,C)=>{let k=a.find(T=>T.type===x&&(!C||T.customFieldId===C));if(k){h(k.id);return}let D={id:C||x,type:x,label:C?r.find(T=>T.id===C)?.name||x:b(x),width:120,visible:true,sortable:true,resizable:true,customFieldId:C};o([...a,D]);},f=D1.filter(x=>b(x).toLowerCase().includes(c.toLowerCase())),y=r.filter(x=>x.name.toLowerCase().includes(c.toLowerCase())),w=n?"#00E5FF":"#2E94FF";return jsxs("div",{ref:m,style:{...p?{maxHeight:`${p}px`}:{},background:n?"#111114":"#FFFFFF",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.08)"}`,boxShadow:n?"0 8px 32px rgba(0,0,0,0.7)":"0 8px 32px rgba(0,0,0,0.12)"},className:"absolute right-0 top-full mt-1 w-64 rounded-xl z-50 flex flex-col",children:[jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5",style:{borderBottom:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`},children:[jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",color:n?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",fontFamily:"JetBrains Mono, monospace"},children:g.title.toUpperCase()}),jsx("button",{onClick:t,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors",style:{color:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},onMouseEnter:x=>{x.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",x.currentTarget.style.color=n?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:x=>{x.currentTarget.style.backgroundColor="transparent",x.currentTarget.style.color=n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)";},children:jsx(X,{className:"w-3.5 h-3.5"})})]}),jsx("div",{className:"px-3 py-2",children:jsxs("div",{className:"relative",children:[jsx(Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5",style:{color:n?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)"}}),jsx("input",{type:"text",value:c,onChange:x=>l(x.target.value),placeholder:g.searchPlaceholder,style:{fontSize:12,background:n?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,color:n?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.8)"},className:"w-full pl-8 pr-3 py-1.5 rounded-lg outline-none placeholder:opacity-40 transition-colors focus:border-[var(--focus-border)]",ref:x=>{x&&x.style.setProperty("--focus-border",w);},onFocus:x=>{x.currentTarget.style.borderColor=w,x.currentTarget.style.background=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:x=>{x.currentTarget.style.borderColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",x.currentTarget.style.background=n?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)";}})]})}),jsxs("div",{className:"overflow-y-auto flex-1 min-h-0 overscroll-contain px-2 pb-2",onWheel:x=>x.stopPropagation(),children:[jsxs("div",{className:"mb-1",children:[jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:n?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace"},children:g.standardFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:f.map(x=>{let C=a.find(T=>T.type===x&&!T.customFieldId),k=C?.visible??false,D=x==="name";return jsxs("button",{onClick:()=>{D||(C?h(C.id):v(x));},disabled:D,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:D?.4:1,cursor:D?"not-allowed":"pointer"},onMouseEnter:T=>{D||(T.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:T=>{T.currentTarget.style.backgroundColor="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:k?w:"transparent",border:k?`1.5px solid ${w}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:k?`0 0 6px ${w}40`:"none"},children:k&&jsx(Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:k?w:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:yg[x]}),jsx("span",{style:{fontSize:12,fontWeight:k?500:400,color:k?n?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":n?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:b(x)})]},x)})})]}),y.length>0&&jsxs("div",{className:"mt-1",children:[jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:n?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace",borderTop:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,paddingTop:8,marginTop:4},children:g.customFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:y.map(x=>{let k=a.find(D=>D.customFieldId===x.id)?.visible??false;return jsxs("button",{onClick:()=>v(x.type,x.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:D=>{D.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:D=>{D.currentTarget.style.backgroundColor="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:k?w:"transparent",border:k?`1.5px solid ${w}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:k?`0 0 6px ${w}40`:"none"},children:k&&jsx(Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:k?w:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:yg[x.type]||jsx(Type,{className:"w-4 h-4"})}),jsx("span",{style:{fontSize:12,fontWeight:k?500:400,color:k?n?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":n?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:x.name})]},x.id)})})]})]})]})}var xg={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",columns:{name:"Name",status:"Status",priority:"Priority",assignees:"Assignees",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",soldEffortMinutes:"Quoted",effortMinutes:"Estimated",timeLoggedMinutes:"Executed",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox",weight:"Weight"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",assignees:"Asignados",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",soldEffortMinutes:"Ofertado",effortMinutes:"Estimado",timeLoggedMinutes:"Ejecutado",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla",weight:"Peso"}}};var B1=[{type:"text",icon:jsx(Type,{className:"w-5 h-5"})},{type:"number",icon:jsx(Hash,{className:"w-5 h-5"})},{type:"date",icon:jsx(Calendar,{className:"w-5 h-5"})},{type:"dropdown",icon:jsx(ChevronDown,{className:"w-5 h-5"})},{type:"checkbox",icon:jsx(CheckSquare,{className:"w-5 h-5"})}];function Cg({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=useState(""),[i,c]=useState("text"),[l,p]=useState([""]),d=o==="es"?kg.es:kg.en;useEffect(()=>{e&&(n(""),c("text"),p([""]));},[e]),useEffect(()=>{let v=f=>{f.key==="Escape"&&t();};return e&&document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[e,t]);let m=()=>{if(!s.trim())return;let v={name:s.trim(),type:i};i==="dropdown"&&(v.options=l.filter(f=>f.trim())),a(v),t();},g=()=>{p([...l,""]);},b=(v,f)=>{let y=[...l];y[v]=f,p(y);},h=v=>{l.length>1&&p(l.filter((f,y)=>y!==v));};return e?jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxs("div",{className:u("relative w-full max-w-md rounded-xl shadow-2xl border",r?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxs("div",{className:u("flex items-center justify-between px-6 py-4 border-b",r?"border-[#222]":"border-gray-200"),children:[jsx("h2",{className:u("text-lg font-semibold",r?"text-white":"text-gray-900"),children:d.title}),jsx("button",{onClick:t,className:u("p-1 rounded",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(X,{className:u("w-5 h-5",r?"text-white/60":"text-gray-400")})})]}),jsxs("div",{className:"p-6 space-y-6",children:[jsxs("div",{children:[jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldName}),jsx("input",{type:"text",value:s,onChange:v=>n(v.target.value),placeholder:d.fieldNamePlaceholder,className:u("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxs("div",{children:[jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldType}),jsx("div",{className:"grid grid-cols-5 gap-2",children:B1.map(v=>jsxs("button",{onClick:()=>c(v.type),className:u("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",i===v.type?"border-[#007BFF] bg-[#007BFF]/10":r?"border-[#222] hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsx("span",{className:i===v.type?"text-[#007BFF]":r?"text-white/60":"text-gray-400",children:v.icon}),jsx("span",{className:u("text-xs",i===v.type?"text-[#007BFF]":r?"text-white/60":"text-gray-500"),children:d.types[v.type]})]},v.type))})]}),i==="dropdown"&&jsxs("div",{children:[jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.options}),jsxs("div",{className:"space-y-2",children:[l.map((v,f)=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:v,onChange:y=>b(f,y.target.value),placeholder:`${d.option} ${f+1}`,className:u("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),l.length>1&&jsx("button",{onClick:()=>h(f),className:u("p-2 rounded-lg transition-colors",r?"hover:bg-white/[0.05] text-white/60":"hover:bg-gray-100 text-gray-400"),children:jsx(Trash2,{className:"w-4 h-4"})})]},f)),jsxs("button",{onClick:g,className:u("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#007BFF] hover:bg-white/[0.05]":"text-blue-600 hover:bg-gray-100"),children:[jsx(Plus,{className:"w-4 h-4"}),d.addOption]})]})]})]}),jsxs("div",{className:u("flex items-center justify-end gap-3 px-6 py-4 border-t",r?"border-[#222]":"border-gray-200"),children:[jsx("button",{onClick:t,className:u("px-4 py-2 text-sm font-medium rounded-lg transition-colors",r?"text-white/60 hover:bg-white/[0.05]":"text-gray-600 hover:bg-gray-100"),children:d.cancel}),jsx("button",{onClick:m,disabled:!s.trim(),className:u("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#007BFF] text-white hover:bg-[#005FCC]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:d.create})]})]})]}):null}var kg={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 Dg={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 Sg({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,i]=useState(false),c=useRef(null),l=useRef(0),p=s==="es"?Dg.es:Dg.en;useEffect(()=>{if(!n)return;let g=h=>{Date.now()-l.current<100||c.current&&!c.current.contains(h.target)&&i(false);},b=h=>{h.key==="Escape"&&i(false);};return document.addEventListener("mousedown",g),document.addEventListener("keydown",b),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",b);}},[n]);let d=[{value:"all",label:p.showAll,icon:jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}),color:"text-[#007BFF]"},{value:"completed",label:p.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:p.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"todo",label:p.toDo,icon:jsx(Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],m=e!=="all"||t;return jsxs("div",{ref:c,className:"relative",children:[jsxs("button",{onClick:g=>{g.stopPropagation(),n||(l.current=Date.now()),i(b=>!b);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] font-medium transition-all border",o?"border-[#222] hover:bg-white/[0.05] text-white/70":"border-gray-200 hover:bg-gray-100 text-gray-700",m&&(o?"bg-[#2E94FF]/20 border-[#2E94FF]/50 text-[#2E94FF]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/[0.05]":"bg-gray-100")),style:{fontFamily:"Inter, sans-serif"},children:[jsx(Filter,{className:"w-4 h-4"}),p.filters,m&&jsx("span",{className:u("w-2 h-2 rounded-full",o?"bg-[#2E94FF]":"bg-blue-500")})]}),n&&jsxs("div",{className:u("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",o?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsx("div",{className:u("px-4 py-3 border-b",o?"border-[#222]":"border-gray-200"),children:jsx("span",{className:u("text-xs font-medium uppercase tracking-wider",o?"text-white/30":"text-gray-400"),children:p.filterByStatus})}),jsx("div",{className:"py-2",children:d.map(g=>{let b=e===g.value&&!t,h=()=>g.value==="all"?b?jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}):jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):g.icon;return jsxs("button",{onClick:()=>{a(g.value),r(false),i(false);},className:u("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/[0.05]":"hover:bg-gray-100",b&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:u(b?g.color:"text-gray-400","flex-shrink-0"),children:h()}),jsx("span",{className:u("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:g.label}),b&&jsx(Check,{className:u("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]},g.value)})}),jsx("div",{className:u("my-2 mx-4 h-px",o?"bg-white/[0.05]":"bg-gray-200")}),jsx("div",{className:"py-1",children:jsxs("button",{onClick:()=>{let g=!t;r(g),g&&a("all"),i(false);},className:u("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/[0.05]":"hover:bg-gray-100",t&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsx(EyeOff,{className:u("w-4 h-4 flex-shrink-0",t?o?"text-[#007BFF]":"text-blue-500":o?"text-white/30":"text-gray-400")}),jsx("span",{className:u("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:p.hideCompleted}),t&&jsx(Check,{className:u("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]})})]})]})}function Eg(e){if(e<=0)return "0h";let t=Math.floor(e/60),a=e%60;return a>0?`${t}h ${a}m`:`${t}h`}function Fg({data:e,isDark:t,locale:a="en",onClose:r}){let o=a==="es";return jsxs("div",{className:u("w-[220px] xl:w-[280px] flex-shrink-0 overflow-y-auto border-l",t?"bg-[#141414] border-[#222]":"bg-gray-50 border-gray-200"),children:[jsxs("div",{className:u("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsx("h3",{className:u("text-[10px] font-mono uppercase tracking-wider font-bold",t?"text-white/40":"text-gray-500"),children:o?"SALUD DEL PROYECTO":"PROJECT HEALTH"}),r&&jsx("button",{onClick:r,className:u("p-1 rounded transition-colors",t?"text-white/30 hover:text-white/60 hover:bg-white/[0.05]":"text-gray-400 hover:text-gray-600 hover:bg-gray-200"),title:o?"Cerrar panel":"Close panel",children:jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:jsx("path",{d:"M1 1l10 10M11 1L1 11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let s=e.totalHoursSpentMinutes??0,n=e.totalHoursAllocatedMinutes??0,i=n>0?Math.min(Math.round(s/n*100),100):0,c=s>n&&n>0,l=c?"#FF2D20":i>=80?"#FFD60A":"#3BF06E";return jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"HORAS DEL PROYECTO":"PROJECT HOURS"}),jsxs("div",{className:"space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Usado":"Spent"}),jsx("span",{className:u("text-[11px] font-mono font-bold",c?"text-[#FF2D20]":t?"text-white/80":"text-gray-800"),children:Eg(s)})]}),jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Asignado":"Allocated"}),jsx("span",{className:u("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:Eg(n)})]}),n>0&&jsx("div",{className:u("w-full h-1.5 rounded-full overflow-hidden mt-1",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${i}%`,backgroundColor:l}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"SALUD T\xC9CNICA":"TECHNICAL HEALTH"}),jsxs("div",{className:"space-y-3",children:[e.openRFIs!==void 0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:o?"RFIs Abiertos":"Open RFIs"}),jsx("span",{className:u("px-2 py-0.5 rounded text-[11px] font-mono font-bold",e.openRFIs>0?"bg-[#FF2D20]/15 text-[#FF2D20]":"bg-[#3BF06E]/15 text-[#3BF06E]"),children:e.openRFIs})]}),e.submittalsApprovalPercent!==void 0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxs("span",{className:u("text-[11px] font-mono font-bold",e.submittalsApprovalPercent>=80?"text-[#3BF06E]":"text-[#FFD60A]"),children:[e.submittalsApprovalPercent,"%"]})]})]})]}),e.scheduleVarianceDays!==void 0&&jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"VARIACI\xD3N DE CRONOGRAMA":"SCHEDULE VARIANCE"}),(()=>{let s=e.scheduleVarianceDays??0,n=s>0,i=s<0,c=e.scheduleVarianceLabel||(n?`+${s} ${o?"D\xEDas ADELANTE":"Days AHEAD"}`:i?`${s} ${o?"D\xEDas ATR\xC1S":"Days BEHIND"}`:o?"EN TIEMPO":"ON TRACK");return jsx("div",{className:u("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",n&&"bg-[#3BF06E]/15 text-[#3BF06E]",i&&"bg-[#FF2D20]/15 text-[#FF2D20]",!n&&!i&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:c})})()]}),e.teams&&e.teams.length>0&&jsxs("div",{className:"px-5 py-4",children:[jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"DISPONIBILIDAD DEL EQUIPO":"TEAM AVAILABILITY"}),jsx("div",{className:"space-y-3",children:e.teams.map((s,n)=>{let i=s.utilizationPercent>=100?"#FF2D20":s.utilizationPercent>=80?"#FFD60A":s.color||"#3BF06E";return jsxs("div",{children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s.name}),jsxs("span",{className:u("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[s.utilizationPercent,"%"]})]}),jsx("div",{className:u("w-full h-1.5 rounded-full overflow-hidden",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(s.utilizationPercent,100)}%`,backgroundColor:i}})})]},`${s.name}-${n}`)})})]})]})}var J1=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,visible:true,sortable:true,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true}];function Bg(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(...Bg(r.subtasks,t+1));return a}function Q1(e){let t=e.subtasks;if(!t?.length)return null;let a=new Date,r=0,o=0;for(let s of t){if(!s.startDate||!s.endDate)continue;let n=s.startDate.getTime(),c=s.endDate.getTime()-n;if(c<=0)continue;let p=Math.max(0,Math.min(a.getTime()-n,c))/c*100;if(p<=0)continue;let d=(s.progress||0)/p;r+=d,o++;}return o>0?r/o:null}function Z1(e){return e.subtasks?.length?e.subtasks.filter(t=>t.teamLoad&&t.teamLoad.percentage>=100).length:0}function Sn(e){if(!e.subtasks?.length)return {spent:0,allocated:0,quoted:0};let t=0,a=0,r=0;for(let o of e.subtasks)if(o.subtasks?.length){let s=Sn(o);t+=s.spent,a+=s.allocated,r+=s.quoted;}else t+=o.timeLoggedMinutes??0,a+=o.effortMinutes??0,r+=o.soldEffortMinutes??0;return {spent:t,allocated:a,quoted:r}}function Dn(e){if(e<=0)return "0h";let t=Math.floor(e/60),a=e%60;return a>0?`${t}h ${a}m`:`${t}h`}function ew({value:e,onChange:t,isDark:a}){let[r,o]=useState(false),[s,n]=useState(String(e||""));return r?jsx("input",{autoFocus:true,type:"text",inputMode:"decimal",value:s,onClick:i=>i.stopPropagation(),onChange:i=>n(i.target.value.replace(/[^0-9.]/g,"")),onBlur:()=>{let i=parseFloat(s);!isNaN(i)&&i>=0&&i<=100?t(i):s===""&&t(0),o(false);},onKeyDown:i=>{i.key==="Enter"&&i.target.blur(),i.key==="Escape"&&(n(String(e||"")),o(false));},className:u("w-14 text-xs text-right font-mono px-1 py-0.5 rounded border outline-none",a?"bg-white/5 border-[#00E5CC]/50 text-white":"bg-gray-50 border-blue-400 text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"}}):jsx("button",{onClick:i=>{i.stopPropagation(),n(String(e||"")),o(true);},className:u("text-xs font-mono cursor-pointer hover:underline",e>0?a?"text-white/80":"text-gray-700":a?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:e>0?`${e}%`:"\u2014"})}function Rg({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:i=[],customFields:c=[],toolbarRightContent:l}){let{theme:p="dark",locale:d="en",customTranslations:m,showSearch:g=true,showHierarchy:b=true,tableColumns:h,allowColumnCustomization:v=true,allowColumnResize:f=true,enableContextMenu:y=true,showCreateTaskButton:w=false,onCreateTask:x,persistFilter:C=false,financialBlur:k,healthSidebar:D,lens:T="hours",hourlyRate:I=0,aggregateParentHours:$=false,showProjectTotals:A=false}=t,_=Di(d,m),E=p==="dark",me=useCallback(()=>{if(!C||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let M=localStorage.getItem(C);if(M){let J=JSON.parse(M);return {statusFilter:J.statusFilter||"all",hideCompleted:J.hideCompleted||!1}}}catch(M){console.error("Error loading persisted filter:",M);}return {statusFilter:"all",hideCompleted:false}},[C]),L=useMemo(()=>{function M(J){let ye=0,Le=0,Oe=0;for(let B of J)if(B.subtasks&&B.subtasks.length>0){let z=M(B.subtasks);ye+=z.spent,Le+=z.allocated,Oe+=z.quoted;}else ye+=B.timeLoggedMinutes??0,Le+=B.effortMinutes??0,Oe+=B.soldEffortMinutes??0;return {spent:ye,allocated:Le,quoted:Oe}}return M(e)},[e]),X=useMemo(()=>{let M=new Map;function J(ye){let Le=0;for(let Oe of ye)if(Oe.subtasks&&Oe.subtasks.length>0){let B=J(Oe.subtasks);M.set(Oe.id,B),Le+=B;}else Le+=Oe.weight||0;return Le}return J(e),M},[e]),Z=useMemo(()=>!D?.enabled||!D.data?D:{...D,data:{...D.data,totalHoursSpentMinutes:L.spent,totalHoursAllocatedMinutes:L.allocated}},[D,L]),[He,O]=useState(true),[j,he]=useState("position"),[je,U]=useState("asc"),[re,ee]=useState(""),[Ee,we]=useState(()=>me().statusFilter),[Be,ze]=useState(()=>me().hideCompleted),[Qe,te]=useState(h||J1),[tt,pe]=useState(false),[at,pt]=useState(false),[Et,Ce]=useState({isOpen:false,x:0,y:0,type:"task"}),[rt,it]=useState("all"),[Ze,H]=useState(false),de=useRef(null),N=useRef(null),Y=useMemo(()=>{let M=0;function J(ye,Le){for(let Oe of ye)Le>M&&(M=Le),Oe.subtasks?.length&&J(Oe.subtasks,Le+1);}return J(e,1),M},[e]);useEffect(()=>{if(!Ze)return;let M=J=>{de.current?.contains(J.target)||N.current?.contains(J.target)||H(false);};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[Ze]),useEffect(()=>{if(rt==="all"){let ye=function(Le){for(let Oe of Le)Oe.subtasks?.length&&(Oe.isExpanded===false&&a.onTaskToggleExpand?.(Oe.id),ye(Oe.subtasks));};ye(e);}else {let ye=function(Le,Oe){for(let B of Le)if(B.subtasks?.length){let z=Oe<rt,ne=B.isExpanded!==false;z!==ne&&a.onTaskToggleExpand?.(B.id),ye(B.subtasks,Oe+1);}};ye(e,1);}},[rt]);let[ie,ke]=useState(null),[V,ae]=useState(0),[Ve,De]=useState(0),Ue=useRef(null),[Ne,Ke]=useState(null),[bt,lt]=useState(null);useEffect(()=>{h&&te(h);},[h]),useEffect(()=>{if(!(!C||typeof window>"u"))try{localStorage.setItem(C,JSON.stringify({statusFilter:Ee,hideCompleted:Be}));}catch(M){console.error("Error persisting filter state:",M);}},[C,Ee,Be]);let nt=useMemo(()=>{let M=new Set;function J(ye){for(let Le of ye)Le.subtasks?.length&&(Le.isExpanded!==false&&M.add(Le.id),J(Le.subtasks));}return J(e),M},[e]),et=useMemo(()=>Qe.filter(M=>M.visible),[Qe]),At=useCallback(M=>{a.onTaskToggleExpand?.(M);},[a]),Mt=useCallback(M=>{j===M?U(J=>J==="asc"?"desc":"asc"):(he(M),U("asc")),a.onSortChange?.({column:M,direction:je==="asc"?"desc":"asc"});},[j,je,a]),mt=useCallback(M=>{te(M),a.onColumnsChange?.(M);},[a]),yt=useCallback(M=>{let J=Qe.map(ye=>ye.id===M?{...ye,visible:false}:ye);mt(J);},[Qe,mt]),gt=useCallback((M,J)=>{he(M),U(J);},[]),Pt=useCallback((M,J,ye)=>{y&&(M.preventDefault(),Ce({isOpen:true,x:M.clientX,y:M.clientY,type:J?"task":"header",task:J,columnId:ye}));},[y]),Ge=useCallback(()=>{Ce(M=>({...M,isOpen:false}));},[]),Re=useCallback((M,J)=>{if(!f)return;M.preventDefault(),M.stopPropagation();let ye=Qe.find(Le=>Le.id===J);ye&&(ke(J),ae(M.clientX),De(ye.width));},[Qe,f]);useEffect(()=>{if(!ie)return;let M=ye=>{let Le=ye.clientX-V,Oe=Math.max(50,Ve+Le),B=Qe.map(z=>z.id===ie?{...z,width:Oe}:z);te(B);},J=()=>{ie&&a.onColumnsChange?.(Qe),ke(null);};return document.addEventListener("mousemove",M),document.addEventListener("mouseup",J),()=>{document.removeEventListener("mousemove",M),document.removeEventListener("mouseup",J);}},[ie,V,Ve,Qe,a]);let ut=useCallback((M,J)=>{if(J==="name"){M.preventDefault();return}Ke(J),M.dataTransfer.effectAllowed="move",M.dataTransfer.setData("text/plain",J),M.currentTarget instanceof HTMLElement&&(M.currentTarget.style.opacity="0.5");},[]),le=useCallback(M=>{M.currentTarget instanceof HTMLElement&&(M.currentTarget.style.opacity="1"),Ke(null),lt(null);},[]),fe=useCallback((M,J)=>{M.preventDefault(),J!=="name"&&(M.dataTransfer.dropEffect="move",lt(J));},[]),P=useCallback(()=>{lt(null);},[]),K=useCallback((M,J)=>{if(M.preventDefault(),!Ne||Ne===J||J==="name")return;let ye=[...Qe],Le=ye.findIndex(z=>z.id===Ne),Oe=ye.findIndex(z=>z.id===J);if(Le===-1||Oe===-1)return;let B=ye.splice(Le,1);B[0]&&(ye.splice(Oe,0,B[0]),mt(ye),Ke(null),lt(null));},[Ne,Qe,mt]),q=useCallback(async M=>{if(a.onCreateCustomField){let J={...M,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(J);}pt(false);},[a]),ce=useCallback(M=>M.progress===100||M.status==="completed"?"completed":M.progress&&M.progress>0||M.status==="in-progress"?"in-progress":"todo",[]),Se=useMemo(()=>{let M=Bg(e);if(re.trim()){let J=re.toLowerCase();M=M.filter(ye=>ye.name.toLowerCase().includes(J));}return Ee!=="all"&&(M=M.filter(J=>ce(J)===Ee)),Be&&(M=M.filter(J=>ce(J)!=="completed")),M.sort((J,ye)=>{let Le,Oe;switch(j){case "name":Le=J.name.toLowerCase(),Oe=ye.name.toLowerCase();break;case "startDate":Le=J.startDate?.getTime()||0,Oe=ye.startDate?.getTime()||0;break;case "endDate":Le=J.endDate?.getTime()||0,Oe=ye.endDate?.getTime()||0;break;case "progress":Le=J.progress||0,Oe=ye.progress||0;break;case "status":Le=J.status||"todo",Oe=ye.status||"todo";break;case "priority":let B={urgent:0,high:1,medium:2,low:3,none:4};Le=B[J.priority]??4,Oe=B[ye.priority]??4;break;case "position":return 0;default:return 0}return Le<Oe?je==="asc"?-1:1:Le>Oe?je==="asc"?1:-1:0}),M},[e,re,Ee,Be,j,je,ce]),Xe=useCallback((M,J)=>{let ye=B=>{a.onTaskUpdate?.({...M,...B});},Le=B=>B?M.customFields?.find(ne=>ne.fieldId===B)?.value:void 0,Oe=(B,z)=>{if(!B)return;let S=[...M.customFields||[]],oe=S.findIndex(Te=>Te.fieldId===B);oe>=0?S[oe]={fieldId:B,value:z}:S.push({fieldId:B,value:z}),ye({customFields:S});};switch(J.type){case "name":return null;case "status":return jsx(Nm,{value:M.status||(M.progress===100?"completed":M.progress&&M.progress>0?"in-progress":"todo"),onChange:z=>{ye({status:z,progress:z==="completed"?100:z==="in-progress"?50:0});},isDark:E,locale:d,translations:_.status});case "priority":return jsx(Sm,{value:M.priority,onChange:z=>ye({priority:z}),isDark:E,locale:d});case "assignees":{let z=M.hasChildren,ne=M.assignees||[];if(z&&M.subtasks?.length){let S=new Map;(M.assignees||[]).forEach(Te=>S.set(Te.name,Te));let oe=Te=>{(Te||[]).forEach(We=>{(We.assignees||[]).forEach(Tt=>{S.has(Tt.name)||S.set(Tt.name,Tt);}),We.subtasks?.length&&oe(We.subtasks);});};oe(M.subtasks),ne=Array.from(S.values());}return jsx(Pm,{value:ne,availableUsers:i,onChange:S=>ye({assignees:S}),isDark:E,locale:d,disabled:z})}case "startDate":return jsx(Fi,{value:M.startDate,onChange:z=>ye({startDate:z}),isDark:E,locale:d,dateField:"start",startDate:M.startDate,endDate:M.endDate});case "endDate":return jsx(Fi,{value:M.endDate,onChange:z=>ye({endDate:z}),isDark:E,locale:d,dateField:"end",startDate:M.startDate,endDate:M.endDate});case "progress":return jsx(Om,{value:M.progress||0,onChange:z=>{let ne=z===100?"completed":z>0?"in-progress":"todo";ye({progress:z,status:ne});},isDark:E});case "tags":return jsx(qm,{value:M.tags||[],isDark:E});case "text":return jsx(zm,{value:Le(J.customFieldId)||"",onChange:z=>Oe(J.customFieldId,z),isDark:E});case "number":return jsx(Vm,{value:Le(J.customFieldId)||0,onChange:z=>Oe(J.customFieldId,z),isDark:E});case "date":let B=Le(J.customFieldId);return jsx(Fi,{value:B?new Date(B):void 0,onChange:z=>Oe(J.customFieldId,z),isDark:E,locale:d});case "dropdown":return jsx(Gm,{value:Le(J.customFieldId)||"",options:J.options||[],onChange:z=>Oe(J.customFieldId,z),isDark:E});case "checkbox":return jsx(jm,{value:Le(J.customFieldId)||false,onChange:z=>Oe(J.customFieldId,z),isDark:E});case "estimatedTime":{let z=M.status==="completed"||M.progress===100;return jsx(mr,{value:M.estimatedTime,onChange:ne=>ye({estimatedTime:ne}),isDark:E,locale:d,disabled:z,lens:T,hourlyRate:I})}case "quotedTime":{let z=M.status==="completed"||M.progress===100,ne=k?.enabled&&(!k.columns||k.columns.includes("quotedTime"));return jsx(mr,{value:M.quotedTime,onChange:S=>ye({quotedTime:S}),isDark:E,locale:d,disabled:z,isBlurred:ne,lens:T,hourlyRate:I})}case "elapsedTime":{let z=M.status==="completed"||M.progress===100;return jsx(mr,{value:M.elapsedTime,onChange:ne=>ye({elapsedTime:ne}),isDark:E,locale:d,disabled:z,lens:T,hourlyRate:I})}case "effortMinutes":{if($&&M.subtasks&&M.subtasks.length>0){let{allocated:ne}=Sn(M);return jsx(mr,{value:ne>0?ne:void 0,isDark:E,locale:d,disabled:true,lens:T,hourlyRate:I})}let z=M.status==="completed"||M.progress===100;return jsx(mr,{value:M.effortMinutes,onChange:ne=>ye({effortMinutes:ne}),isDark:E,locale:d,disabled:z,lens:T,hourlyRate:I})}case "timeLoggedMinutes":{if($&&M.subtasks&&M.subtasks.length>0){let{spent:ne}=Sn(M);return jsx(mr,{value:ne>0?ne:void 0,isDark:E,locale:d,disabled:true,lens:T,hourlyRate:I})}let z=M.status==="completed"||M.progress===100;return jsx(mr,{value:M.timeLoggedMinutes,onChange:a.onLogTime?ne=>{a.onLogTime?.(M,ne);}:void 0,isDark:E,locale:d,placeholder:d==="es"?"Agregar":"Add",disabled:z,lens:T,hourlyRate:I})}case "soldEffortMinutes":{if($&&M.subtasks&&M.subtasks.length>0){let{quoted:S}=Sn(M),oe=k?.enabled&&(!k.columns||k.columns.includes("soldEffortMinutes"));return jsx(mr,{value:S>0?S:void 0,isDark:E,locale:d,disabled:true,isBlurred:oe,lens:T,hourlyRate:I})}let z=M.status==="completed"||M.progress===100,ne=k?.enabled&&(!k.columns||k.columns.includes("soldEffortMinutes"));return jsx(mr,{value:M.soldEffortMinutes,onChange:S=>ye({soldEffortMinutes:S}),isDark:E,locale:d,disabled:z,isBlurred:ne,lens:T,hourlyRate:I})}case "scheduleVariance":{let z=M.effortMinutes||0,ne=M.soldEffortMinutes||0,S=M.timeLoggedMinutes||0,oe=z>0||ne>0||S>0;return jsx(Zm,{startDate:M.startDate,endDate:M.endDate,scheduleVariance:M.scheduleVariance,isDark:E,locale:d,hasTimeAllocated:oe})}case "hoursBar":{if($&&M.hasChildren){let{spent:z,allocated:ne,quoted:S}=Sn(M),oe=z>ne&&ne>0;return jsxs("span",{className:u("text-[11px] font-mono flex items-center gap-1.5",E?"text-white/50":"text-gray-500"),children:[jsx("span",{className:u("font-bold",oe?"text-[#FF453A]":E?"text-white/80":"text-gray-800"),children:Dn(z)}),ne>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:E?"text-white/60":"text-gray-600",children:Dn(ne)})]}),S>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:E?"text-amber-400/70":"text-amber-600",children:Dn(S)})]})]})}return jsx(tg,{task:M,isDark:E,locale:d,onLogTime:a.onLogTime,onEstimateUpdate:a.onEstimateUpdate,onSoldEffortUpdate:a.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:a.onOpenTimeLog,lens:T,hourlyRate:I})}case "teamLoad":return jsx(rg,{task:M,isDark:E,locale:d});case "blockers":return jsx(ng,{blockers:M.blockers,isDark:E,locale:d});case "weight":{let z=X.get(M.id);if(z!==void 0)return jsx("span",{className:u("text-xs font-mono",z>0?E?"text-white/50":"text-gray-400":E?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:z>0?`${Number(z.toFixed(2))}%`:"\u2014"});let ne=M.weight||0;return jsx(ew,{value:ne,onChange:S=>ye({weight:S}),isDark:E})}default:return jsx("span",{className:u("text-sm",E?"text-white/60":"text-gray-500"),children:"-"})}},[a,E,d,i,_,$,X]),_e=useCallback(M=>{let ye={name:_.columns.name,status:_.columns.status,priority:_.columns.priority,assignees:_.columns.assignees,startDate:_.columns.startDate,endDate:_.columns.endDate,progress:_.columns.progress,tags:_.columns.tags||(d==="es"?"Etiquetas":"Tags"),estimatedTime:_.columns.estimatedTime||(d==="es"?"Estimado":"Estimated"),quotedTime:_.columns.quotedTime||(d==="es"?"Ofertado":"Quoted"),elapsedTime:_.columns.elapsedTime||(d==="es"?"Ejecutado":"Executed"),soldEffortMinutes:_.columns.soldEffortMinutes||(d==="es"?"Ofertado":"Quoted"),effortMinutes:_.columns.effortMinutes||(d==="es"?"Estimado":"Estimated"),timeLoggedMinutes:_.columns.timeLoggedMinutes||(d==="es"?"Ejecutado":"Executed"),scheduleVariance:_.columns.scheduleVariance||(d==="es"?"Prog / Var":"Sched / Var"),hoursBar:_.columns.hoursBar||(d==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:_.columns.teamLoad||(d==="es"?"Equipo":"Team"),blockers:_.columns.blockers||(d==="es"?"Bloqueantes":"Blockers"),weight:_.columns.weight||(d==="es"?"Peso":"Weight")}[M.type]||M.label;return typeof ye=="string"?ye:String(ye||M.type)},[_,d]),Ie=useMemo(()=>{let ye=et.reduce((Oe,B)=>Oe+B.width,0)+(v?48:0),Le={};for(let Oe of et)Le[Oe.id]=`${Oe.width/ye*100}%`;return Le},[et,v]);return r?jsx("div",{className:u("flex-1 flex items-center justify-center",E?"bg-[#0D0D0D]":"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-[#007BFF]"}),jsxs("p",{className:u("text-sm",E?"text-white/60":"text-gray-600"),children:[_.empty.noTasks,"..."]})]})}):o?jsx("div",{className:u("flex-1 flex items-center justify-center",E?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxs("div",{children:[jsx("h3",{className:u("text-lg font-semibold mb-2",E?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:u("text-sm",E?"text-white/60":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsx("div",{className:u("flex-1 flex items-center justify-center",E?"bg-[#0D0D0D]":"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-[#007BFF]/10 flex items-center justify-center",children:jsx(List,{className:"w-8 h-8 text-[#007BFF]"})}),jsx("h3",{className:u("text-lg font-semibold mb-2",E?"text-white":"text-gray-900"),children:_.empty.noTasks}),jsx("p",{className:u("text-sm",E?"text-white/60":"text-gray-600"),children:_.empty.addFirstTask})]})}):jsxs("div",{ref:Ue,className:u(E?"bg-[#0D0D0D]":"bg-white",ie&&"select-none",s),style:{display:"flex",flexDirection:"column",flex:"1 1 0%",width:"100%",height:"100%",overflow:"hidden",minHeight:0,...n},children:[jsx("div",{className:u("flex-shrink-0 px-6 py-4 border-b",E?"border-[#222]":"border-gray-200"),children:jsxs("div",{className:"flex items-center gap-4",children:[jsxs("div",{className:u("text-sm",E?"text-white/60":"text-gray-600"),children:[Se.length," ",_.pagination.tasks]}),g&&jsxs("div",{className:"relative flex-1 max-w-md",children:[jsx(Search,{className:u("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",E?"text-white/60":"text-gray-400")}),jsx("input",{type:"text",value:re,onChange:M=>ee(M.target.value),placeholder:_.toolbar.searchPlaceholder,className:u("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",E?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30 font-mono":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsx("div",{className:"flex-1"}),l&&jsx("div",{className:"flex items-center gap-2",children:l}),b&&Y>1&&jsxs("div",{className:"relative",children:[jsxs("button",{ref:de,onClick:()=>H(!Ze),className:u("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border transition-colors text-[11px] font-medium",E?Ze?"bg-blue-500/10 border-blue-500/40 text-blue-400":"bg-white/[0.03] border-[#333] text-white/50 hover:text-white/70 hover:bg-white/[0.05]":Ze?"bg-blue-50 border-blue-300 text-blue-600":"bg-gray-100 border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-200"),style:{fontFamily:"'JetBrains Mono', monospace"},children:[jsx(Layers,{className:"w-3.5 h-3.5"}),rt==="all"?d==="es"?"Todos":"All":`L${rt}`]}),Ze&&jsx("div",{ref:N,className:u("absolute top-full mt-1 right-0 w-24 rounded-lg border overflow-hidden z-50 shadow-lg",E?"bg-[#1A1A1A] border-[#333]":"bg-white border-gray-200"),children:[{value:"all",label:d==="es"?"Todos":"All"},...Array.from({length:Math.min(Y,5)},(M,J)=>({value:J+1,label:`L${J+1}`}))].map(M=>jsxs("button",{onClick:()=>{it(M.value),H(false);},className:u("w-full px-3 py-2 text-left text-xs transition-colors flex items-center justify-between",E?rt===M.value?"bg-blue-500/10 text-blue-400":"text-white/60 hover:bg-white/[0.05] hover:text-white/80":rt===M.value?"bg-blue-50 text-blue-600":"text-gray-600 hover:bg-gray-100"),children:[jsx("span",{children:M.label}),rt===M.value&&jsx("span",{className:"text-blue-400",children:"\u2713"})]},String(M.value)))})]}),jsx(Sg,{value:Ee,hideCompleted:Be,onChange:we,onHideCompletedChange:ze,isDark:E,locale:d}),Z?.enabled&&Z.data&&!He&&jsx("button",{onClick:()=>O(true),className:u("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",E?"border-[#333] text-white/40 hover:text-white/70 hover:bg-white/[0.05]":"border-gray-200 text-gray-400 hover:text-gray-600 hover:bg-gray-100"),title:d==="es"?"Abrir panel de salud":"Open health panel",children:jsx(PanelRight,{className:"w-4 h-4"})}),w&&x&&jsxs(motion.button,{onClick:x,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-[transform,box-shadow]",style:{background:"linear-gradient(135deg, #007BFF 0%, #005FCC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 123, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 123, 255, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-4 h-4"}),jsx("span",{children:_.toolbar.newTask})]})]})}),jsxs("div",{style:{display:"flex",flex:"1 1 0%",overflow:"hidden",minHeight:0},children:[jsx("div",{style:{flex:"1 1 0%",overflow:"auto",minHeight:0},children:jsxs("div",{style:{width:"100%"},children:[jsxs("div",{className:u("flex-shrink-0 flex items-center border-b text-[9px] font-bold uppercase tracking-wider sticky top-0 z-10",E?"border-[#222] bg-[#1A1A1A] font-mono":"border-gray-200 bg-gray-50"),children:[et.map(M=>{let J=M.id!=="name",ye=bt===M.id&&Ne!==M.id;return jsxs("div",{className:u("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",E?"text-white/60":"text-gray-500",J&&"cursor-grab",Ne===M.id&&"opacity-50",ye&&(E?"bg-[#007BFF]/20 border-l-2 border-l-[#007BFF]":"bg-blue-50 border-l-2 border-l-blue-400")),style:{width:Ie[M.id],minWidth:M.minWidth},draggable:J,onDragStart:J?Le=>ut(Le,M.id):void 0,onDragEnd:J?le:void 0,onDragOver:J?Le=>fe(Le,M.id):void 0,onDragLeave:J?P:void 0,onDrop:J?Le=>K(Le,M.id):void 0,onContextMenu:Le=>Pt(Le,void 0,M.id),children:[J&&jsx(GripVertical,{className:u("w-3 h-3 flex-shrink-0 transition-opacity",E?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),M.sortable?jsxs("button",{draggable:false,onClick:()=>Mt(M.id),className:"flex items-center gap-1 hover:text-[#007BFF]",children:[_e(M),jsx(ArrowUpDown,{className:u("w-3 h-3",j===M.id&&"text-[#007BFF]")})]}):jsx("span",{draggable:false,children:_e(M)}),f&&M.resizable&&jsx("div",{className:u("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#007BFF]",ie===M.id&&"bg-[#007BFF]"),onMouseDown:Le=>Re(Le,M.id)})]},M.id)}),v&&jsxs("div",{className:"relative flex items-center justify-center px-3 py-0.5",children:[jsx("button",{onClick:M=>{M.stopPropagation(),pe(J=>!J);},className:u("p-0.5 rounded transition-colors",E?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",tt&&(E?"bg-white/[0.05]":"bg-gray-200")),title:d==="es"?"Agregar columna":"Add column",children:jsx(Plus,{className:"w-3 h-3"})}),jsx(vg,{isOpen:tt,onClose:()=>pe(false),columns:Qe,customFields:c,onColumnsChange:mt,onCreateCustomField:()=>{pe(false),pt(true);},isDark:E,locale:d})]})]}),jsx(AnimatePresence,{mode:"popLayout",children:Se.map((M,J)=>{let ye=nt.has(M.id),Le=Math.min(J*.01,.2),Oe=M.hasChildren&&M.level===0,B=M.subtasks?.length||0;if(Oe){let{spent:z,allocated:ne,quoted:S}=Sn(M),oe=Q1(M),Te=Z1(M);return jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:Le},className:u("flex items-center border-y cursor-pointer",E?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100"),onClick:()=>a.onTaskClick?.(M),children:et.map(We=>jsx("div",{className:"flex items-center px-4 py-2.5",style:{width:Ie[We.id],minWidth:We.minWidth},children:We.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[jsx("button",{onClick:Tt=>{Tt.stopPropagation(),At(M.id);},className:u("p-0.5 rounded flex-shrink-0",E?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:ye?jsx(ChevronDown,{className:u("w-4 h-4",E?"text-white/40":"text-gray-500")}):jsx(ChevronRight,{className:u("w-4 h-4",E?"text-white/40":"text-gray-500")})}),jsx("span",{onClick:Tt=>{Tt.stopPropagation(),At(M.id);},className:"flex-shrink-0 cursor-pointer",children:ye?jsx(FolderOpen,{className:"w-4 h-4",style:{color:E?"#FFD60A":"#B45309"}}):jsx(Folder,{className:"w-4 h-4",style:{color:E?"#FFD60A":"#B45309"}})}),M.wbsCode&&jsx("span",{className:"text-[10px] font-mono flex-shrink-0",style:{color:E?"#FFD60A":"#B45309"},children:M.wbsCode}),jsx("span",{title:M.name,className:u("text-[11px] font-semibold uppercase tracking-wide truncate",E?"text-white":"text-gray-800"),style:{fontFamily:"Inter, system-ui, sans-serif",WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"},children:M.name}),jsxs("span",{className:u("text-[10px] font-mono px-2 py-0.5 rounded-full flex-shrink-0",E?"text-white/30 bg-white/[0.05]":"text-gray-500 bg-gray-200"),children:["(",B," ",d==="es"?B===1?"Tarea":"Tareas":B===1?"Item":"Items",")"]}),oe!==null&&jsxs("span",{className:u("text-[10px] font-mono flex-shrink-0",oe>=1?"text-[#32D74B]":oe>=.8?"text-[#FFD60A]":"text-[#FF453A]"),children:["Avg SPI: ",oe.toFixed(2)]}),Te>0&&jsxs("span",{className:"text-[10px] font-mono text-[#FF453A] flex-shrink-0",children:[d==="es"?"Conflicto":"Conflict",": ",Te]})]}):We.type==="timeLoggedMinutes"?jsx(mr,{value:z>0?z:void 0,isDark:E,locale:d,disabled:true,lens:T,hourlyRate:I}):We.type==="soldEffortMinutes"?jsx(mr,{value:S>0?S:void 0,isDark:E,locale:d,disabled:true,lens:T,hourlyRate:I}):We.type==="effortMinutes"?jsx(mr,{value:ne>0?ne:void 0,isDark:E,locale:d,disabled:true,lens:T,hourlyRate:I}):Xe(M,We)},We.id))},M.id)}return jsxs(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:Le},className:u("flex items-center border-b transition-colors",E?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50"),onClick:()=>a.onTaskClick?.(M),onDoubleClick:()=>a.onTaskDoubleClick?.(M),onContextMenu:z=>Pt(z,M),children:[et.map(z=>jsx("div",{className:"flex items-center px-4 py-3 min-h-[56px]",style:{width:Ie[z.id],minWidth:z.minWidth},children:z.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[b&&M.level>0&&jsx("div",{style:{width:`${M.level*24}px`},className:"flex-shrink-0"}),b&&M.hasChildren&&jsx("button",{onClick:ne=>{ne.stopPropagation(),At(M.id);},className:u("p-0.5 rounded flex-shrink-0",E?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:ye?jsx(ChevronDown,{className:u("w-4 h-4",E?"text-white/60":"text-gray-400")}):jsx(ChevronRight,{className:u("w-4 h-4",E?"text-white/60":"text-gray-400")})}),b&&!M.hasChildren&&jsx("div",{className:"w-5 flex-shrink-0"}),jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(M.wbsCode||M.taskCode)&&jsxs("div",{className:"flex items-center gap-1.5",children:[M.wbsCode&&jsx("span",{className:u("text-[10px] font-mono",E?"text-[#007BFF]":"text-blue-600"),children:M.wbsCode}),M.taskCode&&jsx("span",{className:u("text-[10px] font-mono",E?"text-white/40":"text-gray-400"),children:M.taskCode})]}),jsx("span",{className:u("truncate font-bold text-[13px]",M.progress===100?E?"line-through text-white/50":"line-through text-gray-400":E?"text-white":"text-gray-900"),children:M.name}),M.tags?.[0]&&jsx("span",{className:"text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",style:{backgroundColor:`${M.tags[0].color}20`,color:M.tags[0].color},children:M.tags[0].name})]})]}):Xe(M,z)},z.id)),v&&jsx("div",{className:"w-12 flex-shrink-0"})]},M.id)})}),A&&Se.length>0&&(()=>{let{spent:M,allocated:J,quoted:ye}=L,Le=J-M,Oe=Le<0,B=Oe?`+${Dn(Math.abs(Le))} ${d==="es"?"EXCEDIDO":"OVER"}`:`-${Dn(Le)} ${d==="es"?"AHORRADO":"SAVED"}`,z=T==="financial"&&I>0,ne=Te=>z?`$${(Te/60*I).toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:0})}`:Dn(Te),S=z?Math.abs(Le/60*I):0,oe=z?`${Oe?"+":"-"}$${S.toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:0})} ${Oe?d==="es"?"EXCEDIDO":"OVER":d==="es"?"AHORRADO":"SAVED"}`:B;return jsxs("div",{className:u("flex items-center sticky bottom-0 z-10",E?"border-t border-[#2A2A3A]":"border-t border-gray-300"),style:{backgroundColor:E?"rgba(13, 17, 23, 0.95)":"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[et.map(Te=>jsx("div",{className:"flex items-center px-4 py-3",style:{width:Ie[Te.id],minWidth:Te.minWidth},children:Te.type==="name"?jsx("span",{className:u("text-[11px] font-black uppercase tracking-widest",E?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:d==="es"?"TOTAL PROYECTO":"TOTAL PROJECT"}):Te.type==="hoursBar"?jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsx("span",{className:u("text-[12px] font-bold",E?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:ne(M)}),jsx("span",{className:u("text-[11px]",E?"text-white/40":"text-gray-400"),children:"/"}),jsx("span",{className:u("text-[11px]",E?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:ne(J)}),J>0&&jsx("span",{className:u("text-[10px] font-semibold ml-1",Oe?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:z?oe:B})]}):Te.type==="soldEffortMinutes"?jsx("span",{className:u("text-[12px] font-bold",E?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:ye>0?ne(ye):"\u2013"}):Te.type==="effortMinutes"?jsx("span",{className:u("text-[12px] font-bold",E?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:J>0?ne(J):"\u2013"}):Te.type==="timeLoggedMinutes"?jsx("span",{className:u("text-[12px] font-bold",E?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:M>0?ne(M):"\u2013"}):Te.type==="progress"?(()=>{let We=e||[],Tt=0,Nt=0,la=0,aa=0;for(let Ut of We){let ua=Ut.weight||X.get(Ut.id)||0,Mn=Ut.progress||0;ua>0&&(Tt+=Mn*ua,Nt+=ua),la+=Mn,aa++;}let ya=Nt>0?Math.round(Tt/Nt*10)/10:aa>0?Math.round(la/aa):0;return jsxs("span",{className:u("text-[12px] font-bold font-mono",E?"text-[#00E5CC]":"text-cyan-600"),style:{fontFamily:"JetBrains Mono, monospace"},children:[ya,"%"]})})():Te.type==="weight"?(()=>{let We=e||[],Tt=[],Nt=Ut=>{for(let ua of Ut)Tt.push(ua),ua.subtasks?.length&&Nt(ua.subtasks);};Nt(We);let aa=Tt.filter(Ut=>!Ut.subtasks?.length||Ut.subtasks.length===0).reduce((Ut,ua)=>Ut+(ua.weight||0),0),ya=Math.abs(aa-100)<.1;return jsxs("span",{className:u("text-[12px] font-bold font-mono",ya?E?"text-[#22C55E]":"text-green-600":"text-[#EF4444]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Number(aa.toFixed(1)),"%"]})})():jsx("span",{className:u("text-[11px]",E?"text-white/30":"text-gray-300"),children:"\u2013"})},Te.id)),v&&jsx("div",{className:"w-12 flex-shrink-0"})]})})(),Se.length===0&&re&&jsx("div",{className:"flex items-center justify-center py-12",children:jsxs("div",{className:"text-center",children:[jsx(List,{className:u("w-12 h-12 mx-auto mb-4",E?"text-white/30":"text-gray-400")}),jsx("p",{className:u(E?"text-white/60":"text-gray-600"),children:_.empty.noResults})]})})]})}),Z?.enabled&&Z.data&&He&&jsx(Fg,{data:Z.data,isDark:E,locale:d,onClose:()=>O(false)})]}),jsx(dg,{state:Et,onClose:Ge,isDark:E,locale:d,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:yt,onColumnSort:gt,availableUsers:i,onOpenTimeLog:a.onOpenTimeLog,onReportBlocker:a.onReportBlocker,onCopyTaskLink:a.onCopyTaskLink}),jsx(Cg,{isOpen:at,onClose:()=>pt(false),onSave:q,isDark:E,locale:d})]})}var Og=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,visible:true,sortable:true,resizable:true},{id:"priority",type:"priority",label:"Priority",width:100,visible:false,sortable:true,resizable:true},{id:"assignees",type:"assignees",label:"Assignees",width:150,visible:false,sortable:false,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true},{id:"tags",type:"tags",label:"Tags",width:150,visible:false,sortable:false,resizable:true},{id:"soldEffortMinutes",type:"soldEffortMinutes",label:"Quoted",width:100,visible:false,sortable:true,resizable:true},{id:"effortMinutes",type:"effortMinutes",label:"Estimated",width:100,visible:false,sortable:true,resizable:true},{id:"timeLoggedMinutes",type:"timeLoggedMinutes",label:"Executed",width:100,visible:false,sortable:true,resizable:true},{id:"scheduleVariance",type:"scheduleVariance",label:"Sched / Var",width:180,visible:false,sortable:true,resizable:true},{id:"hoursBar",type:"hoursBar",label:"Hours",width:200,visible:false,sortable:true,resizable:true},{id:"teamLoad",type:"teamLoad",label:"Team Load",width:160,visible:false,sortable:true,resizable:true},{id:"blockers",type:"blockers",label:"Blockers",width:150,visible:false,sortable:false,resizable:true},{id:"weight",type:"weight",label:"Weight",width:80,visible:false,sortable:true,resizable:true}],$g=[{type:"name",labelKey:"columns.name",icon:"Type"},{type:"status",labelKey:"columns.status",icon:"CircleDot"},{type:"priority",labelKey:"columns.priority",icon:"Flag"},{type:"assignees",labelKey:"columns.assignees",icon:"Users"},{type:"startDate",labelKey:"columns.startDate",icon:"Calendar"},{type:"endDate",labelKey:"columns.endDate",icon:"CalendarCheck"},{type:"progress",labelKey:"columns.progress",icon:"BarChart"},{type:"tags",labelKey:"columns.tags",icon:"Tag"},{type:"effortMinutes",labelKey:"columns.effortMinutes",icon:"Clock"},{type:"timeLoggedMinutes",labelKey:"columns.timeLoggedMinutes",icon:"Timer"},{type:"soldEffortMinutes",labelKey:"columns.soldEffortMinutes",icon:"FileText"},{type:"scheduleVariance",labelKey:"columns.scheduleVariance",icon:"CalendarClock"},{type:"hoursBar",labelKey:"columns.hoursBar",icon:"BarChart3"},{type:"teamLoad",labelKey:"columns.teamLoad",icon:"Users"},{type:"blockers",labelKey:"columns.blockers",icon:"AlertTriangle"},{type:"weight",labelKey:"columns.weight",icon:"Scale"}],Hg=[{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 _d={bgPrimary:"#0D0D0D",bgSecondary:"#141414",bgHover:"rgba(255,255,255,0.05)",bgSelected:"#0D131E",bgAlternate:"#141414",border:"#222222",borderLight:"#1A1A1A",textPrimary:"rgba(255,255,255,0.9)",textSecondary:"rgba(255,255,255,0.6)",textMuted:"rgba(255,255,255,0.3)",accent:"#007BFF",accentHover:"#2979FF",accentLight:"rgba(0,123,255,0.15)",statusTodo:"rgba(255,255,255,0.4)",statusInProgress:"#007BFF",statusCompleted:"#34D399",focusRing:"#007BFF",checkboxBg:"#1A1A1A",checkboxChecked:"#007BFF",bgGroupHeader:"#222222",headerBg:"#1A1A1A",neonRed:"#FF2D20",neonGreen:"#3BF06E",neonAmber:"#FFD60A",neonBlue:"#3B9EFF"},jd={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgSelected:"#dbeafe",bgAlternate:"#f9fafb",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",checkboxBg:"#ffffff",checkboxChecked:"#0969da",bgGroupHeader:"#F3F4F6",headerBg:"#F9FAFB",neonRed:"#DC2626",neonGreen:"#16A34A",neonAmber:"#D97706",neonBlue:"#2E94FF"},Kd={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgSelected:"#0f4c7520",bgAlternate:"#1a1a2e80",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1",checkboxBg:"#1f3460",checkboxChecked:"#6366f1",bgGroupHeader:"#1f3460",headerBg:"#16213e",neonRed:"#EF4444",neonGreen:"#34D399",neonAmber:"#FBBF24",neonBlue:"#6366F1"},Oi={dark:_d,light:jd,neutral:Kd};function zg(e){return Oi[e]||Oi.dark}var Yd={navigation:{today:"Today",previous:"Previous",next:"Next",month:"Month",week:"Week",day:"Day"},weekdays:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},weekdaysFull:{sunday:"Sunday",monday:"Monday",tuesday:"Tuesday",wednesday:"Wednesday",thursday:"Thursday",friday:"Friday",saturday:"Saturday"},months:{january:"January",february:"February",march:"March",april:"April",may:"May",june:"June",july:"July",august:"August",september:"September",october:"October",november:"November",december:"December"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{allDay:"All day",moreEvents:"+{count} more",noEvents:"No tasks",newTask:"New Task",viewAll:"View all",week:"Week",backlogTitle:"BACKLOG / UNSCHEDULED",systemStatus:"SYSTEM STATUS",budgetUtil:"Budget Util.",variance:"VARIANCE",cost:"COST",estimate:"Est",sold:"Sold",cashOut:"Cash Out",typeToAdd:"Type to add (e.g., Crane Inspection)",critical:"CRITICAL",blocker:"Blocker",risk:"Risk",delay:"delay",days:"Days"},tooltips:{progress:"Progress",status:"Status",assignees:"Assignees",duration:"Duration",days:"days"}},qd={navigation:{today:"Hoy",previous:"Anterior",next:"Siguiente",month:"Mes",week:"Semana",day:"D\xEDa"},weekdays:{sun:"Dom",mon:"Lun",tue:"Mar",wed:"Mi\xE9",thu:"Jue",fri:"Vie",sat:"S\xE1b"},weekdaysFull:{sunday:"Domingo",monday:"Lunes",tuesday:"Martes",wednesday:"Mi\xE9rcoles",thursday:"Jueves",friday:"Viernes",saturday:"S\xE1bado"},months:{january:"Enero",february:"Febrero",march:"Marzo",april:"Abril",may:"Mayo",june:"Junio",july:"Julio",august:"Agosto",september:"Septiembre",october:"Octubre",november:"Noviembre",december:"Diciembre"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{allDay:"Todo el d\xEDa",moreEvents:"+{count} m\xE1s",noEvents:"Sin tareas",newTask:"Nueva Tarea",viewAll:"Ver todo",week:"Semana",backlogTitle:"BACKLOG / SIN FECHA",systemStatus:"ESTADO DEL SISTEMA",budgetUtil:"Util. Presupuesto",variance:"VARIANZA",cost:"COSTO",estimate:"Est",sold:"Vendido",cashOut:"Desembolso",typeToAdd:"Escribe para agregar (ej: Inspecci\xF3n)",critical:"CR\xCDTICO",blocker:"Bloqueador",risk:"Riesgo",delay:"retraso",days:"D\xEDas"},tooltips:{progress:"Progreso",status:"Estado",assignees:"Asignados",duration:"Duraci\xF3n",days:"d\xEDas"}},$i={en:Yd,es:qd};function is(e){return $i[e]||$i.en}function Hi(e,t){let a=is(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 Ug(e){let t=is(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 Wg(e,t=0,a=true){let r=is(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 ds(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 Jd(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 _g({task:e,isDark:t}){return e.progress===100||e.status==="completed"?jsx(CheckCircle2,{className:"w-3 h-3 text-emerald-400 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsx(PlayCircle,{className:"w-3 h-3 text-[#007FFF] flex-shrink-0"}):jsx(Circle,{className:u("w-3 h-3 flex-shrink-0",t?"text-white/40":"text-gray-400")})}var Yg=26,lw=22,dw=10;function jg(e,t){let a=Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()),r=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate());return Math.round((a-r)/(1e3*60*60*24))}function Qd(e,t="hours",a=0){if(!e||e<=0)return null;if(t==="financial"&&a>0){let o=Math.round(e/60*a);return o>=1e3?`$${(o/1e3).toFixed(1)}k`:`$${o}`}let r=Math.round(e/480);return r>0?`${r}d`:null}function qg(e,t="hours",a=0){if(e.soldEffortMinutes==null||e.effortMinutes==null)return null;let r=e.soldEffortMinutes-e.effortMinutes;if(r===0)return null;let o=r<0,s;if(t==="financial"&&a>0){let n=Math.round(Math.abs(r/60)*a);s=n>=1e3?`$${(n/1e3).toFixed(1)}k`:`$${n}`;}else {let n=Math.round(Math.abs(r)/60);s=n>=1e3?`$${(n/1e3).toFixed(1)}k`:`$${n}`;}return {text:`${o?"-":"+"}${s}`,isNegative:o}}function Kg(e,t="hours",a=0){if(t==="financial"&&a>0){let o=Math.round(Math.abs(e/60)*a);return o>=1e3?`$${(o/1e3).toFixed(1)}k`:`$${o}`}let r=Math.round(Math.abs(e)/60);return r>=1e3?`$${(r/1e3).toFixed(1)}k`:`$${r}`}function cw({segment:e,isDark:t,onClick:a,blurFinancials:r,isSelected:o,t:s,lens:n="hours",hourlyRate:i=0}){let{task:c,spanCols:l,lane:p,isStart:d,isEnd:m}=e,g=c.progress===100||c.status==="completed",b=c.isCriticalPath,h=d&&m?"rounded":d?"rounded-l":m?"rounded-r":"",v=m?Qd(c.effortMinutes,n,i):null,f=m?qg(c,n,i):null,y=m?c.blockers?.find(w=>w.severity==="critical"):null;return jsxs(motion.button,{onClick:w=>{w.stopPropagation(),a();},whileHover:{scale:1.005},className:u("absolute flex items-center gap-1.5 px-2 text-xs cursor-pointer overflow-hidden",h,g?t?"text-emerald-400":"bg-emerald-500/10 text-emerald-600 border border-emerald-200":b?t?"text-white/90":"bg-red-50 border border-red-200 text-red-700 hover:border-red-300":t?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:{top:`${p*Yg}px`,left:"1px",width:`calc(${l*100}% - 2px)`,height:`${lw}px`,zIndex:10,...t?g?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:b?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:{},borderLeftWidth:d?"3px":void 0,borderLeftColor:d?b?"#EF4444":g?"#10B981":"#1264FF":void 0,...o?{boxShadow:t?"0 0 0 1.5px rgba(0, 229, 255, 0.7), 0 0 12px rgba(0, 229, 255, 0.3)":"0 0 0 1.5px rgba(59, 130, 246, 0.7), 0 0 12px rgba(59, 130, 246, 0.2)",zIndex:20}:{}},children:[b&&d&&jsxs("span",{className:"text-[9px] font-mono font-bold text-red-400 uppercase tracking-wider flex-shrink-0",children:[s.labels.critical,":"]}),jsx("span",{className:"truncate flex-1 text-left font-medium",children:c.name}),m&&(v||f)&&jsxs("span",{className:"flex items-center gap-1 flex-shrink-0 text-[9px] font-mono text-white/35 ml-1",children:[v&&jsxs("span",{children:[s.labels.estimate,": ",v]}),f&&jsxs(Fragment,{children:[jsx("span",{className:"text-white/15",children:"|"}),jsx("span",{className:u(f.isNegative?"text-red-400":"text-emerald-400",r&&"blur-sm select-none"),children:f.text})]})]}),y&&jsxs("span",{className:"flex-shrink-0 text-[8px] font-mono px-1.5 py-0.5 rounded bg-red-500/20 text-red-400 border border-red-500/30 ml-1",children:[s.labels.blocker,": ",y.type]}),c.progress>0&&c.progress<100&&jsx("div",{className:"absolute bottom-0 left-0 h-[2px] bg-[#1264FF]",style:{width:`${c.progress}%`}})]})}function Xg({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:i,availableTags:c=[],onCreateTag:l,attachmentsByTask:p,comments:d,onAddComment:m,currentUser:g,mentionableUsers:b,onUploadCommentAttachments:h,onTaskOpen:v,enableTimeTracking:f,timeTrackingSummary:y,timeEntries:w,timerState:x,onLogTime:C,onUpdateEstimate:k,onUpdateSoldEffort:D,onStartTimer:T,onStopTimer:I,onDiscardTimer:$,blurFinancials:A=false,suppressDetailModal:_=false,lens:E="hours",hourlyRate:me=0}){let{theme:L="dark",locale:X$1="en",customTranslations:Z,showBacklog:He=true}=t,O=Hi(X$1,Z),j=L==="dark"||L==="neutral",[he,je]=useState(r||new Date),[U,re]=useState(null),[ee,Ee]=useState(null),[we,Be]=useState(null),[ze,Qe]=useState({}),te=3,tt=3,pe=useCallback(V=>{Ee(V.id),_||re(V),v?.(V.id);},[_,v]),[at,pt]=useState(null),Et=useCallback(()=>{je(new Date(he.getFullYear(),he.getMonth()-1,1));},[he]),Ce=useCallback(()=>{je(new Date(he.getFullYear(),he.getMonth()+1,1));},[he]),rt=useCallback(()=>{je(new Date);},[]),it=useMemo(()=>{let V=he.getFullYear(),ae=he.getMonth(),Ve=new Date(V,ae,1),De=new Date(V,ae+1,0),Ue=Ve.getDay(),Ne=De.getDate(),Ke=ds(e),bt=new Date;bt.setHours(0,0,0,0);let lt=[],nt=Ue,et=new Date(V,ae,0).getDate();for(let Mt=nt-1;Mt>=0;Mt--){let mt=new Date(V,ae-1,et-Mt);lt.push({date:mt,isCurrentMonth:false,isToday:false,isWeekend:mt.getDay()===0||mt.getDay()===6,events:Ke.filter(yt=>Jd(mt,yt)).map(yt=>({id:yt.id,title:yt.name,start:yt.startDate,end:yt.endDate,task:yt}))});}for(let Mt=1;Mt<=Ne;Mt++){let mt=new Date(V,ae,Mt),yt=mt.getTime()===bt.getTime();lt.push({date:mt,isCurrentMonth:true,isToday:yt,isWeekend:mt.getDay()===0||mt.getDay()===6,events:Ke.filter(gt=>Jd(mt,gt)).map(gt=>({id:gt.id,title:gt.name,start:gt.startDate,end:gt.endDate,task:gt}))});}let At=42-lt.length;for(let Mt=1;Mt<=At;Mt++){let mt=new Date(V,ae+1,Mt);lt.push({date:mt,isCurrentMonth:false,isToday:false,isWeekend:mt.getDay()===0||mt.getDay()===6,events:Ke.filter(yt=>Jd(mt,yt)).map(yt=>({id:yt.id,title:yt.name,start:yt.startDate,end:yt.endDate,task:yt}))});}return lt},[he,e]),Ze=useMemo(()=>ds(e).filter(V=>!V.startDate||!V.endDate),[e]),H=useMemo(()=>{let V=ds(e),ae=0,Ve=0,De=0,Ue=0,Ne=0;V.forEach(et=>{et.effortMinutes&&(ae+=et.effortMinutes),et.soldEffortMinutes&&(Ve+=et.soldEffortMinutes),et.scheduleVariance!=null&&(De+=et.scheduleVariance,Ue++),et.soldEffortMinutes&&et.effortMinutes&&(Ne+=et.soldEffortMinutes-et.effortMinutes);});let Ke=Ve>0?Math.min(100,Math.round(ae/Ve*100)):0,bt=Ue>0?Math.round(De/Ue):0,nt=`${Ne<0?"-":"+"}${Kg(Ne,E,me)}`;return {budgetUtil:Ke,avgVariance:bt,costDisplay:nt,hasCostData:Ve>0}},[e,E,me]),de=useMemo(()=>{let V=[0,0,0,0,0,0];return it.forEach((ae,Ve)=>{let De=Math.floor(Ve/7);ae.events.forEach(Ue=>{if(Ue.task.startDate&&Ue.task.soldEffortMinutes){let Ne=new Date(Ue.task.startDate),Ke=ae.date;Ne.getFullYear()===Ke.getFullYear()&&Ne.getMonth()===Ke.getMonth()&&Ne.getDate()===Ke.getDate()&&De<V.length&&(V[De]-=Ue.task.soldEffortMinutes);}});}),V},[it]),N=useMemo(()=>{let V=ds(e),ae=new Map,Ve=new Set,De=[0,0,0,0,0,0];if(it.length===0)return {segmentsByCell:ae,multiDayTaskIds:Ve,maxLanesPerRow:De};let Ue=nt=>new Date(nt.getFullYear(),nt.getMonth(),nt.getDate()),Ne=Ue(it[0].date),Ke=Ue(it[it.length-1].date),bt=[];for(let nt of V){if(!nt.startDate||!nt.endDate)continue;let et=Ue(nt.startDate),At=Ue(nt.endDate);if(et.getTime()===At.getTime()||At<Ne||et>Ke)continue;let Mt=et<Ne?Ne:et,mt=At>Ke?Ke:At,yt=jg(Mt,Ne),gt=jg(mt,Ne);yt<0||yt>41||gt<0||gt>41||yt!==gt&&(Ve.add(nt.id),bt.push({task:nt,startIdx:yt,endIdx:gt}));}bt.sort((nt,et)=>nt.startIdx!==et.startIdx?nt.startIdx-et.startIdx:et.endIdx-et.startIdx-(nt.endIdx-nt.startIdx));let lt=[[],[],[],[],[],[]];for(let{task:nt,startIdx:et,endIdx:At}of bt){let Mt=Math.floor(et/7),mt=Math.floor(At/7),yt=Ue(nt.startDate),gt=Ue(nt.endDate),Pt=false;for(let Ge=Mt;Ge<=mt;Ge++){let Re=Ge===Mt?et%7:0,ut=Ge===mt?At%7:6,le=ut-Re+1,fe=0,P=lt[Ge]??[];for(lt[Ge]||(lt[Ge]=P);fe<P.length&&(P[fe]??-1)>=Re;)fe++;if(fe>=dw){Pt=true;break}fe>=P.length?P.push(ut):P[fe]=ut,De[Ge]=Math.max(De[Ge]??0,fe+1);let K=Ge===Mt&&yt>=Ne,q=Ge===mt&><=Ke,ce=Ge*7+Re,Se={taskId:nt.id,task:nt,rowIndex:Ge,startCol:Re,endCol:ut,spanCols:le,lane:fe,isStart:K,isEnd:q};ae.has(ce)||ae.set(ce,[]),ae.get(ce).push(Se);}Pt&&(Ve.delete(nt.id),ae.forEach((Ge,Re)=>{let ut=Ge.filter(le=>le.taskId!==nt.id);ut.length===0?ae.delete(Re):ae.set(Re,ut);}));}return {segmentsByCell:ae,multiDayTaskIds:Ve,maxLanesPerRow:De}},[it,e]),Y=X$1==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],ie=he.toLocaleDateString(X$1==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),ke=ie.charAt(0).toUpperCase()+ie.slice(1);return o?jsx("div",{className:u("flex-1 flex items-center justify-center",j?"bg-[#050505]":"bg-white",n),style:i,children:jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#007FFF]"}),jsxs("p",{className:u("text-sm font-mono",j?"text-white/30":"text-gray-600"),children:[O.labels.noEvents,"..."]})]})}):s?jsx("div",{className:u("flex-1 flex items-center justify-center",j?"bg-[#050505]":"bg-white",n),style:i,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:u("w-12 h-12 rounded-full flex items-center justify-center",j?"bg-red-500/10 border border-red-500/20":"bg-red-500/10"),children:jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxs("div",{children:[jsx("h3",{className:u("text-lg font-semibold mb-2",j?"text-white/90":"text-gray-900"),children:"Error"}),jsx("p",{className:u("text-sm",j?"text-white/40":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsx("div",{className:u("flex-1 flex items-center justify-center",j?"bg-[#050505]":"bg-white",n),style:i,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:u("w-16 h-16 mx-auto mb-4 rounded-2xl flex items-center justify-center",j?"bg-[#007FFF]/10 border border-[#007FFF]/20":"bg-blue-500/10"),children:jsx(Calendar,{className:u("w-8 h-8",j?"text-[#007FFF]":"text-blue-500")})}),jsx("h3",{className:u("text-lg font-semibold mb-2",j?"text-white/90":"text-gray-900"),children:O.labels.noEvents}),jsx("p",{className:u("text-sm",j?"text-white/30":"text-gray-600"),children:O.labels.newTask})]})}):jsxs("div",{className:u("flex-1 flex flex-col w-full h-full overflow-hidden",j?"bg-[#050505]":"bg-white",n),style:i,children:[jsxs("div",{className:"flex flex-1 overflow-hidden relative",children:[jsxs("div",{className:"flex-1 flex flex-col min-w-0 relative overflow-hidden",children:[jsxs("div",{className:u("flex-shrink-0 h-10 flex items-center justify-between px-4 z-20",j?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[jsxs("div",{className:u("flex items-center gap-1.5 pl-2.5 pr-2 py-1 rounded-md text-xs transition-all",j?"bg-[#111] border border-white/10":"bg-gray-100 border border-gray-200"),children:[jsx(Calendar,{className:u("w-3.5 h-3.5",j?"text-[#007FFF]":"text-blue-500")}),jsx("span",{className:u("font-medium",j?"text-white":"text-gray-900"),children:X$1==="es"?"Calendario":"Calendar"})]}),jsx("div",{className:u("h-4 w-px",j?"bg-white/10":"bg-gray-200")}),jsxs("div",{className:"flex items-center gap-1.5 select-none",children:[jsx("button",{onClick:Et,className:u("w-6 h-6 flex items-center justify-center rounded transition-colors",j?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-3.5 h-3.5"})}),jsx("span",{className:u("text-sm font-semibold tracking-tight min-w-[150px] text-center",j?"text-white":"text-gray-900"),children:ke}),jsx("button",{onClick:Ce,className:u("w-6 h-6 flex items-center justify-center rounded transition-colors",j?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsx(ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[t.toolbarRightContent&&jsxs(Fragment,{children:[t.toolbarRightContent,jsx("div",{className:u("h-4 w-px",j?"bg-white/10":"bg-gray-200")})]}),jsx("button",{onClick:rt,className:u("px-2.5 py-1 text-xs rounded-md transition-all font-medium",j?"bg-white/5 border border-white/10 text-white/70 hover:bg-white/10 hover:text-white":"bg-gray-100 border border-gray-200 text-gray-700 hover:bg-gray-200"),children:O.navigation.today})]})]}),jsx("div",{className:u("grid grid-cols-7 sticky top-0 z-10",j?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:Y.map(V=>jsx("div",{className:u("py-2 text-center text-[10px] font-bold uppercase tracking-widest",j?"text-white/60 font-mono":"text-gray-500"),children:V},V))}),jsx("div",{className:"flex-1 overflow-y-auto",children:jsx("div",{className:u("grid grid-cols-7 min-h-[800px]",j?"bg-[#050505]":"bg-white"),style:{gridAutoRows:"minmax(140px, auto)"},onClick:()=>Ee(null),children:it.map((V,ae)=>{let Ve=ae%7===6,De=ae>=35;return jsxs("div",{className:u("min-h-[140px] p-2 transition-colors flex flex-col relative group overflow-visible",!Ve&&(j?"border-r border-[#222]":"border-r border-gray-200"),!De&&(j?"border-b border-[#222]":"border-b border-gray-200"),j?V.isCurrentMonth?"bg-[#050505] hover:bg-white/[0.02]":"bg-[#080808] opacity-50":V.isCurrentMonth?"bg-white hover:bg-gray-50":"bg-gray-50 opacity-50",V.isToday&&j&&"ring-1 ring-[#007FFF]/40 ring-inset bg-[#007FFF]/[0.03]",V.isToday&&!j&&"ring-2 ring-blue-500 ring-inset"),children:[jsx("span",{className:u("text-xs font-mono select-none relative z-20",V.isToday?j?"text-[#007FFF] font-bold":"text-blue-600 font-bold":V.isCurrentMonth?j?"text-white/60":"text-gray-900":j?"text-white/20":"text-gray-400"),children:String(V.date.getDate()).padStart(2,"0")}),(()=>{let Ue=Math.floor(ae/7),Ne=(N.maxLanesPerRow[Ue]??0)*Yg,Ke=N.segmentsByCell.get(ae);return Ne===0&&!Ke?null:jsx("div",{className:"relative -mx-2 overflow-visible",style:{minHeight:`${Ne}px`,zIndex:5},children:Ke?.map(bt=>jsx(cw,{segment:bt,isDark:j,blurFinancials:A,isSelected:ee===bt.taskId,t:O,lens:E,hourlyRate:me,onClick:()=>{pe(bt.task),a.onEventClick?.({id:bt.task.id,title:bt.task.name,start:bt.task.startDate,end:bt.task.endDate,task:bt.task});}},bt.taskId))})})(),(()=>{let Ue=V.events.filter(Ne=>Ne.task.isMilestone&&!N.multiDayTaskIds.has(Ne.id));return Ue.length===0?null:jsxs("div",{className:"flex items-center gap-1 mt-0.5 px-0.5",children:[Ue.slice(0,4).map(Ne=>jsx("div",{className:"w-2 h-2 rounded-full bg-red-500 flex-shrink-0 cursor-pointer",title:Ne.title,onClick:Ke=>{Ke.stopPropagation(),pe(Ne.task);}},Ne.id)),Ue.length>4&&jsxs("span",{className:u("text-[8px] font-mono",j?"text-white/30":"text-gray-400"),children:["+",Ue.length-4]})]})})(),(()=>{let Ue=[];V.events.forEach(Ke=>{Ke.task.blockers?.forEach(bt=>{(bt.severity==="warning"||bt.severity==="critical")&&Ue.push({taskId:Ke.id,type:bt.type,severity:bt.severity,variance:Ke.task.scheduleVariance});});});let Ne=Ue[0];return Ne?jsx("div",{className:"mt-0.5 px-0.5",children:jsxs("div",{className:u("text-[8px] font-mono px-1.5 py-0.5 rounded flex items-center gap-1",Ne.severity==="critical"?"bg-red-500/15 text-red-400 border border-red-500/20":"bg-amber-500/15 text-amber-400 border border-amber-500/20"),children:[jsx("span",{children:"\u26A0"}),jsxs("span",{className:"truncate",children:[O.labels.risk,": ",Ne.type,Ne.variance?` (+${Math.abs(Ne.variance)}d ${O.labels.delay})`:""]})]})}):null})(),(()=>{let Ue=V.events.filter(lt=>!N.multiDayTaskIds.has(lt.id)),Ne=ze[ae]||te,Ke=Ue.slice(0,Ne),bt=Ue.length-Ne;return jsxs("div",{className:"mt-1 space-y-0.5 flex-1",children:[Ke.map(lt=>jsxs(motion.button,{onClick:()=>{pe(lt.task),a.onEventClick?.(lt);},whileHover:{scale:1.01},className:u("w-full flex items-center gap-1.5 px-1.5 py-1 rounded text-[11px] transition-all text-left",lt.task.progress===100||lt.task.status==="completed"?j?"text-emerald-400":"bg-emerald-500/10 text-emerald-600":j?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:j?lt.task.progress===100||lt.task.status==="completed"?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:lt.task.isCriticalPath?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:void 0,children:[jsx("span",{className:u("flex-shrink-0 text-[9px]",lt.task.isMilestone?j?"text-amber-400":"text-amber-600":lt.task.isCriticalPath?"text-red-400":j?"text-[#1264FF]":"text-gray-400"),children:lt.task.isMilestone?"\u25C6":"\u25CF"}),jsx("span",{className:"truncate flex-1",children:lt.title})]},lt.id)),bt>0&&jsxs("button",{onClick:lt=>{lt.stopPropagation(),Qe(nt=>({...nt,[ae]:Ne+tt}));},className:u("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",j?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:["+",bt," ",X$1==="es"?"m\xE1s":"more"]}),Ne>te&&Ue.length>te&&jsx("button",{onClick:lt=>{lt.stopPropagation(),Qe(nt=>({...nt,[ae]:te}));},className:u("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",j?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:X$1==="es"?"menos":"less"})]})})(),V.isCurrentMonth&&a.onTaskCreate&&jsx("div",{className:"flex items-center justify-end mt-1",children:(()=>{let Ue=ae>=28,Ne=ae%7>=5;return jsxs("div",{className:"relative",children:[jsx("button",{onClick:Ke=>{Ke.stopPropagation(),pt(at===ae?null:ae);},className:u("w-5 h-5 rounded flex items-center justify-center transition-all",at===ae?"opacity-100 bg-[#007FFF] text-white":"opacity-0 group-hover:opacity-100",j?"hover:bg-[#007FFF] text-white/30 hover:text-white":"hover:bg-blue-500 text-gray-400 hover:text-white"),children:jsx(Plus,{className:u("w-3.5 h-3.5 transition-transform",at===ae&&"rotate-45")})}),jsx(AnimatePresence,{children:at===ae&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>pt(null)}),jsx(motion.div,{initial:{opacity:0,y:Ue?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:Ue?-5:5,scale:.95},transition:{duration:.12},className:u("absolute w-[320px] rounded-lg shadow-2xl z-50",Ue?"bottom-full mb-1":"top-full mt-1",Ne?"right-0":"left-0",j?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08] shadow-[0_8px_32px_rgba(0,0,0,0.6)]":"bg-white border border-gray-200 shadow-xl"),children:jsx(Io,{onSubmit:Ke=>{a.onTaskCreate?.({name:Ke.name,startDate:Ke.startDate||V.date,endDate:Ke.endDate||V.date,priority:Ke.priority,assignees:Ke.assignee?[Ke.assignee]:void 0}),pt(null);},onCancel:()=>pt(null),availableUsers:t.availableUsers,isDark:j,locale:X$1==="es"?"es":"en",defaultDate:V.date,dropdownDirection:Ue?"up":"down"})})]})})]})})()}),ae%7===6&&(()=>{let Ue=Math.floor(ae/7),Ne=de[Ue];if(!Ne||Ne===0)return null;let Ke=Kg(Ne,E,me);return jsxs("div",{className:u("absolute bottom-1 right-2 text-[9px] font-mono font-bold tabular-nums z-20",Ne<0?"text-red-400":"text-emerald-400",A&&"blur-sm select-none"),children:[O.labels.cashOut,": ",Ne<0?"-":"+",Ke]})})()]},ae)})})})]}),He&&jsxs("aside",{className:u("w-[280px] flex-shrink-0 flex flex-col overflow-hidden",j?"bg-[#050505] border-l border-[#222]":"bg-white border-l border-gray-200"),children:[jsxs("div",{className:u("flex-shrink-0 h-14 flex items-center justify-between px-4",j?"bg-[#080808] border-b border-[#222]":"bg-gray-50 border-b border-gray-200"),children:[jsx("span",{className:u("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",j?"text-white/40":"text-gray-500"),children:O.labels.backlogTitle}),jsx("div",{className:"flex items-center gap-2",children:jsx("span",{className:u("text-[10px] font-mono tabular-nums",j?"text-white/20":"text-gray-400"),children:Ze.length})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:Ze.length===0?jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[jsx("div",{className:u("w-10 h-10 rounded-xl flex items-center justify-center mb-3",j?"bg-white/5":"bg-gray-100"),children:jsx(Calendar,{className:u("w-5 h-5",j?"text-white/20":"text-gray-400")})}),jsx("p",{className:u("text-xs font-mono",j?"text-white/20":"text-gray-400"),children:X$1==="es"?"Sin tareas pendientes":"No unscheduled tasks"})]}):Ze.map(V=>jsxs("button",{onClick:()=>{pe(V);},className:u("w-full text-left rounded-md p-3 transition-all group/card",j?"bg-[#0A0A0A] border border-white/[0.05] hover:border-white/[0.12] hover:bg-[#0E0E0E]":"bg-white border border-gray-100 hover:border-gray-200 hover:shadow-sm"),children:[jsxs("div",{className:"flex items-start gap-2 mb-2",children:[jsx("div",{className:u("w-1 h-1 rounded-full mt-1.5 flex-shrink-0",j?"bg-white/20":"bg-gray-300")}),jsx("span",{className:u("text-sm font-medium leading-snug line-clamp-2",j?"text-white/80 group-hover/card:text-white":"text-gray-800"),children:V.name})]}),V.tags&&V.tags.length>0&&jsxs("div",{className:"flex flex-wrap gap-1 ml-3",children:[V.tags.slice(0,3).map(ae=>jsx("span",{className:"text-[9px] font-mono uppercase tracking-wider px-1.5 py-0.5 rounded",style:{backgroundColor:`${ae.color}15`,color:ae.color,border:`1px solid ${ae.color}30`},children:ae.name},ae.id)),V.tags.length>3&&jsxs("span",{className:u("text-[9px] font-mono px-1 py-0.5",j?"text-white/20":"text-gray-400"),children:["+",V.tags.length-3]})]}),(V.effortMinutes||V.soldEffortMinutes)&&jsxs("div",{className:u("flex items-center gap-2 mt-1.5 ml-3 text-[9px] font-mono",j?"text-white/25":"text-gray-400",A&&"blur-sm select-none"),children:[Qd(V.effortMinutes,E,me)&&jsxs("span",{children:[O.labels.estimate,": ",Qd(V.effortMinutes,E,me)]}),(()=>{let ae=qg(V,E,me);return ae?jsx("span",{className:ae.isNegative?"text-red-400":"text-emerald-400",children:ae.text}):null})()]}),jsxs("div",{className:"flex items-center justify-between mt-2 ml-3",children:[jsxs("div",{className:"flex items-center gap-1.5",children:[V.priority&&jsx(Flag,{className:u("w-3 h-3",V.priority==="urgent"||V.priority==="high"?"text-red-400":V.priority==="medium"?"text-yellow-400":"text-green-400")}),jsx(_g,{task:V,isDark:j})]}),V.assignees&&V.assignees.length>0&&jsx("div",{className:"flex -space-x-1",children:V.assignees.slice(0,2).map((ae,Ve)=>jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[8px] font-mono font-bold text-white ring-1 ring-[#050505]",style:{backgroundColor:ae.color||"#007FFF"},title:ae.name,children:ae.initials||ae.name?.slice(0,2).toUpperCase()},Ve))})]})]},V.id))}),a.onTaskCreate&&jsx("div",{className:u("flex-shrink-0 px-3 py-2.5 border-t",j?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:jsx("input",{type:"text",placeholder:O.labels.typeToAdd,className:u("w-full text-[11px] font-mono bg-transparent outline-none",j?"text-white/70 placeholder:text-white/15":"text-gray-700 placeholder:text-gray-400"),onKeyDown:V=>{V.key==="Enter"&&V.target.value.trim()&&(a.onTaskCreate?.({name:V.target.value.trim()}),V.target.value="");}})}),H.hasCostData&&jsxs("div",{className:u("flex-shrink-0 px-4 py-3 border-t space-y-2.5",j?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:[jsxs("div",{className:u("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",j?"text-white/40":"text-gray-500"),children:["\u25C8 ",O.labels.systemStatus]}),jsxs("div",{children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:u("text-[10px] font-mono",j?"text-white/40":"text-gray-500"),children:O.labels.budgetUtil}),jsxs("span",{className:u("text-[10px] font-mono font-bold tabular-nums",j?"text-white/60":"text-gray-700",A&&"blur-sm select-none"),children:[H.budgetUtil,"%"]})]}),jsx("div",{className:u("h-1.5 rounded-full overflow-hidden",j?"bg-white/5":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${H.budgetUtil}%`,background:H.budgetUtil>90?"#EF4444":H.budgetUtil>70?"#F59E0B":"linear-gradient(to right, #2E94FF, #8B5CF6)"}})})]}),jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxs("div",{className:u("rounded-md px-2 py-1.5 text-center",j?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsx("div",{className:u("text-[8px] font-mono uppercase tracking-wider mb-0.5",j?"text-white/25":"text-gray-400"),children:O.labels.variance}),jsxs("div",{className:u("text-[11px] font-mono font-bold tabular-nums",H.avgVariance>0?"text-emerald-400":H.avgVariance<0?"text-red-400":j?"text-white/50":"text-gray-600"),children:[H.avgVariance>0?"+":"",H.avgVariance," ",O.labels.days]})]}),jsxs("div",{className:u("rounded-md px-2 py-1.5 text-center",j?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsx("div",{className:u("text-[8px] font-mono uppercase tracking-wider mb-0.5",j?"text-white/25":"text-gray-400"),children:O.labels.cost}),jsx("div",{className:u("text-[11px] font-mono font-bold tabular-nums",H.costDisplay.startsWith("-")?"text-red-400":"text-emerald-400",A&&"blur-sm select-none"),children:H.costDisplay})]})]})]})]})]}),!_&&jsx(qr,{task:U,isOpen:!!U,onClose:()=>re(null),onTaskUpdate:V=>{a.onTaskUpdate?.(V),re(V);},theme:L==="dark"?"dark":"light",locale:X$1,availableUsers:t.availableUsers?.map(V=>({id:V.id,name:V.name,avatar:V.avatar,initials:V.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:c,onCreateTag:l,attachments:U?p?.get(U.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:ds(e).filter(V=>V.id!==U?.id),comments:d?.filter(V=>V.taskId===U?.id).map(V=>({...V,createdAt:V.createdAt instanceof Date?V.createdAt:new Date(V.createdAt),updatedAt:V.updatedAt instanceof Date?V.updatedAt:V.updatedAt?new Date(V.updatedAt):void 0})),onAddComment:m,currentUser:g,mentionableUsers:b,onUploadCommentAttachments:h,enableTimeTracking:f,timeTrackingSummary:y,timeEntries:w,isTimerRunning:x?.isRunning,timerElapsedSeconds:x?.elapsedSeconds,onTimeLog:C,onEstimateUpdate:k,onSoldEffortUpdate:D,onTimerStart:T,onTimerStop:I,onTimerDiscard:$,blurFinancials:A}),jsx(AnimatePresence,{children:we&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>Be(null),className:"fixed inset-0 bg-black/50 z-40"}),jsxs(motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:u("fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[320px] max-h-[400px] rounded-xl shadow-2xl z-50 overflow-hidden",j?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08]":"bg-white border border-gray-200"),children:[jsxs("div",{className:u("px-4 py-3 border-b flex items-center justify-between",j?"border-white/[0.08] bg-[#080808]":"border-gray-200"),children:[jsx("span",{className:u("font-medium text-sm",j?"text-white/90":"text-gray-900"),children:we.date.toLocaleDateString(X$1==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsx("button",{onClick:()=>Be(null),className:u("p-1 rounded",j?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-4 h-4"})})]}),jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-1.5",children:we.events.map(V=>jsxs("button",{onClick:()=>{Be(null),pe(V.task);},className:u("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",j?"hover:bg-white/5 border border-white/5":"hover:bg-gray-50 border border-gray-100"),children:[jsx(_g,{task:V.task,isDark:j}),jsx("span",{className:u("text-sm truncate flex-1",j?"text-white/80":"text-gray-900"),children:V.title}),(V.task.priority==="high"||V.task.priority==="urgent")&&jsx(Flag,{className:"w-3.5 h-3.5 text-red-400"})]},V.id))})]})]})})]})}var Zd={bgPrimary:"#050505",bgSecondary:"#080808",bgHover:"rgba(255, 255, 255, 0.02)",bgToday:"rgba(0, 127, 255, 0.08)",bgWeekend:"#050505",bgOtherMonth:"#080808",border:"#222222",borderLight:"#1a1a1a",textPrimary:"rgba(255, 255, 255, 0.90)",textSecondary:"rgba(255, 255, 255, 0.60)",textMuted:"rgba(255, 255, 255, 0.30)",textToday:"#007FFF",accent:"#007FFF",accentHover:"#3399FF",accentLight:"rgba(0, 127, 255, 0.15)",statusTodo:"rgba(255, 255, 255, 0.40)",statusInProgress:"#007FFF",statusCompleted:"#34D399",focusRing:"#007FFF",glass:"rgba(20, 20, 20, 0.6)",glassBorder:"rgba(255, 255, 255, 0.08)",glassHover:"rgba(255, 255, 255, 0.05)",neonRed:"#FF2E2E",glowBlue:"0 0 10px rgba(0, 127, 255, 0.3)",glowRed:"0 0 10px rgba(255, 46, 46, 0.4)"},ec={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgToday:"#dbeafe",bgWeekend:"#f9fafb",bgOtherMonth:"#f3f4f680",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",textToday:"#0969da",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",glass:"rgba(255, 255, 255, 0.8)",glassBorder:"rgba(0, 0, 0, 0.08)",glassHover:"rgba(0, 0, 0, 0.04)",neonRed:"#DC2626",glowBlue:"0 0 10px rgba(0, 127, 255, 0.15)",glowRed:"0 0 10px rgba(220, 38, 38, 0.2)"},tc={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgToday:"#6366f120",bgWeekend:"#16213e80",bgOtherMonth:"#1a1a2e50",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",textToday:"#818cf8",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1",glass:"rgba(26, 26, 46, 0.6)",glassBorder:"rgba(255, 255, 255, 0.06)",glassHover:"rgba(255, 255, 255, 0.04)",neonRed:"#EF4444",glowBlue:"0 0 10px rgba(99, 102, 241, 0.3)",glowRed:"0 0 10px rgba(239, 68, 68, 0.3)"},Wi={dark:Zd,light:ec,neutral:tc};function Jg(e){return Wi[e]||Wi.dark}function pw({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:i}){let[c,l]=useState(false),p=useMemo(()=>t.filter(g=>e.cardIds.includes(g.id)),[t,e.cardIds]),d=useMemo(()=>{let g=p.length,b=new Set(p.flatMap(f=>f.assignedUserIds||[])).size,h=p.map(f=>f.priority).filter(Boolean),v=new Set(p.flatMap(f=>f.labels||[])).size;return {totalCards:g,uniqueAssignees:b,priorities:h,labels:v}},[p]),m=()=>{o?.(e.id);};return jsxs("div",{className:u("card-stack",!e.isExpanded&&"card-stack-collapsed",i),onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxs("div",{className:"card-stack-header",onClick:m,children:[jsxs("div",{className:"card-stack-header-left",children:[jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:u("card-stack-chevron",e.isExpanded&&"expanded"),children:jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsx("h3",{className:"card-stack-title",children:e.title}),jsx("div",{className:"card-stack-badge",children:d.totalCards}),jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),c&&jsx("div",{className:"card-stack-actions",children:jsx("button",{className:"card-stack-action",onClick:g=>{g.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(g=>jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsx("div",{onClick:()=>r?.(g),children:a(g)}):jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(g),children:[jsx("h4",{children:g.title}),g.description&&jsxs("p",{children:[g.description.substring(0,100),"..."]})]}),jsx("button",{className:"card-stack-unstack-btn",onClick:b=>{b.stopPropagation(),s?.(e.id,g.id);},"aria-label":"Remove from stack",children:jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},g.id))})})]})}var Zg={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function us(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 ps(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 e0(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 t0({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:i}){let c=useMemo(()=>({...Zg,...n}),[n]),[l,p]=useState(new Set),d=useRef(null),m=useMemo(()=>{if(!c.groupByDay)return [{date:null,events:e}];let y=new Map;return e.forEach(w=>{let x=w.timestamp.toISOString().split("T")[0],C=y.get(x);C?C.push(w):y.set(x,[w]);}),Array.from(y.entries()).sort((w,x)=>x[0].localeCompare(w[0])).map(([w,x])=>({date:new Date(w),events:x.sort((C,k)=>k.timestamp.getTime()-C.timestamp.getTime())}))},[e,c.groupByDay]),{uniqueUsers:g,uniqueTypes:b}=useMemo(()=>{let y=new Set,w=new Set;return e.forEach(x=>{y.add(x.userId),w.add(x.type);}),{uniqueUsers:Array.from(y),uniqueTypes:Array.from(w)}},[e]),h=y=>{p(w=>{let x=new Set(w);return x.has(y)?x.delete(y):x.add(y),x});},v=y=>{let x=new Date().getTime()-y.getTime(),C=Math.floor(x/6e4),k=Math.floor(x/36e5),D=Math.floor(x/864e5);return C<1?"just now":C<60?`${C}m ago`:k<24?`${k}h ago`:D<7?`${D}d ago`:y.toLocaleDateString()},f=useMemo(()=>{let y=0;return t.types&&t.types.length>0&&y++,t.users&&t.users.length>0&&y++,t.dateRange&&y++,t.searchTerm&&y++,y},[t]);return useEffect(()=>{if(s&&d.current){let y=d.current.querySelector(`[data-event-id="${s}"]`);y&&y.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxs("div",{className:u("history-timeline-empty",i),children:[jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxs("div",{className:u("history-timeline",c.compact&&"compact",i),children:[jsxs("div",{className:"history-timeline-filters",children:[jsxs("div",{className:"history-timeline-filter-group",children:[jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:y=>{let w=y.target.value;a({...t,types:w?[w]:void 0});},children:[jsx("option",{value:"",children:"All Events"}),b.map(y=>jsxs("option",{value:y,children:[ps(y)," ",y.replace("_"," ")]},y))]}),g.length>1&&jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:y=>{let w=y.target.value;a({...t,users:w?[w]:void 0});},children:[jsx("option",{value:"",children:"All Users"}),g.map(y=>jsx("option",{value:y,children:y},y))]}),jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:y=>a({...t,searchTerm:y.target.value})})]}),f>0&&jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",f,")"]})]}),jsx("div",{className:"history-timeline-container",ref:d,children:m.map(y=>jsxs("div",{className:"history-timeline-group",children:[c.groupByDay&&y.date&&jsxs("div",{className:"history-timeline-day-header",children:[jsx("span",{className:"history-timeline-day-date",children:y.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxs("span",{className:"history-timeline-day-count",children:[y.events.length," events"]})]}),jsx("div",{className:"history-timeline-events",children:y.events.map((w,x)=>{let C=l.has(w.id),k=s===w.id,D=e0(w.type);return jsxs("div",{"data-event-id":w.id,className:u("history-timeline-event",C&&"expanded",k&&"selected"),onClick:()=>o?.(w),children:[jsxs("div",{className:"history-timeline-line",children:[jsx("div",{className:"history-timeline-dot",style:{backgroundColor:D},children:c.showIcons&&jsx("span",{className:"history-timeline-dot-icon",children:ps(w.type)})}),x<y.events.length-1&&jsx("div",{className:"history-timeline-connector",style:{borderColor:D}})]}),jsxs("div",{className:"history-timeline-event-content",children:[jsxs("div",{className:"history-timeline-event-header",children:[jsxs("div",{className:"history-timeline-event-header-left",children:[c.showAvatars&&w.userAvatar&&jsx("img",{src:w.userAvatar,alt:w.userName||w.userId,className:"history-timeline-event-avatar"}),jsxs("div",{className:"history-timeline-event-description",children:[jsx("span",{className:"history-timeline-event-user",children:w.userName||w.userId}),jsx("span",{className:"history-timeline-event-action",children:us(w)})]})]}),jsx("div",{className:"history-timeline-event-time",children:c.useRelativeTime?v(w.timestamp):w.timestamp.toLocaleString()})]}),Object.keys(w.changes).length>0&&jsxs("button",{className:"history-timeline-event-toggle",onClick:T=>{T.stopPropagation(),h(w.id);},children:[C?"\u25BC":"\u25B6"," Show changes"]}),C&&jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(w.changes).map(([T,I])=>jsxs("div",{className:"history-timeline-event-change",children:[jsxs("span",{className:"history-timeline-event-change-key",children:[T,":"]}),jsxs("div",{className:"history-timeline-event-change-values",children:[jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(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)})]})]},T)),w.metadata&&Object.keys(w.metadata).length>0&&jsxs("div",{className:"history-timeline-event-metadata",children:[jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(w.metadata).map(([T,I])=>jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxs("span",{className:"history-timeline-event-metadata-key",children:[T,":"]}),jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(I)})]},T))]})]})]})]},w.id)})})]},y.date?.toISOString()||"all"))})]})}function r0({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:i,onSpeedChange:c,className:l}){let p=[.5,1,1.5,2,3],d=useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),m=useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxs("div",{className:u("history-replay-empty",l),children:[jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxs("div",{className:u("history-replay",l),children:[jsxs("div",{className:"history-replay-current-event",children:[jsx("div",{className:"history-replay-event-icon",children:d&&ps(d.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:d&&us(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:g=>i(parseInt(g.target.value))}),jsx("div",{className:"history-replay-progress-fill",style:{width:`${m}%`}}),jsx("div",{className:"history-replay-progress-markers",children:t.map((g,b)=>jsx("div",{className:u("history-replay-progress-marker",b===e.currentIndex&&"active"),style:{left:`${b/(e.totalEvents-1)*100}%`},onClick:()=>i(b),title:us(g)},g.id))})]}),jsxs("div",{className:"history-replay-controls",children:[jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick: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(g=>jsxs("button",{className:u("history-replay-speed-btn",e.speed===g&&"active"),onClick:()=>c(g),children:[g,"x"]},g))})]}),jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxs("div",{className:"history-replay-shortcuts",children:[jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2190"})," Previous"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2192"})," Next"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxs("div",{className:"history-replay-card-preview",children:[jsxs("div",{className:"history-replay-card-preview-header",children:[jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsx("span",{className:"history-replay-card-preview-time",children: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(g=>jsx("span",{className:"history-replay-card-preview-label-tag",children:g},g))})]})]})]})]}):jsxs("div",{className:u("history-replay-start",l),children:[jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsx("span",{children:"Start Time Travel"})]}),jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function ac(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 rc(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 o0(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 n0(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function yw(e,t,a,r,o,s=100){let n=e.map(c=>({...c,x:c.x??a/2+Math.random()*100-50,y:c.y??r/2+Math.random()*100-50,vx:0,vy:0})),i=new Map(n.map(c=>[c.id,c]));for(let c=0;c<s;c++){let l=1-c/s;n.forEach(p=>{let d=a/2,m=r/2;p.vx+=(d-p.x)*o.centerForce*l,p.vy+=(m-p.y)*o.centerForce*l,n.forEach(g=>{if(p.id===g.id)return;let b=p.x-g.x,h=p.y-g.y,v=Math.sqrt(b*b+h*h)||1,f=o.chargeStrength*l/(v*v);p.vx+=b/v*f,p.vy+=h/v*f;});}),t.forEach(p=>{let d=i.get(typeof p.source=="string"?p.source:p.source.id),m=i.get(typeof p.target=="string"?p.target:p.target.id);if(!d||!m)return;let g=m.x-d.x,b=m.y-d.y,h=Math.sqrt(g*g+b*b)||1,v=(h-o.linkDistance)/h*o.forceStrength*l;d.vx+=g*v,d.vy+=b*v,m.vx-=g*v,m.vy-=b*v;}),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 s0({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:i,className:c}){let l=useRef(null),[p,d]=useState([]),[m,g]=useState(null),[b,h]=useState(null),[v,f]=useState(null),[y,w]=useState(1),[x,C]=useState({x:0,y:0});useEffect(()=>{if(e.length===0)return;let E=yw(e,t,a.width,a.height,a,150);d(E);},[e,t,a]);let k=useCallback((E,me)=>{a.enableDragging&&(me.stopPropagation(),g(E));},[a.enableDragging]),D=useCallback(E=>{if(!m||!l.current)return;let L=l.current.getBoundingClientRect(),X=(E.clientX-L.left-x.x)/y,Z=(E.clientY-L.top-x.y)/y;d(He=>He.map(O=>O.id===m?{...O,x:X,y:Z,fx:X,fy:Z}:O));},[m,y,x]),T=useCallback(()=>{g(null);},[]),I=useCallback((E,me)=>{me.stopPropagation(),i?.({type:"node-click",node:E,position:{x:me.clientX,y:me.clientY}});},[i]),$=useCallback((E,me)=>{me.stopPropagation(),i?.({type:"edge-click",edge:E,position:{x:me.clientX,y:me.clientY}});},[i]),A=useCallback(E=>{let me=p.find(L=>L.id===E);return me?{x:me.x,y:me.y}:{x:0,y:0}},[p]),_=useCallback(E=>{if(E.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return E.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let me=E.card.priority;return me==="URGENT"?"#ef4444":me==="HIGH"?"#f59e0b":me==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return E.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxs("div",{className:u("relationships-graph-empty",c),children:[jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxs("div",{className:u("relationships-graph",c),children:[jsxs("div",{className:"relationships-graph-controls",children:[jsxs("div",{className:"relationships-graph-stats",children:[jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:n.totalNodes}),jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:n.totalEdges}),jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>w(E=>Math.min(E+.2,3)),children:"+"}),jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(y*100),"%"]}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>w(E=>Math.max(E-.2,.5)),children:"\u2212"}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{w(1),C({x:0,y:0});},children:"Reset"})]})]}),jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(E=>E.type))).map(E=>jsxs("div",{className:"relationships-graph-legend-item",children:[jsx("div",{className:"relationships-graph-legend-color",style:{background:ac(E)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[o0(E)," ",rc(E)]})]},E))}),jsxs("svg",{ref:l,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:D,onMouseUp:T,onMouseLeave:T,children:[jsxs("g",{transform:`translate(${x.x}, ${x.y}) scale(${y})`,children:[jsx("g",{className:"relationships-graph-edges",children:t.map(E=>{let me=A(typeof E.source=="string"?E.source:E.source.id),L=A(typeof E.target=="string"?E.target:E.target.id),X=n0(E.type),Z=v===E.id,He=E.onCriticalPath;return jsxs("g",{className:u("relationships-graph-edge",Z&&"hovered",He&&"critical"),onMouseEnter:()=>f(E.id),onMouseLeave:()=>f(null),onClick:O=>$(E,O),children:[jsx("line",{x1:me.x,y1:me.y,x2:L.x,y2:L.y,stroke:ac(E.type),strokeWidth:He?a.edgeWidth*2:a.edgeWidth,strokeOpacity:Z?1:.6,markerEnd:X?"url(#arrowhead)":void 0}),a.showEdgeLabels&&Z&&jsx("text",{x:(me.x+L.x)/2,y:(me.y+L.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:rc(E.type)})]},E.id)})}),jsx("g",{className:"relationships-graph-nodes",children:p.map(E=>{let me=b===E.id,L=E.onCriticalPath;return jsxs("g",{className:u("relationships-graph-node",me&&"hovered",L&&"critical"),transform:`translate(${E.x}, ${E.y})`,onMouseDown:X=>k(E.id,X),onMouseEnter:()=>h(E.id),onMouseLeave:()=>h(null),onClick:X=>I(E,X),children:[jsx("circle",{r:L?a.nodeSize*1.2:a.nodeSize,fill:_(E),stroke:L?"#fbbf24":"#ffffff",strokeWidth:L?3:2,opacity:me?1:.9}),a.showLabels&&jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:E.card.title.length>20?E.card.title.substring(0,20)+"...":E.card.title})]},E.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 d0({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=useState(""),[i,c]=useState(false),[l,p]=useState(null),[d,m]=useState(null),g=useRef(null),b=i||o;useEffect(()=>{e&&g.current&&g.current.focus();},[e]),useEffect(()=>{let y=w=>{w.key==="Escape"&&!b&&h();};if(e)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[e,b]);let h=()=>{b||(n(""),p(null),m(null),t());},v=async()=>{if(!(!s.trim()||b)){c(true),p(null),m(null);try{let y=await r(s.trim());m(y);}catch(y){p(y instanceof Error?y.message:"Failed to generate plan");}finally{c(false);}}},f=()=>{d&&(a(d),h());};return e?jsxs(Ht,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:h}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:y=>y.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsx("button",{onClick:h,disabled:b,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:d?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),d.explanation&&jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsx("p",{className:"text-sm text-white/90",children:d.explanation})}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",d.columns.length,")"]}),jsx("div",{className:"flex gap-2 flex-wrap",children:d.columns.map((y,w)=>jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:y.title},w))})]}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",d.cards.length,")"]}),jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[d.cards.slice(0,10).map((y,w)=>jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsx("p",{className:"text-sm font-medium text-white/90",children:y.title}),y.description&&jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:y.description})]}),y.priority&&jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${y.priority==="URGENT"?"bg-red-500/20 text-red-400":y.priority==="HIGH"?"bg-orange-500/20 text-orange-400":y.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:y.priority})]})},w)),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:g,value:s,onChange:y=>n(y.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:b}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),l&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:l}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((y,w)=>jsx("button",{onClick:()=>n(y),disabled:b,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:y},w))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:b&&jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:h,disabled:b,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),d?jsx("button",{onClick: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:v,disabled:!s.trim()||b,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#ffffff"},children:b?"Generating...":"Generate Plan"})]})]})]})})]}):null}var oc={"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 vw={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},ww={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 kw(e,t,a){let r=oc[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function ms(e){return `$${e.toFixed(4)}`}var nc=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=kw(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,m)=>d+m.cost,0),s=a.reduce((d,m)=>d+m.inputTokens,0),n=a.reduce((d,m)=>d+m.outputTokens,0),i=a.filter(d=>d.success),c=a.reduce((d,m)=>d+m.duration,0),l={},p={};return a.forEach(d=>{l[d.feature]=(l[d.feature]||0)+1,p[d.feature]=(p[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:l,costsByFeature:p,averageDuration:r>0?c/r:0,successRate:r>0?i.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 i=this.operations.filter(p=>p.timestamp>=n).length,c=Math.max(0,o-i),l=i/o*100;return {used:i,limit:o,remaining:c,percentUsed:l,isExceeded:i>=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)}},Vo=new nc;function p0({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=useState(Vo.getStats()),[s,n]=useState(Vo.checkLimit(a));if(useEffect(()=>{if(!e)return;let c=setInterval(()=>{o(Vo.getStats()),n(Vo.checkLimit(a));},1e3);return ()=>clearInterval(c)},[e,a]),useEffect(()=>{let c=l=>{l.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,t]),!e)return null;let i=Vo.getRecentOperations(5);return jsxs(Ht,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:c=>c.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-blue-500/10 to-purple-500/10 border border-blue-500/30",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:ms(r.totalCost)})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:r.totalOperations})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([c,l])=>{let p=r.costsByFeature[c]||0,d=r.totalOperations>0?l/r.totalOperations*100:0;return jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:c.replace(/([A-Z])/g," $1").trim()}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[l," ops"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:ms(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}%`}})})]},c)})})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),i.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:i.map(c=>jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:c.feature.replace(/([A-Z])/g," $1").trim()}),jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(c.timestamp).toLocaleTimeString()," \u2022"," ",c.duration,"ms"]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[c.inputTokens+c.outputTokens," tokens"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:ms(c.cost)}),jsx("div",{className:`w-2 h-2 rounded-full ${c.success?"bg-green-400":"bg-red-400"}`})]})]},c.id))})]})]}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80",children:"Close"})]})]})})]})}function f0({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,i]=useState(""),[c,l]=useState(""),[p,d]=useState(""),[m,g]=useState(false),[b,h]=useState(null),[v,f]=useState(null),[y,w]=useState(null),x=useRef(null),C=m||o;useEffect(()=>{e&&x.current&&x.current.focus();},[e]),useEffect(()=>{let $=A=>{A.key==="Escape"&&!C&&k();};if(e)return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[e,C]);let k=()=>{C||(i(""),l(""),d(""),h(null),f(null),w(null),t());},D=async()=>{if(!(!n.trim()||C)){g(true),h(null),f(null),w(null);try{let $=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:c||void 0,endDate:p||void 0});f($.tasks.tasks),w({from_cache:$.from_cache,tokens_used:$.tokens_used,mock_mode:$.mock_mode,similarity:$.similarity,tokens_saved:$.tokens_saved});}catch($){h($ instanceof Error?$.message:"Failed to generate tasks");}finally{g(false);}}},T=()=>{v&&(a(v),k());};if(!e)return null;let I=y?.similarity?((y.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:k}),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:$=>$.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:k,disabled:C,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:v?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxs("div",{className:"flex flex-wrap gap-2",children:[y?.mock_mode&&jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),y?.from_cache?jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",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:[y?.tokens_used||0," tokens"]}),y?.tokens_saved&&jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-indigo-500/20 text-indigo-400 border border-indigo-500/30",children:[y.tokens_saved," tokens saved"]}),jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[v.length," tasks"]})]}),jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:v.map(($,A)=>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:["#",A+1]}),jsx("p",{className:"text-sm font-medium text-white/90",children:$.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"})]}),$.start," \u2192 ",$.end]}),jsxs("span",{children:[$.duration," days"]}),$.dependencies.length>0&&jsxs("span",{className:"text-blue-400",children:["Depends: ",$.dependencies.join(", ")]})]})]}),jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${$.priority==="high"?"bg-red-500/20 text-red-400":$.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:$.priority})]})},$.id))})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsx("textarea",{ref:x,value:n,onChange:$=>i($.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:C}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsx("input",{type:"date",value:c,onChange:$=>l($.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:C})]}),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:$=>d($.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:C})]})]}),b&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:b}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map(($,A)=>jsx("button",{onClick:()=>i($),disabled:C,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:$},A))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:C&&jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:k,disabled:C,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),v?jsx("button",{onClick:T,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsx("button",{onClick:D,disabled:!n.trim()||C,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#ffffff"},children:C?"Generating...":"Generate Tasks"})]})]})]})})]})}function _i({initialBoard:e,onPersist:t}){let[a,r]=useState(e),o=useCallback(v=>{t&&Ss(()=>Promise.resolve(t(v)),{maxAttempts:3,initialDelay:1e3,onRetry:(f,y,w)=>{console.warn(`Retry attempt ${y} after ${w}ms: ${f.message}`);}}).then(f=>{f.success||console.error(`Failed to persist board after ${f.attempts} attempts:`,f.error);});},[t]),s=useCallback(async(v,f,y)=>{r(w=>{let x=w.cards.find($=>$.id===v);if(!x)return w;let C=x.columnId,k={...x,columnId:f,position:y},D=w.cards.map($=>$.id===v?k:$),T=w.columns.map($=>{if($.id===C)return {...$,cardIds:$.cardIds.filter(A=>A!==v)};if($.id===f){let A=D.filter(_=>_.columnId===f).sort((_,E)=>_.position-E.position);return {...$,cardIds:A.map(_=>_.id)}}return $}),I={...w,cards:D,columns:T};return o(I),I});},[o]),n=useCallback(async(v,f)=>{r(y=>{let w=y.cards.map(C=>C.id===v?{...C,...f}:C),x={...y,cards:w};return o(x),x});},[o]),i=useCallback(async v=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(y=>{let w={...v,id:f},x=y.columns.map(k=>k.id===v.columnId?{...k,cardIds:[...k.cardIds,f]}:k),C={...y,cards:[...y.cards,w],columns:x};return o(C),C});},[o]),c=useCallback(async v=>{r(f=>{let y=f.cards.find(k=>k.id===v);if(!y)return f;let w=f.cards.filter(k=>k.id!==v),x=f.columns.map(k=>k.id===y.columnId?{...k,cardIds:k.cardIds.filter(D=>D!==v)}:k),C={...f,cards:w,columns:x};return o(C),C});},[o]),l=useCallback(async v=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(y=>{let w={...v,id:f,cardIds:[]},x={...y,columns:[...y.columns,w]};return o(x),x});},[o]),p=useCallback(async(v,f)=>{r(y=>{let w=y.columns.map(C=>C.id===v?{...C,...f}:C),x={...y,columns:w};return o(x),x});},[o]),d=useCallback(async v=>{r(f=>{let y=f.cards.filter(C=>C.columnId!==v),w=f.columns.filter(C=>C.id!==v),x={...f,cards:y,columns:w};return o(x),x});},[o]),m=useCallback(v=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(v),f},[i]),g=useCallback(v=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(v),f},[l]),b=useCallback(()=>{r(v=>{let f={...v,cards:[],columns:[]};return o(f),f});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:i,onCardDelete:c,onColumnCreate:l,onColumnUpdate:p,onColumnDelete:d},setBoard:r,helpers:{addCard:m,addColumn:g,deleteCard:c,deleteColumn:d,clearBoard:b}}}function h0({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=_i({initialBoard:e,onPersist:a}),n=useMemo(()=>({addCard:(c,l,p={})=>{s.addCard({title:l,columnId:c,position:r.cards.filter(d=>d.columnId===c).length,...p});},addColumn:(c,l)=>{let p=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:c,position:l??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 gs={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},x0={by:"none",order:"asc"};function v0({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=useState({...gs,...e}),[s,n]=useState({...x0,...t}),i=useCallback(h=>{o(v=>({...v,...h}));},[]),c=useCallback(h=>{n(v=>({...v,...h}));},[]),l=useCallback(()=>{o(gs),n(x0);},[]),p=useCallback(()=>{a&&o({...gs,assignees:[a]});},[a]),d=useCallback(()=>{o({...gs,dateFilter:"overdue"});},[]),m=useCallback(()=>{o({...gs,priorities:["HIGH","URGENT"]});},[]),g=useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),b=useCallback(h=>{let v=[...h];if(r.search){let f=r.search.toLowerCase();v=v.filter(y=>y.title.toLowerCase().includes(f)||y.description?.toLowerCase().includes(f));}if(r.dateFilter!=="all"){let f=new Date,y=f.getFullYear(),w=String(f.getMonth()+1).padStart(2,"0"),x=String(f.getDate()).padStart(2,"0"),C=`${y}-${w}-${x}`;v=v.filter(k=>{if(!k.endDate&&!k.dueDate)return false;let D=k.endDate||k.dueDate;if(!D)return false;let T;if(typeof D=="string")T=D.split("T")[0]||D;else {let I=D.getUTCFullYear(),$=String(D.getUTCMonth()+1).padStart(2,"0"),A=String(D.getUTCDate()).padStart(2,"0");T=`${I}-${$}-${A}`;}switch(r.dateFilter){case "overdue":return T<C;case "today":return T===C;case "this-week":let I=new Date(C+"T00:00:00"),$=new Date(T+"T00:00:00"),A=new Date(I);return A.setDate(A.getDate()+7),$>=I&&$<=A;case "custom":if(r.dateRange){let _=typeof D=="string"?new Date(D):D;return _>=r.dateRange.start&&_<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(v=v.filter(f=>f.priority&&r.priorities.includes(f.priority))),r.assignees.length>0&&(v=v.filter(f=>(f.assignedUserIds||(f.assigneeId?[f.assigneeId]:[])).some(w=>r.assignees.includes(w)))),r.labels.length>0&&(v=v.filter(f=>f.labels&&f.labels.some(y=>r.labels.includes(y)))),r.columns.length>0&&(v=v.filter(f=>r.columns.includes(f.columnId))),s.by!=="none"&&v.sort((f,y)=>{let w=0;switch(s.by){case "created":let x=f.createdAt?new Date(f.createdAt).getTime():0,C=y.createdAt?new Date(y.createdAt).getTime():0;w=x-C;break;case "priority":let k={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},D=k[f.priority||"LOW"],T=k[y.priority||"LOW"];w=D-T;break;case "dueDate":let I=f.endDate||f.dueDate,$=y.endDate||y.dueDate;if(!I)return 1;if(!$)return -1;let A=typeof I=="string"?new Date(I).getTime():I.getTime(),_=typeof $=="string"?new Date($).getTime():$.getTime();w=A-_;break;case "title":w=f.title.localeCompare(y.title);break;case "estimate":let E=f.estimatedTime||0,me=y.estimatedTime||0;w=E-me;break;default:w=0;}return s.order==="asc"?w:-w}),v},[r,s]);return {filters:r,sort:s,setFilters:i,setSort:c,resetFilters:l,filterMyTasks:p,filterOverdue:d,filterHighPriority:m,applyFilters:b,hasActiveFilters:g}}var k0,C0;if(typeof window<"u")try{let e=Ts("ai");k0=e.generateObject,C0=e.generateText;}catch{}function T0(e={}){let[t,a]=useState(false),[r,o]=useState(null),s=!!(k0&&C0&&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(m){let g=m instanceof Error?m:new Error("Failed to generate plan");throw o(g),g}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("Suggesting assignee for:",d.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(m){let g=m instanceof Error?m:new Error("Failed to suggest assignee");throw o(g),g}finally{a(false);}},[s]),c=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(m){let g=m instanceof Error?m:new Error("Failed to predict risks");throw o(g),g}finally{a(false);}},[s]),l=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("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(m){let g=m instanceof Error?m:new Error("Failed to generate subtasks");throw o(g),g}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(m){let g=m instanceof Error?m:new Error("Failed to estimate effort");throw o(g),g}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:i,onPredictRisks:c,onGenerateSubtasks:l,onEstimateEffort:p,isAvailable:s,isLoading:t,error:r}}function ic(){let[e,t]=useState(()=>selectionStore.getState());useEffect(()=>selectionStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{selectionStore.setState(r);},[]);return [e,a]}function N0(e){let{cards:t}=e,[a,r]=ic(),o=useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=useCallback((d,m)=>{if(!m){r({selectedCardIds:[d],lastSelectedCardId:d});return}let g=m.ctrlKey||m.metaKey,b=m.shiftKey;if(g)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(h=>h!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(b&&a.lastSelectedCardId){let h=t.find(f=>f.id===d),v=t.find(f=>f.id===a.lastSelectedCardId);if(h&&v&&h.columnId===v.columnId){let f=t.filter(T=>T.columnId===h.columnId).sort((T,I)=>T.position-I.position),y=f.findIndex(T=>T.id===a.lastSelectedCardId),w=f.findIndex(T=>T.id===d),[x,C]=y<w?[y,w]:[w,y],k=f.slice(x,C+1).map(T=>T.id),D=Array.from(new Set([...a.selectedCardIds,...k]));r({selectedCardIds:D,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(m=>m!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),i=useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),c=useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),l=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:i,selectAll:c,toggleCard:l,getSelectedCards:p}}var D0={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function S0(e){let{cards:t,config:a,aiService:r}=e,o=useMemo(()=>({...D0,...a}),[a]),[s,n]=useState([]),i=useCallback((h,v,f,y,w)=>{if(v.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let x={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:h,cardIds:v,columnId:f,strategy:y,color:w,isExpanded:true,position:s.filter(C=>C.columnId===f).length,createdAt:new Date};n(C=>[...C,x]);},[o.minCardsPerStack,s]),c=useCallback(h=>{n(v=>v.filter(f=>f.id!==h));},[]),l=useCallback(h=>{n(v=>v.map(f=>f.id===h?{...f,isExpanded:!f.isExpanded}:f));},[]),p=useCallback((h,v)=>{n(f=>f.map(y=>y.id===h&&!y.cardIds.includes(v)?{...y,cardIds:[...y.cardIds,v]}:y));},[]),d=useCallback((h,v)=>{n(f=>f.map(y=>{if(y.id===h){let w=y.cardIds.filter(x=>x!==v);return w.length<o.minCardsPerStack?null:{...y,cardIds:w}}return y}).filter(y=>y!==null));},[o.minCardsPerStack]),m=useCallback(h=>s.filter(v=>v.columnId===h).sort((v,f)=>v.position-f.position),[s]),g=useCallback(async h=>{let v=t.filter(C=>C.columnId===h);if(v.length<o.minCardsPerStack*2)return [];let f=[],y=new Map;v.forEach(C=>{C.labels&&C.labels.length>0&&C.labels.forEach(k=>{y.has(k)||y.set(k,[]),y.get(k).push(C);});}),y.forEach((C,k)=>{C.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F4CC} ${k}`,cardIds:C.map(D=>D.id),columnId:h,strategy:"labels",color:"#3b82f6"},reason:`${C.length} cards with label "${k}"`,confidence:.85});});let w=new Map;v.forEach(C=>{C.assignedUserIds&&C.assignedUserIds.length>0&&C.assignedUserIds.forEach(k=>{w.has(k)||w.set(k,[]),w.get(k).push(C);});}),w.forEach((C,k)=>{C.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F464} Assigned to user-${k.slice(-4)}`,cardIds:C.map(D=>D.id),columnId:h,strategy:"assignee",color:"#8b5cf6"},reason:`${C.length} cards assigned to the same user`,confidence:.8});});let x=new Map;if(v.forEach(C=>{C.priority&&(x.has(C.priority)||x.set(C.priority,[]),x.get(C.priority).push(C));}),x.forEach((C,k)=>{if(C.length>=o.minCardsPerStack){let D={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[k.toLowerCase()]||"\u26AA";f.push({stack:{title:`${D} ${k} Priority`,cardIds:C.map(T=>T.id),columnId:h,strategy:"priority",color:k==="high"||k==="urgent"?"#ef4444":"#10b981"},reason:`${C.length} cards with ${k} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let C of v){let D=(await r.findSimilar(C,v)).filter(T=>T.similarity>=o.autoStackConfidenceThreshold);if(D.length>=o.minCardsPerStack-1){let T=[C.id,...D.map($=>$.card.id)],I=D.reduce(($,A)=>$+A.similarity,0)/D.length;f.push({stack:{title:`\u2728 Similar to "${C.title.substring(0,30)}${C.title.length>30?"...":""}"`,cardIds:T,columnId:h,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${D.length+1} similar tasks`,confidence:I});}}return f.filter(C=>C.confidence>=o.autoStackConfidenceThreshold).sort((C,k)=>k.confidence-C.confidence).slice(0,5)},[t,o,r]),b=useCallback(h=>{i(h.stack.title,h.stack.cardIds,h.stack.columnId,h.stack.strategy,h.stack.color);},[i]);return useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(v=>v.columnId)).forEach(async v=>{let f=await g(v),y=f[0];f.length>0&&y&&y.confidence>=.9&&b(y);});},[]),{stacks:s,createStack:i,deleteStack:c,toggleStack:l,addToStack:p,removeFromStack:d,getStacksForColumn:m,getSuggestions:g,applySuggestion:b,config:o}}var E0=createContext(null);function F0({children:e,initialData:t,onStateChange:a}){let r=useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(c=>{let{Column:l}=Ts("@libxai/core");s.set(c.id,new l(c));}),t?.cards?.forEach(c=>{let{Card:l}=Ts("@libxai/core");n.set(c.id,new l(c));});let i=null;if(t?.board){let{Board:c}=Ts("@libxai/core");i=new c(t.board);}r.current=new BoardStore({board:i,columns:s,cards:n});}let o=r.current;return useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsx(E0.Provider,{value:{store:o},children:e})}function ji(){let e=useContext(E0);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function bs(){let e=ji(),[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 i=useCallback(y=>{e.updateBoard(y);},[e]),c=useCallback(y=>{e.addColumn(y);},[e]),l=useCallback((y,w)=>{e.updateColumn(y,w);},[e]),p=useCallback(y=>{e.deleteColumn(y);},[e]),d=useCallback(y=>e.getColumn(y),[e]),m=useCallback(y=>{e.addCard(y);},[e]),g=useCallback((y,w)=>{e.updateCard(y,w);},[e]),b=useCallback(y=>{e.deleteCard(y);},[e]),h=useCallback((y,w,x)=>{e.moveCard(y,w,x);},[e]),v=useCallback(y=>e.getCard(y),[e]),f=useCallback(y=>e.getCardsByColumn(y),[e]);return {board:t,columns:r,cards:s,updateBoard:i,addColumn:c,updateColumn:l,deleteColumn:p,getColumn:d,addCard:m,updateCard:g,deleteCard:b,moveCard:h,getCard:v,getCardsByColumn:f}}function P0(e){let{cards:t}=bs();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 A0(e="position",t="asc"){let{cards:a}=bs();return useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let i={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},c=o.priority?i[o.priority]:0,l=s.priority?i[s.priority]:0;n=c-l;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 Ki=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Yc.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 i=await Promise.resolve(n.apply(s,a));i!==void 0&&(o=i,a[0]=i);}catch(i){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,i,{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);}},Hw=new Ki;function I0({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:i=0,getItemKey:c}){let l=useRef(null),p=useVirtualizer({count:e.length,getScrollElement:()=>l.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:i}),d=p.getVirtualItems(),m={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},g=n?{width:`${p.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${p.getTotalSize()}px`,width:"100%",position:"relative"};return jsx("div",{ref:l,style:m,className:o,children:jsx("div",{style:g,children:d.map(b=>{let h=e[b.index];if(!h)return null;let v=c?c(h,b.index):b.index,f={position:"absolute",top:n?0:b.start,left:n?b.start:0,width:n?b.size:"100%",height:n?"100%":b.size};return jsx("div",{style:f,"data-index":b.index,children:r(h,b.index)},v)})})})}function B0(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 O0({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:i=16,getItemKey:c,horizontal:l=true}){let p=useRef(null),d=useVirtualizer({horizontal:l,count:e.length,getScrollElement:()=>p.current,estimateSize:()=>r,overscan:n,gap:i}),m=d.getVirtualItems(),g={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},b={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsx("div",{ref:p,style:g,className:s,children:jsx("div",{style:b,children:m.map(h=>{let v=e[h.index];if(!v)return null;let f=c?c(v,h.index):h.index,y={position:"absolute",top:0,left:h.start,width:h.size,height:"100%"};return jsx("div",{style:y,"data-index":h.index,children:o(v,h.index)},f)})})})}function $0(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 H0(e,t=10){return e>t}var uc={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},pc={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},mc={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},gc={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},fc={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},bc={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},hc={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},yc={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)"},xc={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)"},vc={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},wc={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}},kc={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}},Yi={spacing:uc,borderRadius:pc,fontSize:mc,fontWeight:gc,lineHeight:fc,zIndex:bc,duration:hc,easing:yc,shadows:xc,opacity:vc,kanban:wc,gantt:kc};function z0(e,t,a){return e[t]??a}function Cc(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)?Cc(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function Ww(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Tc(e="asakaa"){let t=Cc(Yi),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=Ww(o);a.push(` ${s}: ${n};`);}return `:root {
|
|
413
|
+
Today's date: ${new Date().toISOString().split("T")[0]}`}function xm(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function to(e,t){let a=xm(e),r=t.toLowerCase().trim(),o=a.find(i=>i.name.toLowerCase()===r);if(o)return o;let s=a.find(i=>i.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(i=>{let c=i.name.toLowerCase();return n.every(l=>c.includes(l))})}function Cd(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 m=new Date(r);return m.setDate(m.getDate()+1),m}if(a==="yesterday"||a==="ayer"){let m=new Date(r);return m.setDate(m.getDate()-1),m}if(a==="next week"||a==="la pr\xF3xima semana"){let m=new Date(r);return m.setDate(m.getDate()+7),m}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 g={sunday:0,domingo:0,monday:1,lunes:1,tuesday:2,martes:2,wednesday:3,mi\u00E9rcoles:3,miercoles:3,thursday:4,jueves:4,friday:5,viernes:5,saturday:6,s\u00E1bado:6,sabado:6}[o[1].toLowerCase()];if(g!==void 0){let b=new Date(r),h=b.getDay(),v=g-h;return v<=0&&(v+=7),b.setDate(b.getDate()+v),b}}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 m=parseInt(s[1],10),g=s[2].toLowerCase(),b=new Date(r);return g==="day"||g==="d\xEDa"||g==="dias"?b.setDate(b.getDate()+m):g==="week"||g==="semana"||g==="semanas"?b.setDate(b.getDate()+m*7):(g==="month"||g==="mes"||g==="meses")&&b.setMonth(b.getMonth()+m),b}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let i=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(i&&i[1]&&i[2]&&i[3]){let m=parseInt(i[1],10),g=parseInt(i[2],10)-1,b=parseInt(i[3],10);return new Date(b,g,m)}let c={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},l=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(l&&l[1]&&l[2]){let m=parseInt(l[1],10),g=c[l[2].toLowerCase()],b=l[3]?parseInt(l[3],10):r.getFullYear();if(g!==void 0)return new Date(b,g,m)}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 m=p[d[1].toLowerCase()],g=parseInt(d[2],10),b=d[3]?parseInt(d[3],10):r.getFullYear();if(m!==void 0)return new Date(b,m,g)}return null}function Td(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 Nd(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 wm(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let l=r[1].trim(),p=r[2].trim(),d=to(t,l),m=Cd(p);if(!d)return {type:"move_task",taskName:l,message:`Could not find a task named "${l}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!m)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 g=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,b=new Date(m);return b.setDate(b.getDate()+g),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:m,endDate:b},message:`Moved "${d.name}" to ${m.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let l=o[1].trim(),p=o[2].trim(),d=to(t,l),m=Td(p);if(!d)return {type:"resize_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"};if(!m||!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 g=new Date(d.endDate);return g.setDate(g.getDate()+m),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:g},message:`Extended "${d.name}" by ${m} days. New end date: ${g.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let l=s[1].trim(),p=s[2].trim(),d=to(t,l),m=Nd(p);return d?m===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:m},message:`Set "${d.name}" progress to ${m}%.`,success:true}:{type:"set_progress",taskName:l,message:`Could not find a task named "${l}".`,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 l=n[1].trim(),p=n[2].trim(),d=to(t,l);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:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}let i=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(i&&i[1]&&i[2]){let l=i[1].trim(),p=i[2].trim(),d=to(t,l),m=to(t,p);return d?m?{type:"link_tasks",taskId:m.id,taskName:m.name,dependencyFrom:d.id,dependencyTo:m.id,message:`Linked "${d.name}" \u2192 "${m.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:l,message:`Could not find a task named "${l}".`,success:false,error:"Source task not found"}}let c=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]){let l=c[1].trim(),p=to(t,l);return p?{type:"delete_task",taskId:p.id,taskName:p.name,message:`Deleted "${p.name}".`,success:true}:{type:"delete_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}return null}function 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 Xv(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 Jv(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Ni(e,t=[],a=[]){let r=e.assignedUserIds?.map(p=>{let d=a.find(m=>m.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=>Ni(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},i=n(e.startDate),c=n(e.endDate),l=e.metadata?.isMilestone===true||i&&c&&Math.abs(c.getTime()-i.getTime())<=864e5;return {id:e.id,name:e.title,startDate:i,endDate:c,progress:e.progress||0,status:Xv(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:l,isCriticalPath:e.metadata?.isCriticalPath===true}}function Cm(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:Jv(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function Tm(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Ni(r,e,t))}var Dd={columns:{name:"Task ID / Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Executed",tags:"Tags",scheduleVariance:"Sched / Var",hoursBar:"Hours (Spent / Allocated)",teamLoad:"Team Load",blockers:"Blockers",weight:"Weight"},toolbar:{search:"Search",searchPlaceholder:"Search tasks...",filter:"Filter",clearFilters:"Clear Filters",export:"Export",columns:"Columns",newTask:"New Task"},filters:{status:"Status",assignees:"Assignees",dateRange:"Date Range",showCompleted:"Show Completed",all:"All",none:"None"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",viewDetails:"View Details"},empty:{noTasks:"No tasks yet",noResults:"No tasks match your filters",addFirstTask:"Add your first task"},pagination:{showing:"Showing",of:"of",tasks:"tasks",previous:"Previous",next:"Next"},bulk:{selected:"selected",delete:"Delete",move:"Move to",assignTo:"Assign to"}},Sd={columns:{name:"ID Tarea / Nombre",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",tags:"Etiquetas",scheduleVariance:"Prog / Var",hoursBar:"Horas (Usado / Asignado)",teamLoad:"Equipo",blockers:"Bloqueantes",weight:"Peso"},toolbar:{search:"Buscar",searchPlaceholder:"Buscar tareas...",filter:"Filtrar",clearFilters:"Limpiar Filtros",export:"Exportar",columns:"Columnas",newTask:"Nueva Tarea"},filters:{status:"Estado",assignees:"Asignados",dateRange:"Rango de Fechas",showCompleted:"Mostrar Completadas",all:"Todos",none:"Ninguno"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",viewDetails:"Ver Detalles"},empty:{noTasks:"Sin tareas a\xFAn",noResults:"Ninguna tarea coincide con los filtros",addFirstTask:"Agrega tu primera tarea"},pagination:{showing:"Mostrando",of:"de",tasks:"tareas",previous:"Anterior",next:"Siguiente"},bulk:{selected:"seleccionadas",delete:"Eliminar",move:"Mover a",assignTo:"Asignar a"}},Di={en:Dd,es:Sd};function Ed(e){return Di[e]||Di.en}function Si(e,t){let a=Ed(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 Fd=[{value:"todo",icon:Circle,color:"text-gray-400"},{value:"in-progress",icon:PlayCircle,color:"text-[#3B9EFF]"},{value:"completed",icon:CheckCircle2,color:"text-[#3BF06E]"}];function Nm(e){let t=e?.toLowerCase()||"todo";return t==="inprogress"||t==="in-progress"||t==="in_progress"?"in-progress":t==="completed"||t==="done"||t==="complete"?"completed":"todo"}function Dm({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=useState(false),i=useRef(null);useEffect(()=>{let g=b=>{i.current&&!i.current.contains(b.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]);let c=Nm(e),l=Fd[0],p=Fd.find(g=>g.value===c)??l,d=p.icon,m=g=>{switch(Nm(g)){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return o||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(d,{className:u("w-4 h-4 flex-shrink-0",p.color)}),jsx("span",{className:u("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:m(e)})]}):jsxs("div",{ref:i,className:"relative",children:[jsxs("button",{onClick:g=>{g.stopPropagation(),n(!s);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(d,{className:u("w-4 h-4 flex-shrink-0",p.color)}),jsx("span",{className:u("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:m(e)}),jsx(ChevronDown,{className:u("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:u("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:Fd.map(g=>{let b=g.icon;return jsxs("button",{onClick:h=>{h.stopPropagation(),t(g.value),n(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",c===g.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx(b,{className:u("w-4 h-4",g.color)}),jsx("span",{className:a?"text-white":"text-gray-900",children:m(g.value)})]},g.value)})})]})}var Md=[{value:"urgent",label:{en:"Urgent",es:"Urgente"},color:"text-[#FF2D20]",bg:"bg-[#FF2D20]"},{value:"high",label:{en:"High",es:"Alta"},color:"text-[#FF2D20]",bg:"bg-[#FF2D20]"},{value:"medium",label:{en:"Medium",es:"Media"},color:"text-[#FFD60A]",bg:"bg-[#FFD60A]"},{value:"low",label:{en:"Low",es:"Baja"},color:"text-[#3B9EFF]",bg:"bg-[#3B9EFF]"},{value:"none",label:{en:"None",es:"Ninguna"},color:"text-gray-400",bg:"bg-gray-400"}];function Em({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=useState(false),i=useRef(null);useEffect(()=>{let p=d=>{i.current&&!i.current.contains(d.target)&&n(false);};return s&&document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]);let c=Md.find(p=>p.value===e)??Md[4],l=r==="es"?"es":"en";return o||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(Flag,{className:u("w-4 h-4",c.color)}),jsx("span",{className:u("text-sm",a?"text-white/60":"text-gray-500"),children:c.label[l]})]}):jsxs("div",{ref:i,className:"relative",children:[jsxs("button",{onClick:p=>{p.stopPropagation(),n(!s);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(Flag,{className:u("w-4 h-4",c.color)}),jsx("span",{className:u("text-sm",a?"text-white/60":"text-gray-500"),children:c.label[l]}),jsx(ChevronDown,{className:u("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:u("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:Md.map(p=>jsxs("button",{onClick:d=>{d.stopPropagation(),t(p.value),n(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===p.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("div",{className:u("w-2 h-2 rounded-full",p.bg)}),jsx("span",{className:a?"text-white":"text-gray-900",children:p.label[l]})]},p.value))})]})}function as(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Pd(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 Am({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false}){let[n,i]=useState(false),[c,l]=useState(""),p=useRef(null),d=useRef(null);useEffect(()=>{let h=v=>{p.current&&!p.current.contains(v.target)&&(i(false),l(""));};return n&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[n]),useEffect(()=>{n&&d.current&&d.current.focus();},[n]);let m=t.filter(h=>h.name.toLowerCase().includes(c.toLowerCase())),g=h=>e.some(v=>v.name===h),b=h=>{if(a){if(g(h.name))a(e.filter(v=>v.name!==h.name));else {let v={name:h.name,initials:as(h.name),color:h.color||Pd(h.name).replace("bg-","").replace("-500",""),avatar:h.avatarUrl,id:h.id};a([...e,v]);}i(false),l("");}};return s||!a?e.length===0?jsx("span",{className:u("text-sm",r?"text-white/30":"text-gray-400"),children:"-"}):jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((h,v)=>jsx("div",{className:u("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0D0D0D]":"border-white",!h.avatar&&Pd(h.name)),style:h.color&&!h.avatar?{backgroundColor:h.color}:void 0,title:h.name,children:h.avatar?jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials||as(h.name)},`${h.name}-${v}`)),e.length>3&&jsxs("div",{className:u("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#1A1A1A] border-[#0D0D0D] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxs("div",{ref:p,className:"relative",children:[jsx("button",{onClick:h=>{h.stopPropagation(),i(!n);},className:u("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:e.length===0?jsxs(Fragment,{children:[jsx(User,{className:u("w-4 h-4",r?"text-white/30":"text-gray-400")}),jsx(Plus,{className:u("w-3 h-3",r?"text-white/30":"text-gray-400")})]}):jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((h,v)=>jsx("div",{className:u("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0D0D0D]":"border-white",!h.avatar&&Pd(h.name)),style:h.color&&!h.avatar?{backgroundColor:h.color}:void 0,children:h.avatar?jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials||as(h.name)},`${h.name}-${v}`)),e.length>2&&jsxs("span",{className:u("text-xs ml-1",r?"text-white/60":"text-gray-500"),children:["+",e.length-2]})]})}),n&&jsxs("div",{className:"absolute z-50 top-full left-0 mt-1.5 rounded-lg overflow-hidden",style:{width:260,backgroundColor:r?"rgba(17, 17, 17, 0.98)":"rgba(255, 255, 255, 0.98)",border:`1px solid ${r?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.1)"}`,boxShadow:r?"0 8px 24px rgba(0,0,0,0.5)":"0 8px 24px rgba(0,0,0,0.12)"},children:[jsxs("div",{className:"flex items-center gap-1.5",style:{padding:"8px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:[jsx(Search,{className:"flex-shrink-0",style:{width:14,height:14,color:r?"rgba(255,255,255,0.20)":"#94A3B8"}}),jsx("input",{ref:d,type:"text",value:c,onChange:h=>l(h.target.value),placeholder:o==="es"?"Buscar miembros...":"Search members...",onClick:h=>h.stopPropagation(),style:{flex:1,fontSize:12,color:r?"rgba(255,255,255,0.92)":"#0F172A",backgroundColor:"transparent",border:"none",outline:"none",fontFamily:"Inter, sans-serif"}})]}),e.length>0&&jsx("div",{className:"flex flex-wrap gap-1",style:{padding:"6px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:e.map((h,v)=>jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:h.color?`${h.color}20`:r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:h.color||(r?"#fff":"#334155")},children:[jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:h.color||"#3B82F6",fontSize:8,fontWeight:700,color:"#fff"},children:h.avatar?jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials||as(h.name)}),h.name.split(" ")[0],jsx("button",{onClick:f=>{f.stopPropagation(),a(e.filter(y=>y.name!==h.name));},className:"flex items-center justify-center",style:{width:14,height:14,borderRadius:3,border:"none",background:"transparent",color:"inherit",cursor:"pointer",opacity:.7},children:jsx(X,{style:{width:10,height:10}})})]},`${h.name}-${v}`))}),jsx("div",{style:{maxHeight:200,overflowY:"auto",padding:4},children:m.length===0?jsx("div",{style:{padding:"12px 10px",fontSize:12,color:r?"rgba(255,255,255,0.35)":"#94A3B8",textAlign:"center"},children:o==="es"?"No se encontraron miembros":"No members found"}):m.map(h=>{let v=g(h.name);return jsxs("button",{onClick:f=>{f.stopPropagation(),b(h);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:v?r?"rgba(0, 127, 255, 0.12)":"rgba(59, 130, 246, 0.08)":"transparent",color:r?"rgba(255,255,255,0.92)":"#0F172A",fontSize:12,textAlign:"left",transition:"background-color 0.1s"},onMouseEnter:f=>{v||(f.currentTarget.style.backgroundColor=r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:f=>{v||(f.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:24,height:24,borderRadius:"50%",backgroundColor:h.color||"#3B82F6",fontSize:9,fontWeight:700,color:"#fff"},children:h.avatarUrl?jsx("img",{src:h.avatarUrl,alt:h.name,className:"w-full h-full rounded-full object-cover"}):as(h.name)}),jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:h.name}),v&&jsx("div",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:4,backgroundColor:"rgba(96, 165, 250, 0.2)"},children:jsx("div",{style:{width:8,height:8,borderRadius:2,backgroundColor:"#60A5FA"}})})]},h.id)})})]})]})}function Bm({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:o="end",isDark:s,locale:n,disabled:i=false,placeholder:c}){let[l,p]=useState(false),[d,m]=useState(o),[g,b]=useState(()=>{let S=o==="start"?e:t;if(S){let C=S instanceof Date?S:new Date(S);return new Date(C.getFullYear(),C.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),h=useRef(null),v=e?e instanceof Date?e:new Date(e):null,f=t?t instanceof Date?t:new Date(t):null;useEffect(()=>{let S=C=>{h.current&&!h.current.contains(C.target)&&p(false);};return l&&document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[l]),useEffect(()=>{l&&m(r?o:"start");},[l,r,o]);let y=S=>S?S.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):c||"-",w=useCallback(()=>{let S=g.getFullYear(),C=g.getMonth(),I=new Date(S,C,1),A=new Date(S,C+1,0).getDate(),_=I.getDay(),E=[],L=new Date(S,C,0).getDate();for(let ee=_-1;ee>=0;ee--)E.push({date:new Date(S,C-1,L-ee),isCurrentMonth:false});for(let ee=1;ee<=A;ee++)E.push({date:new Date(S,C,ee),isCurrentMonth:true});let X=42-E.length;for(let ee=1;ee<=X;ee++)E.push({date:new Date(S,C+1,ee),isCurrentMonth:false});return E},[g]),x=S=>{if(r)o==="start"?a(S,f||void 0):a(v||void 0,S),p(false);else if(d==="start"){let C=f&&S>f?S:f;a(S,C||void 0),m("end");}else {let C=v&&S<v?S:v;a(C||void 0,S),p(false);}},T=()=>{let S=new Date,C=new Date(S);C.setDate(S.getDate()+1);let I=new Date(S);I.setDate(S.getDate()+((6-S.getDay()+7)%7||7));let $=new Date(S);$.setDate(S.getDate()+((1-S.getDay()+7)%7||7));let A=new Date(S);A.setDate(S.getDate()+(6-S.getDay()+7)%7+7);let _=new Date(S);_.setDate(S.getDate()+14);let E=new Date(S);return E.setDate(S.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:S,display:S.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:C,display:C.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:I,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:$,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:A,display:A.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:_,display:_.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:E,display:E.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(i){let S=r&&o==="start"?v:f;return jsxs("div",{className:"flex items-center gap-2",children:[jsx(Calendar,{className:u("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:u("text-sm",s?"text-white/60":"text-gray-500"),children:y(S)})]})}let k=r&&o==="start"?v:f;return jsxs("div",{ref:h,className:"relative",children:[jsxs("button",{onClick:S=>{S.stopPropagation(),p(!l);let C=o==="start"?v:f;C&&b(new Date(C.getFullYear(),C.getMonth(),1));},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(Calendar,{className:u("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:u("text-sm",s?"text-white/60":"text-gray-500"),children:y(k)})]}),l&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>p(false)}),jsxs("div",{className:u("absolute z-50 top-full left-0 mt-1 rounded-xl shadow-2xl overflow-hidden flex",s?"bg-[#1A1A1A] border border-[#222]":"bg-white border border-gray-200"),onClick:S=>S.stopPropagation(),children:[jsxs("div",{className:u("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[T().map((S,C)=>jsxs("button",{className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>x(S.date),children:[jsx("span",{children:S.label}),jsx("span",{className:u("text-xs",s?"text-white/30":"text-gray-400"),children:S.display})]},C)),jsx("div",{className:u("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxs("button",{onClick:()=>{r?o==="start"?a(void 0,f||void 0):a(v||void 0,void 0):a(void 0,void 0),p(false);},className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:n==="es"?"Quitar fecha":"Clear date"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[!r&&jsx("div",{className:u("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/[0.03] text-white/60":"bg-gray-100 text-gray-600"),children:d==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("span",{className:u("font-medium",s?"text-white":"text-gray-900"),children:g.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>b(new Date),className:u("p-1 rounded text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>b(new Date(g.getFullYear(),g.getMonth()-1)),className:u("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:u("w-4 h-4",s?"text-white":"text-gray-600")})}),jsx("button",{onClick:()=>b(new Date(g.getFullYear(),g.getMonth()+1)),className:u("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:u("w-4 h-4",s?"text-white":"text-gray-600")})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(S=>jsx("div",{className:u("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:S},S))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:w().map((S,C)=>{let I=S.date.toDateString()===new Date().toDateString(),$=v?.toDateString()===S.date.toDateString(),A=f?.toDateString()===S.date.toDateString(),_=$||A,E=!r&&v&&f&&S.date>=v&&S.date<=f;return jsx("button",{onClick:()=>x(new Date(S.date)),className:u("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!S.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),S.isCurrentMonth&&(s?"text-white":"text-gray-900"),I&&"ring-2 ring-[#007BFF]",$&&"bg-[#007BFF] text-white",A&&!$&&"bg-[#7C3AED] text-white",E&&!_&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!_&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:S.date.getDate()},C)})})]})]})]})]})}function Mi({value:e,onChange:t,isDark:a,locale:r,disabled:o=false,dateField:s="end",startDate:n,endDate:i}){let c=e?e instanceof Date?e:new Date(e):null;return jsx(Bm,{startDate:s==="start"?c:n||null,endDate:s==="end"?c:i||null,onChange:(m,g)=>{t&&t(s==="start"?m:g);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:o||!t,placeholder:"-"})}function Cn(e=600){let[t,a]=useState(false),r=useRef(null),o=useCallback(()=>{r.current&&clearTimeout(r.current),a(true),r.current=setTimeout(()=>{a(false);},e);},[e]);return useEffect(()=>()=>{r.current&&clearTimeout(r.current);},[]),{isFlashing:t,triggerFlash:o}}function Pi(e,t={}){let{enabled:a=true,duration:r=400,steps:o=8}=t,[s,n]=useState(e),[i,c]=useState(false),l=useRef(e),p=useRef([]);return useEffect(()=>{if(p.current.forEach(clearTimeout),p.current=[],!a||e===l.current||e===void 0){n(e),l.current=e;return}let d=l.current??0,m=e,g=m-d,b=r/o;c(true);for(let h=1;h<=o;h++){let v=setTimeout(()=>{let f=h/o,y=1-Math.pow(1-f,3),w=Math.round(d+g*y);n(w),h===o&&(c(false),n(m));},b*h);p.current.push(v);}return l.current=e,()=>{p.current.forEach(clearTimeout),p.current=[];}},[e,a,r,o]),{displayValue:s,isAnimating:i}}function Rm(e,t={}){let{delay:a=1500,onCancel:r}=t,[o,s]=useState(null),[n,i]=useState(0),c=useRef(null),l=useRef(null),p=useCallback(g=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current),s(g),i(0);let b=Date.now();l.current=setInterval(()=>{let h=Date.now()-b,v=Math.min(h/a*100,100);i(v);},16),c.current=setTimeout(()=>{l.current&&clearInterval(l.current),e?.(g),s(null),i(0);},a);},[a,e]),d=useCallback(()=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current),s(null),i(0),r?.();},[r]);return useEffect(()=>()=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current);},[]),{pendingValue:o,isPending:o!==null,progress:n,startChange:p,cancelChange:d}}function $m({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:o=true,enableSaveFlash:s=true}){let[n,i]=useState(false),[c,l]=useState(""),p=useRef(null),{isFlashing:d,triggerFlash:m}=Cn(),{displayValue:g,isAnimating:b}=Pi(e,{enabled:o,duration:300,steps:6}),h=x=>{if(r||!t)return;x.stopPropagation();let T=x.currentTarget.getBoundingClientRect(),k=x.clientX-T.left,S=Math.round(k/T.width*100),C=Math.max(0,Math.min(100,S));C!==e&&(t(C),s&&m());},v=useCallback(x=>{r||!t||(x.stopPropagation(),l(String(e)),i(true));},[r,t,e]);useEffect(()=>{n&&p.current&&(p.current.focus(),p.current.select());},[n]);let f=useCallback(()=>{i(false);let x=parseInt(c,10);if(!isNaN(x)&&t){let T=Math.max(0,Math.min(100,x));T!==e&&(t(T),s&&m());}},[c,t,e,s,m]),y=useCallback(x=>{x.key==="Enter"&&f(),x.key==="Escape"&&i(false);},[f]),w=g??e;return jsxs("div",{className:u("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-[background-color] duration-300",d&&(a?"bg-[#3BF06E]/30":"bg-[#3BF06E]/20")),children:[jsx("div",{onClick:h,className:u("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/[0.05]":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsx("div",{className:u("h-full rounded-full transition-[width]",w===100?"bg-[#3BF06E]":"bg-[#3B9EFF]",b&&"transition-none"),style:{width:`${w}%`}})}),n?jsxs("div",{className:"flex items-center gap-0.5",onClick:x=>x.stopPropagation(),children:[jsx("input",{ref:p,value:c,onChange:x=>l(x.target.value.replace(/[^0-9]/g,"")),onBlur:f,onKeyDown:y,maxLength:3,className:u("w-8 text-xs text-right tabular-nums font-mono rounded border px-1 py-0 outline-none",a?"bg-white/10 border-white/20 text-white focus:border-blue-400":"bg-white border-gray-300 text-gray-900 focus:border-blue-500")}),jsx("span",{className:u("text-xs font-mono",a?"text-white/40":"text-gray-400"),children:"%"})]}):jsxs("span",{onClick:v,className:u("text-xs w-8 text-right tabular-nums font-mono rounded px-1",a?"text-white/60":"text-gray-500",!r&&t&&"cursor-pointer hover:bg-white/[0.08]",b&&"font-medium scale-105"),title:!r&&t?"Click to edit":void 0,children:[w,"%"]})]})}function Um({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=useState(false),[i,c]=useState(e),l=useRef(null);useEffect(()=>{s&&l.current&&(l.current.focus(),l.current.select());},[s]),useEffect(()=>{c(e);},[e]);let p=()=>{i!==e&&t?.(i),n(false);},d=m=>{m.key==="Enter"?p():m.key==="Escape"&&(c(e),n(false));};return o||!t?jsx("span",{className:u("text-sm truncate",a?"text-white/60":"text-gray-500"),children:e||r}):s?jsx("input",{ref:l,type:"text",value:i,onChange:m=>c(m.target.value),onBlur:p,onKeyDown:d,onClick:m=>m.stopPropagation(),className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):jsx("button",{onClick:m=>{m.stopPropagation(),n(true);},className:u("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-white/30":"text-gray-400")),children:e||r})}function Gm({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false,enableSlotMachine:i=true,enableSaveFlash:c=true}){let[l,p]=useState(false),[d,m]=useState(e?.toString()||""),g=useRef(null),{isFlashing:b,triggerFlash:h}=Cn(),{displayValue:v,isAnimating:f}=Pi(e,{enabled:i&&!l});useEffect(()=>{l&&g.current&&(g.current.focus(),g.current.select());},[l]),useEffect(()=>{m(e?.toString()||"");},[e]);let y=()=>{let x=parseFloat(d);if(!isNaN(x)){let T=x;o!==void 0&&(T=Math.max(o,T)),s!==void 0&&(T=Math.min(s,T)),T!==e&&(t?.(T),c&&h());}p(false);},w=x=>{x.key==="Enter"?y():x.key==="Escape"&&(m(e?.toString()||""),p(false));};return n||!t?jsx("span",{className:u("text-sm font-mono",a?"text-white/60":"text-gray-500",f&&"font-medium"),children:v!==void 0?v:r}):l?jsx("input",{ref:g,type:"number",value:d,onChange:x=>m(x.target.value),onBlur:y,onKeyDown:w,onClick:x=>x.stopPropagation(),min:o,max:s,className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):jsx("button",{onClick:x=>{x.stopPropagation(),p(true);},className:u("text-sm text-left w-full px-2 py-1 rounded transition-[background-color] duration-300",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",v===void 0&&(a?"text-white/30":"text-gray-400"),b&&(a?"bg-green-500/30":"bg-green-500/20"),f&&"font-medium scale-105"),children:v!==void 0?v:r})}function _m({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,i]=useState(false),c=useRef(null);return useEffect(()=>{let l=p=>{c.current&&!c.current.contains(p.target)&&i(false);};return n&&document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[n]),s||!a?jsx("span",{className:u("text-sm",r?"text-white/60":"text-gray-500"),children:e||o}):jsxs("div",{ref:c,className:"relative",children:[jsxs("button",{onClick:l=>{l.stopPropagation(),i(!n);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx("span",{className:u("text-sm flex-1 text-left truncate",r?"text-white/60":"text-gray-500",!e&&(r?"text-white/30":"text-gray-400")),children:e||o}),jsx(ChevronDown,{className:u("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")})]}),n&&jsx("div",{className:u("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsx("p",{className:u("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:"No options"}):t.map(l=>jsxs("button",{onClick:p=>{p.stopPropagation(),a(l),i(false);},className:u("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===l&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:r?"text-white":"text-gray-900",children:l}),e===l&&jsx(Check,{className:"w-4 h-4 text-[#007BFF]"})]},l))})]})}function Km({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:o=true,confirmDelay:s=1500}){let{pendingValue:n,isPending:i,progress:c,startChange:l,cancelChange:p}=Rm(t,{delay:s}),d=g=>{g.stopPropagation(),!r&&t&&(o?i?p():l(!e):t(!e));},m=i?n:e;return jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxs("button",{onClick:d,disabled:r||!t,className:u("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-[border-color,background-color,box-shadow]",m?"bg-[#007BFF] border-[#007BFF]":a?"border-[#333] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed",i&&"ring-2 ring-offset-1",i&&m&&"ring-green-500/50",i&&!m&&"ring-red-500/50",i&&(a?"ring-offset-[#050505]":"ring-offset-white")),children:[i&&jsx("svg",{className:"absolute inset-0 w-full h-full -rotate-90",viewBox:"0 0 20 20",children:jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:m?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${c/100*50.26} 50.26`,className:"transition-all duration-100"})}),i?jsx(Loader2,{className:"w-3 h-3 text-white animate-spin"}):m?jsx(Check,{className:"w-3 h-3 text-white"}):null]}),i&&jsx("button",{onClick:g=>{g.stopPropagation(),p();},className:u("w-4 h-4 rounded-full flex items-center justify-center transition-colors",a?"bg-red-500/20 hover:bg-red-500/40 text-red-400":"bg-red-100 hover:bg-red-200 text-red-500"),title:"Cancelar",children:jsx(X,{className:"w-3 h-3"})})]})}function Xm({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsx("span",{className:u("text-sm",t?"text-white/30":"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-[9px] font-mono uppercase tracking-wide rounded",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.05)":"#F3F4F6",color:s.color||(t?"rgba(255,255,255,0.5)":"#6B7280")},children:s.name},s.id)),o>0&&jsxs("span",{className:u("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/[0.05] text-white/60":"bg-gray-100 text-gray-500"),children:["+",o]})]})}function B2(e,t="en"){if(e==null||e===0||!e||Number(e)===0)return "-";let a=Math.floor(e/60),r=e%60;return a===0?`${r}m`:r===0?`${a}h`:`${a}h ${r}m`}function R2(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a&&a[1]&&a[2]){let i=parseInt(a[1],10),c=parseInt(a[2],10);return i*60+c}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r&&r[1]){let i=parseFloat(r[1]),c=r[2]?parseInt(r[2],10):0;return Math.round(i*60)+c}let o=t.match(/^(\d+\.?\d*)\s*h$/);if(o&&o[1])return Math.round(parseFloat(o[1])*60);let s=t.match(/^(\d+)\s*(m|min)$/);if(s&&s[1])return parseInt(s[1],10);let n=parseFloat(t);return isNaN(n)?null:Math.round(n*60)}function tr({value:e,onChange:t,isDark:a,locale:r="en",placeholder:o,disabled:s=false,enableSaveFlash:n=true,isBlurred:i=false,lens:c="hours",hourlyRate:l=0}){let[p,d]=useState(false),[m,g]=useState(""),b=useRef(null),{isFlashing:h,triggerFlash:v}=Cn(),f=c==="financial"&&l>0,y=f&&e?`$${Math.round(e/60*l).toLocaleString("en-US")}`:B2(e,r);useEffect(()=>{p&&b.current&&(b.current.focus(),b.current.select());},[p]),useEffect(()=>{if(e){let k=Math.floor(e/60),S=e%60;k>0&&S>0?g(`${k}h ${S}m`):k>0?g(`${k}h`):g(`${S}m`);}else g("");},[e,p]);let w=()=>{let k=R2(m);k!==e&&(t?.(k),n&&v()),d(false);},x=k=>{k.key==="Enter"?w():k.key==="Escape"&&d(false);};if(i)return jsxs("div",{className:"flex items-center gap-1.5",title:r==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data",children:[jsx(Clock,{className:u("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:u("text-sm select-none blur-[4px] opacity-60 pointer-events-none",a?"text-white/60":"text-gray-500"),"aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"})]});let T=f?DollarSign:Clock;return s||!t?jsxs("div",{className:"flex items-center gap-1.5",children:[e!=null&&e>0&&jsx(T,{className:u("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:u("text-sm font-mono",a?"text-white/60":"text-gray-500",(!e||e===0)&&(a?"text-white/30":"text-gray-400")),children:y})]}):p?jsx("input",{ref:b,type:"text",value:m,onChange:k=>g(k.target.value),onBlur:w,onKeyDown:x,onClick:k=>k.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white placeholder:text-white/30":"bg-white border-[#007BFF] text-gray-900 placeholder:text-gray-400")}):jsxs("button",{onClick:k=>{k.stopPropagation(),d(true);},className:u("flex items-center gap-1 text-sm text-left w-full px-1.5 py-1 rounded transition-[background-color] duration-300 overflow-hidden",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e!=null&&e>0?a?"text-white/60":"text-gray-600":a?"text-white/30":"text-gray-400",h&&(a?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsx(T,{className:u("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:"truncate font-mono",children:y})]})}function eg({startDate:e,endDate:t,scheduleVariance:a,isDark:r,locale:o="en",hasTimeAllocated:s=true}){if(!e&&!t)return jsx("span",{className:u("text-[11px] font-mono",r?"text-white/30":"text-gray-400"),children:"-"});let n=c=>c.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),i=()=>{if(a==null)return null;let c=o==="es";return a===0?s?jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#3B9EFF",fontWeight:600},children:c?"En Tiempo":"On Track"}):jsx("span",{className:"font-mono",style:{fontSize:"10px",color:r?"rgba(255,255,255,0.3)":"#94A3B8",fontWeight:500},children:c?"Tiempo no asignado":"No time allocated"}):a>0?jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#3BF06E",fontWeight:600},children:["+",a,"d ",c?"Adelante":"Early"]}):jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#FF2D20",fontWeight:600},children:[a,"d ",c?"Atraso":"Delay"]})};return jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxs("span",{className:u("text-[11px] font-mono",r?"text-white/60":"text-gray-500"),children:[e?n(e):"\u2014",jsx("span",{className:r?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?n(t):"\u2014"]}),i()]})}function ag({task:e,isDark:t,locale:a="en",onLogTime:r,onEstimateUpdate:o,onSoldEffortUpdate:s,onOpenTimeLog:n,lens:i="hours",hourlyRate:c=0}){let l=a==="es",p=i==="financial"&&c>0,d=ee=>p?`$${Math.round(ee*c).toLocaleString("en-US")}`:`${ee}h`,[m,g]=useState(false),[b,h]=useState(false),[v,f]=useState(null),y=useRef(null),w=e.timeLoggedMinutes||0,x=e.effortMinutes||0,T=e.soldEffortMinutes||0,k=Math.round(w/60*10)/10,S=Math.round(x/60*10)/10,C=x>0?w/x*100:0,I=C>100?Math.round((w-x)/60*10)/10:0,$=C>100?"#EF4444":"#00E5CC";useEffect(()=>{if(!b&&!v)return;let ee=ze=>{y.current&&!y.current.contains(ze.target)&&(h(false),f(null));};return document.addEventListener("mousedown",ee),()=>document.removeEventListener("mousedown",ee)},[b,v]);let A=ee=>{if(ee.stopPropagation(),r&&!o&&!s){f("log");return}if(r||o||s){h(ze=>!ze),f(null);return}n&&n(e);},_=ee=>{h(false),f(ee);},E=async(ee,ze)=>{v==="log"&&r&&ee?r(e,ee,ze):v==="estimate"&&o?o(e,ee):v==="quoted"&&s&&s(e,ee),f(null);},me=r||o||s||n,L=[{mode:"log",icon:Clock,label:l?"Registrar tiempo":"Log time",show:!!r},{mode:"estimate",icon:Target,label:l?"Estimaci\xF3n":"Estimate",show:!!o},{mode:"quoted",icon:DollarSign,label:l?"T. Ofertado":"Quoted time",show:!!s}].filter(ee=>ee.show),X=v==="estimate"?x:v==="quoted"?T:void 0;return x===0&&w===0&&T===0?jsxs("div",{ref:y,className:"relative flex items-center gap-2",onClick:ee=>ee.stopPropagation(),onMouseEnter:()=>g(true),onMouseLeave:()=>g(false),children:[jsx("span",{className:u("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),m&&me&&jsx("button",{onClick:A,className:"flex items-center justify-center w-6 h-6 rounded-md transition-colors",style:{color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent"},onMouseEnter:ee=>{ee.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",ee.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:ee=>{ee.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",ee.currentTarget.style.backgroundColor="transparent";},title:l?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:b&&jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:L.map(ee=>jsxs("button",{onClick:ze=>{ze.stopPropagation(),_(ee.mode);},className:"w-full flex items-center gap-2 px-3 py-2 text-left transition-colors",style:{fontSize:11,fontFamily:"'JetBrains Mono', monospace",color:t?"rgba(255,255,255,0.7)":"#374151",background:"transparent",border:"none",cursor:"pointer"},onMouseEnter:ze=>{ze.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:ze=>{ze.target.style.background="transparent";},children:[jsx(ee.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),ee.label]},ee.mode))})}),jsx(AnimatePresence,{children:v&&jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsx($r,{mode:v,locale:a,isDark:t,currentValue:X||void 0,onSave:E,onClose:()=>f(null)})})})})]}):jsxs("div",{ref:y,className:"relative flex items-center gap-2 w-full",onClick:ee=>ee.stopPropagation(),onMouseEnter:()=>g(true),onMouseLeave:()=>g(false),children:[jsxs("div",{className:"flex flex-col gap-1 flex-1 min-w-0",style:{padding:"8px 12px",borderRadius:"4px",border:t?"1px solid #333":"1px solid #E5E7EB",backgroundColor:t?"#1A1A1A":"#F9FAFB"},children:[jsxs("div",{className:"flex items-center gap-1.5",children:[jsx("span",{className:"font-mono",style:{fontSize:13,fontWeight:700,color:t?"#FFFFFF":"#111827"},children:d(k)}),x>0&&jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",d(S)]}),I>0&&jsxs("span",{className:"font-mono px-1.5 py-0.5 rounded",style:{fontSize:10,color:"#EF4444",backgroundColor:"rgba(239,68,68,0.15)"},children:["+",d(I)," Over"]})]}),x>0&&jsx("div",{className:"w-full overflow-hidden",style:{height:3,backgroundColor:t?"#333":"#E5E7EB",borderRadius:2},children:jsx("div",{style:{height:"100%",width:`${Math.min(C,100)}%`,backgroundColor:$,borderRadius:2,transition:"width 0.3s"}})})]}),me&&jsx("button",{onClick:A,className:"flex-shrink-0 flex items-center justify-center w-7 h-7 rounded-md transition-all duration-150",style:{opacity:m?1:0,pointerEvents:m?"auto":"none",color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent",border:"none"},onMouseEnter:ee=>{ee.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",ee.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:ee=>{ee.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",ee.currentTarget.style.backgroundColor="transparent";},title:l?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:b&&jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:L.map(ee=>jsxs("button",{onClick:ze=>{ze.stopPropagation(),_(ee.mode);},className:"w-full flex items-center gap-2 px-3 py-2 text-left transition-colors",style:{fontSize:11,fontFamily:"'JetBrains Mono', monospace",color:t?"rgba(255,255,255,0.7)":"#374151",background:"transparent",border:"none",cursor:"pointer"},onMouseEnter:ze=>{ze.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:ze=>{ze.target.style.background="transparent";},children:[jsx(ee.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),ee.label]},ee.mode))})}),jsx(AnimatePresence,{children:v&&jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsx($r,{mode:v,locale:a,isDark:t,currentValue:X||void 0,onSave:E,onClose:()=>f(null)})})})})]})}function V2(e){let t=new Map;function a(r){if(r.assignees)for(let o of r.assignees)o.name&&!t.has(o.name)&&t.set(o.name,o);if(r.subtasks)for(let o of r.subtasks)a(o);}return a(e),Array.from(t.values())}function G2(e){return e>100?{bg:"rgba(239,68,68,0.15)",text:"#EF4444"}:e>=86?{bg:"rgba(245,158,11,0.15)",text:"#F59E0B"}:e>=61?{bg:"rgba(0,229,204,0.15)",text:"#00E5CC"}:{bg:"rgba(34,197,94,0.15)",text:"#22C55E"}}function rg({assignee:e,size:t=28,isDark:a}){let r=t===28?"w-7 h-7":t===24?"w-6 h-6":"w-5 h-5",o=t===28?"text-[10px]":"text-[9px]";return e.avatar?jsx("img",{src:e.avatar,alt:e.name,className:u(r,"rounded-full object-cover ring-1 flex-shrink-0",a?"ring-white/10":"ring-gray-200")}):jsx("div",{className:u(r,"rounded-full flex items-center justify-center font-bold text-white ring-1 flex-shrink-0",o,a?"ring-white/10":"ring-gray-200"),style:{backgroundColor:e.color||"#6B7280"},children:e.initials||e.name?.charAt(0)?.toUpperCase()||"?"})}function og({task:e,isDark:t,locale:a="en"}){let r=a==="es",o=!!e.hasChildren,s=e.assignees?.[0],n=e.teamLoad;if(o){let p=V2(e);if(p.length===0)return null;let d=p.slice(0,3),m=p.length-3;return jsxs("div",{className:"flex items-center",children:[jsx("div",{className:"flex -space-x-2",children:d.map((g,b)=>jsx(rg,{assignee:g,size:24,isDark:t},g.name+b))}),m>0&&jsxs("span",{className:u("ml-1 text-[10px] font-mono",t?"text-white/40":"text-gray-400"),title:p.slice(3).map(g=>g.name).join(", "),children:["+",m]})]})}if(!s)return jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:u("w-7 h-7 rounded-full flex items-center justify-center flex-shrink-0",t?"bg-white/5":"bg-gray-100"),children:jsx(User,{className:"w-3.5 h-3.5",style:{color:"#4B5563"}})}),jsx("span",{className:u("text-[11px]",t?"text-white/30":"text-gray-400"),children:r?"Sin asignar":"Unassigned"})]});let i=n?.percentage??0,c=!!n&&i>0,l=c?G2(i):null;return jsxs("div",{className:"flex flex-col gap-1",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(rg,{assignee:s,size:28,isDark:t}),jsx("span",{className:u("text-[13px] truncate",t?"text-white":"text-gray-900"),style:{maxWidth:"100px"},children:s.name})]}),c&&l&&jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono uppercase tracking-wide w-fit font-semibold",style:{backgroundColor:l.bg,color:l.text},children:[i,"% LOAD"]})]})}var _2={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function sg({blockers:e,isDark:t,locale:a="en"}){return !e||e.length===0?jsx("span",{className:u("text-[9px] font-mono uppercase tracking-wide",t?"text-white/20":"text-gray-400"),children:a==="es"?"Ninguno":"None"}):jsx("div",{className:"flex items-center gap-1 flex-wrap",children:e.map((r,o)=>jsxs("span",{className:u("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",_2[r.severity]),children:[r.type," #",r.id]},`${r.type}-${r.id}-${o}`))})}function d1(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function c1(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 cg({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:i,onColumnHide:c,onColumnSort:l,availableUsers:p=[],onOpenTimeLog:d,onReportBlocker:m,onCopyTaskLink:g}){let b=useRef(null),h=r==="es"?lg.es:lg.en;if(useEffect(()=>{let x=k=>{b.current&&!b.current.contains(k.target)&&t();},T=k=>{k.key==="Escape"&&t();};return document.addEventListener("mousedown",x),document.addEventListener("keydown",T),()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",T);}},[t]),!e.isOpen)return null;let v=()=>{if(!e.task)return [];let x=[];return o&&x.push({id:"edit",label:h.edit,icon:jsx(Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),x.push({id:"sep1",label:"",icon:null,separator:true}),i&&(x.push({id:"status",label:h.changeStatus,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:h.todo,icon:jsx(Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{i({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:h.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4 text-blue-500"}),onClick:()=>{i({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:h.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{i({...e.task,status:"completed",progress:100}),t();}}]}),x.push({id:"priority",label:h.changePriority,icon:jsx(Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:h.urgent,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{i({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:h.high,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{i({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:h.medium,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{i({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:h.low,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{i({...e.task,priority:"low"}),t();}}]}),p.length>0&&x.push({id:"assign",label:h.assignUser,icon:jsx(Users,{className:"w-4 h-4"}),submenu:p.slice(0,5).map(T=>({id:`assign-${T.id}`,label:T.name,icon:jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-blue-500",children:T.name.charAt(0).toUpperCase()}),onClick:()=>{let k=e.task.assignees||[],C=k.some(I=>I.name===T.name)?k.filter(I=>I.name!==T.name):[...k,{name:T.name,initials:d1(T.name),color:T.color||c1(T.name),avatar:T.avatarUrl}];i({...e.task,assignees:C}),t();}}))})),d&&x.push({id:"log-time",label:h.logTime,icon:jsx(Clock,{className:"w-4 h-4"}),onClick:()=>{d(e.task),t();}}),m&&x.push({id:"report-blocker",label:h.reportBlocker,icon:jsx(AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{m(e.task),t();}}),g&&x.push({id:"copy-link",label:h.copyLink,icon:jsx(Link2,{className:"w-4 h-4"}),onClick:()=>{g(e.task),t();}}),x.push({id:"sep2",label:"",icon:null,separator:true}),s&&x.push({id:"duplicate",label:h.duplicate,icon:jsx(Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),n&&x.push({id:"delete",label:h.delete,icon:jsx(Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),x},f=()=>{if(!e.columnId)return [];let x=[];return l&&(x.push({id:"sort-asc",label:h.sortAsc,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{l(e.columnId,"asc"),t();}}),x.push({id:"sort-desc",label:h.sortDesc,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{l(e.columnId,"desc"),t();}})),c&&e.columnId!=="name"&&(x.push({id:"sep-hide",label:"",icon:null,separator:true}),x.push({id:"hide",label:h.hideColumn,icon:jsx(EyeOff,{className:"w-4 h-4"}),onClick:()=>{c(e.columnId),t();}})),x},y=e.type==="task"?v():f(),w={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsx("div",{ref:b,style:w,className:u("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:y.map(x=>x.separator?jsx("div",{className:u("my-1 h-px",a?"bg-white/[0.05]":"bg-gray-200")},x.id):x.submenu?jsx(u1,{item:x,isDark:a},x.id):jsxs("button",{onClick:x.onClick,className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",x.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsx("span",{className:u(x.danger?"text-red-500":a?"text-white/60":"text-gray-400"),children:x.icon}),x.label]},x.id))})}function u1({item:e,isDark:t}){let[a,r]=useState(false),o=useRef();return jsxs("div",{className:"relative",onMouseEnter:()=>{o.current&&clearTimeout(o.current),r(true);},onMouseLeave:()=>{o.current=setTimeout(()=>r(false),150);},children:[jsxs("button",{className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-white/60":"text-gray-400",children:e.icon}),jsx("span",{className:"flex-1",children:e.label}),jsx(ChevronRight,{className:u("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),a&&e.submenu&&jsx("div",{className:u("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:e.submenu.map(i=>jsxs("button",{onClick:i.onClick,className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-white/60":"text-gray-400",children:i.icon}),i.label]},i.id))})]})}var lg={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",logTime:"Log Time",reportBlocker:"Report Blocker",copyLink:"Copy Link"},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",logTime:"Registrar Tiempo",reportBlocker:"Reportar Bloqueante",copyLink:"Copiar Enlace"}};var xg={name:jsx(Type,{className:"w-4 h-4"}),status:jsx(CircleDot,{className:"w-4 h-4"}),priority:jsx(Flag,{className:"w-4 h-4"}),assignees:jsx(Users,{className:"w-4 h-4"}),startDate:jsx(Calendar,{className:"w-4 h-4"}),endDate:jsx(CalendarCheck,{className:"w-4 h-4"}),progress:jsx(BarChart,{className:"w-4 h-4"}),tags:jsx(Tag,{className:"w-4 h-4"}),estimatedTime:jsx(Clock,{className:"w-4 h-4"}),quotedTime:jsx(FileText,{className:"w-4 h-4"}),elapsedTime:jsx(Timer,{className:"w-4 h-4"}),effortMinutes:jsx(Clock,{className:"w-4 h-4"}),timeLoggedMinutes:jsx(Timer,{className:"w-4 h-4"}),soldEffortMinutes:jsx(FileText,{className:"w-4 h-4"}),scheduleVariance:jsx(CalendarClock,{className:"w-4 h-4"}),hoursBar:jsx(BarChart3,{className:"w-4 h-4"}),teamLoad:jsx(Users,{className:"w-4 h-4"}),blockers:jsx(AlertTriangle,{className:"w-4 h-4"}),weight:jsx(BarChart,{className:"w-4 h-4"}),text:jsx(Type,{className:"w-4 h-4"}),number:jsx(Hash,{className:"w-4 h-4"}),date:jsx(Calendar,{className:"w-4 h-4"}),dropdown:jsx(ChevronDown,{className:"w-4 h-4"}),checkbox:jsx(CheckSquare,{className:"w-4 h-4"})},S1=["name","status","priority","assignees","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"];function wg({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:i}){let[c,l]=useState(""),[p,d]=useState(null),m=useRef(null),g=i==="es"?vg.es:vg.en;if(useLayoutEffect(()=>{if(!e||!m.current)return;let x=()=>{if(!m.current)return;let T=m.current.getBoundingClientRect(),S=window.innerHeight-T.top-20;d(Math.max(300,S));};return requestAnimationFrame(x),window.addEventListener("resize",x),()=>window.removeEventListener("resize",x)},[e]),useEffect(()=>{if(!e)return;let x=setTimeout(()=>{let T=S=>{m.current&&!m.current.contains(S.target)&&t();},k=S=>{S.key==="Escape"&&t();};document.addEventListener("mousedown",T),document.addEventListener("keydown",k),m._cleanup=()=>{document.removeEventListener("mousedown",T),document.removeEventListener("keydown",k);};},100);return ()=>{clearTimeout(x),m._cleanup&&m._cleanup();}},[e,t]),!e)return null;let b=x=>g.columns[x]||x,h=x=>{if(x==="name")return;let T=a.map(k=>k.id===x?{...k,visible:!k.visible}:k);o(T);},v=(x,T)=>{let k=a.find(C=>C.type===x&&(!T||C.customFieldId===T));if(k){h(k.id);return}let S={id:T||x,type:x,label:T?r.find(C=>C.id===T)?.name||x:b(x),width:120,visible:true,sortable:true,resizable:true,customFieldId:T};o([...a,S]);},f=S1.filter(x=>b(x).toLowerCase().includes(c.toLowerCase())),y=r.filter(x=>x.name.toLowerCase().includes(c.toLowerCase())),w=n?"#00E5FF":"#2E94FF";return jsxs("div",{ref:m,style:{...p?{maxHeight:`${p}px`}:{},background:n?"#111114":"#FFFFFF",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.08)"}`,boxShadow:n?"0 8px 32px rgba(0,0,0,0.7)":"0 8px 32px rgba(0,0,0,0.12)"},className:"absolute right-0 top-full mt-1 w-64 rounded-xl z-50 flex flex-col",children:[jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5",style:{borderBottom:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`},children:[jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",color:n?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",fontFamily:"JetBrains Mono, monospace"},children:g.title.toUpperCase()}),jsx("button",{onClick:t,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors",style:{color:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},onMouseEnter:x=>{x.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",x.currentTarget.style.color=n?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:x=>{x.currentTarget.style.backgroundColor="transparent",x.currentTarget.style.color=n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)";},children:jsx(X,{className:"w-3.5 h-3.5"})})]}),jsx("div",{className:"px-3 py-2",children:jsxs("div",{className:"relative",children:[jsx(Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5",style:{color:n?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)"}}),jsx("input",{type:"text",value:c,onChange:x=>l(x.target.value),placeholder:g.searchPlaceholder,style:{fontSize:12,background:n?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,color:n?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.8)"},className:"w-full pl-8 pr-3 py-1.5 rounded-lg outline-none placeholder:opacity-40 transition-colors focus:border-[var(--focus-border)]",ref:x=>{x&&x.style.setProperty("--focus-border",w);},onFocus:x=>{x.currentTarget.style.borderColor=w,x.currentTarget.style.background=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:x=>{x.currentTarget.style.borderColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",x.currentTarget.style.background=n?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)";}})]})}),jsxs("div",{className:"overflow-y-auto flex-1 min-h-0 overscroll-contain px-2 pb-2",onWheel:x=>x.stopPropagation(),children:[jsxs("div",{className:"mb-1",children:[jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:n?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace"},children:g.standardFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:f.map(x=>{let T=a.find(C=>C.type===x&&!C.customFieldId),k=T?.visible??false,S=x==="name";return jsxs("button",{onClick:()=>{S||(T?h(T.id):v(x));},disabled:S,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:S?.4:1,cursor:S?"not-allowed":"pointer"},onMouseEnter:C=>{S||(C.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:C=>{C.currentTarget.style.backgroundColor="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:k?w:"transparent",border:k?`1.5px solid ${w}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:k?`0 0 6px ${w}40`:"none"},children:k&&jsx(Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:k?w:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:xg[x]}),jsx("span",{style:{fontSize:12,fontWeight:k?500:400,color:k?n?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":n?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:b(x)})]},x)})})]}),y.length>0&&jsxs("div",{className:"mt-1",children:[jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:n?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace",borderTop:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,paddingTop:8,marginTop:4},children:g.customFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:y.map(x=>{let k=a.find(S=>S.customFieldId===x.id)?.visible??false;return jsxs("button",{onClick:()=>v(x.type,x.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:S=>{S.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:S=>{S.currentTarget.style.backgroundColor="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:k?w:"transparent",border:k?`1.5px solid ${w}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:k?`0 0 6px ${w}40`:"none"},children:k&&jsx(Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:k?w:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:xg[x.type]||jsx(Type,{className:"w-4 h-4"})}),jsx("span",{style:{fontSize:12,fontWeight:k?500:400,color:k?n?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":n?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:x.name})]},x.id)})})]})]})]})}var vg={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",columns:{name:"Name",status:"Status",priority:"Priority",assignees:"Assignees",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",soldEffortMinutes:"Quoted",effortMinutes:"Estimated",timeLoggedMinutes:"Executed",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox",weight:"Weight"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",assignees:"Asignados",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",soldEffortMinutes:"Ofertado",effortMinutes:"Estimado",timeLoggedMinutes:"Ejecutado",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla",weight:"Peso"}}};var R1=[{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 Tg({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=useState(""),[i,c]=useState("text"),[l,p]=useState([""]),d=o==="es"?Cg.es:Cg.en;useEffect(()=>{e&&(n(""),c("text"),p([""]));},[e]),useEffect(()=>{let v=f=>{f.key==="Escape"&&t();};return e&&document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[e,t]);let m=()=>{if(!s.trim())return;let v={name:s.trim(),type:i};i==="dropdown"&&(v.options=l.filter(f=>f.trim())),a(v),t();},g=()=>{p([...l,""]);},b=(v,f)=>{let y=[...l];y[v]=f,p(y);},h=v=>{l.length>1&&p(l.filter((f,y)=>y!==v));};return e?jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxs("div",{className:u("relative w-full max-w-md rounded-xl shadow-2xl border",r?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxs("div",{className:u("flex items-center justify-between px-6 py-4 border-b",r?"border-[#222]":"border-gray-200"),children:[jsx("h2",{className:u("text-lg font-semibold",r?"text-white":"text-gray-900"),children:d.title}),jsx("button",{onClick:t,className:u("p-1 rounded",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(X,{className:u("w-5 h-5",r?"text-white/60":"text-gray-400")})})]}),jsxs("div",{className:"p-6 space-y-6",children:[jsxs("div",{children:[jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldName}),jsx("input",{type:"text",value:s,onChange:v=>n(v.target.value),placeholder:d.fieldNamePlaceholder,className:u("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxs("div",{children:[jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldType}),jsx("div",{className:"grid grid-cols-5 gap-2",children:R1.map(v=>jsxs("button",{onClick:()=>c(v.type),className:u("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",i===v.type?"border-[#007BFF] bg-[#007BFF]/10":r?"border-[#222] hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsx("span",{className:i===v.type?"text-[#007BFF]":r?"text-white/60":"text-gray-400",children:v.icon}),jsx("span",{className:u("text-xs",i===v.type?"text-[#007BFF]":r?"text-white/60":"text-gray-500"),children:d.types[v.type]})]},v.type))})]}),i==="dropdown"&&jsxs("div",{children:[jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.options}),jsxs("div",{className:"space-y-2",children:[l.map((v,f)=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:v,onChange:y=>b(f,y.target.value),placeholder:`${d.option} ${f+1}`,className:u("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),l.length>1&&jsx("button",{onClick:()=>h(f),className:u("p-2 rounded-lg transition-colors",r?"hover:bg-white/[0.05] text-white/60":"hover:bg-gray-100 text-gray-400"),children:jsx(Trash2,{className:"w-4 h-4"})})]},f)),jsxs("button",{onClick:g,className:u("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#007BFF] hover:bg-white/[0.05]":"text-blue-600 hover:bg-gray-100"),children:[jsx(Plus,{className:"w-4 h-4"}),d.addOption]})]})]})]}),jsxs("div",{className:u("flex items-center justify-end gap-3 px-6 py-4 border-t",r?"border-[#222]":"border-gray-200"),children:[jsx("button",{onClick:t,className:u("px-4 py-2 text-sm font-medium rounded-lg transition-colors",r?"text-white/60 hover:bg-white/[0.05]":"text-gray-600 hover:bg-gray-100"),children:d.cancel}),jsx("button",{onClick:m,disabled:!s.trim(),className:u("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#007BFF] text-white hover:bg-[#005FCC]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:d.create})]})]})]}):null}var Cg={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 Sg={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 Eg({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,i]=useState(false),c=useRef(null),l=useRef(0),p=s==="es"?Sg.es:Sg.en;useEffect(()=>{if(!n)return;let g=h=>{Date.now()-l.current<100||c.current&&!c.current.contains(h.target)&&i(false);},b=h=>{h.key==="Escape"&&i(false);};return document.addEventListener("mousedown",g),document.addEventListener("keydown",b),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",b);}},[n]);let d=[{value:"all",label:p.showAll,icon:jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}),color:"text-[#007BFF]"},{value:"completed",label:p.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:p.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"todo",label:p.toDo,icon:jsx(Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],m=e!=="all"||t;return jsxs("div",{ref:c,className:"relative",children:[jsxs("button",{onClick:g=>{g.stopPropagation(),n||(l.current=Date.now()),i(b=>!b);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] font-medium transition-all border",o?"border-[#222] hover:bg-white/[0.05] text-white/70":"border-gray-200 hover:bg-gray-100 text-gray-700",m&&(o?"bg-[#2E94FF]/20 border-[#2E94FF]/50 text-[#2E94FF]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/[0.05]":"bg-gray-100")),style:{fontFamily:"Inter, sans-serif"},children:[jsx(Filter,{className:"w-4 h-4"}),p.filters,m&&jsx("span",{className:u("w-2 h-2 rounded-full",o?"bg-[#2E94FF]":"bg-blue-500")})]}),n&&jsxs("div",{className:u("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",o?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsx("div",{className:u("px-4 py-3 border-b",o?"border-[#222]":"border-gray-200"),children:jsx("span",{className:u("text-xs font-medium uppercase tracking-wider",o?"text-white/30":"text-gray-400"),children:p.filterByStatus})}),jsx("div",{className:"py-2",children:d.map(g=>{let b=e===g.value&&!t,h=()=>g.value==="all"?b?jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}):jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):g.icon;return jsxs("button",{onClick:()=>{a(g.value),r(false),i(false);},className:u("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/[0.05]":"hover:bg-gray-100",b&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:u(b?g.color:"text-gray-400","flex-shrink-0"),children:h()}),jsx("span",{className:u("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:g.label}),b&&jsx(Check,{className:u("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]},g.value)})}),jsx("div",{className:u("my-2 mx-4 h-px",o?"bg-white/[0.05]":"bg-gray-200")}),jsx("div",{className:"py-1",children:jsxs("button",{onClick:()=>{let g=!t;r(g),g&&a("all"),i(false);},className:u("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/[0.05]":"hover:bg-gray-100",t&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsx(EyeOff,{className:u("w-4 h-4 flex-shrink-0",t?o?"text-[#007BFF]":"text-blue-500":o?"text-white/30":"text-gray-400")}),jsx("span",{className:u("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:p.hideCompleted}),t&&jsx(Check,{className:u("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]})})]})]})}function Fg(e){if(e<=0)return "0h";let t=Math.floor(e/60),a=e%60;return a>0?`${t}h ${a}m`:`${t}h`}function ss(e){return e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${(e/1e3).toFixed(1)}K`:`$${Math.round(e).toLocaleString("en-US")}`}function Mg({data:e,isDark:t,locale:a="en",onClose:r,lens:o="hours"}){let s=a==="es",n=o==="financial";return jsxs("div",{className:u("w-[220px] xl:w-[280px] flex-shrink-0 overflow-y-auto border-l",t?"bg-[#141414] border-[#222]":"bg-gray-50 border-gray-200"),children:[jsxs("div",{className:u("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsx("h3",{className:u("text-[10px] font-mono uppercase tracking-wider font-bold",t?"text-white/40":"text-gray-500"),children:n?s?"SALUD FINANCIERA":"FINANCIAL HEALTH":s?"SALUD DEL PROYECTO":"PROJECT HEALTH"}),r&&jsx("button",{onClick:r,className:u("p-1 rounded transition-colors",t?"text-white/30 hover:text-white/60 hover:bg-white/[0.05]":"text-gray-400 hover:text-gray-600 hover:bg-gray-200"),title:s?"Cerrar panel":"Close panel",children:jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:jsx("path",{d:"M1 1l10 10M11 1L1 11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),n&&(e.totalOffered!==void 0||e.totalEstimated!==void 0)&&(()=>{let i=e.totalOffered??0,c=e.totalEstimated??0,l=e.totalExecuted??0,p=i-c,d=i>0?Math.round(p/i*100):0,m=i>0?Math.min(Math.round(c/i*100),120):0,g=c>i&&i>0,b=g?"#FF2D20":"#00E5CC";return jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:s?"PRESUPUESTO":"BUDGET"}),jsxs("div",{className:"space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Ofertado":"Offered"}),jsx("span",{className:u("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:ss(i)})]}),jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Estimado":"Estimated"}),jsx("span",{className:u("text-[11px] font-mono font-bold",g?"text-[#FF2D20]":t?"text-white/80":"text-gray-800"),children:ss(c)})]}),l>0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Ejecutado":"Executed"}),jsx("span",{className:u("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:ss(l)})]}),i>0&&jsx("div",{className:u("w-full h-2.5 rounded-full overflow-hidden mt-2",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(m,100)}%`,backgroundColor:b}})}),jsxs("div",{className:u("mt-2 px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",p>=0?t?"bg-[#00E5CC]/10 text-[#00E5CC]":"bg-emerald-50 text-emerald-600":t?"bg-[#FF2D20]/10 text-[#FF2D20]":"bg-red-50 text-red-600"),children:[p>=0?`+${ss(p)} ${s?"Disp.":"Avail."}`:`${ss(Math.abs(p))} ${s?"P\xE9rdida":"Loss"}`,i>0&&jsxs("span",{className:"text-[10px] ml-1 opacity-60",children:["(",d,"%)"]})]})]})]})})(),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let i=e.totalHoursSpentMinutes??0,c=e.totalHoursAllocatedMinutes??0,l=c>0?Math.min(Math.round(i/c*100),100):0,p=i>c&&c>0,d=p?"#FF2D20":l>=80?"#FFD60A":"#3BF06E";return jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:s?"HORAS DEL PROYECTO":"PROJECT HOURS"}),jsxs("div",{className:"space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Usado":"Spent"}),jsx("span",{className:u("text-[11px] font-mono font-bold",p?"text-[#FF2D20]":t?"text-white/80":"text-gray-800"),children:Fg(i)})]}),jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Asignado":"Allocated"}),jsx("span",{className:u("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:Fg(c)})]}),c>0&&jsx("div",{className:u("w-full h-1.5 rounded-full overflow-hidden mt-1",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${l}%`,backgroundColor:d}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:s?"SALUD T\xC9CNICA":"TECHNICAL HEALTH"}),jsxs("div",{className:"space-y-3",children:[e.openRFIs!==void 0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"RFIs Abiertos":"Open RFIs"}),jsx("span",{className:u("px-2 py-0.5 rounded text-[11px] font-mono font-bold",e.openRFIs>0?"bg-[#FF2D20]/15 text-[#FF2D20]":"bg-[#3BF06E]/15 text-[#3BF06E]"),children:e.openRFIs})]}),e.submittalsApprovalPercent!==void 0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxs("span",{className:u("text-[11px] font-mono font-bold",e.submittalsApprovalPercent>=80?"text-[#3BF06E]":"text-[#FFD60A]"),children:[e.submittalsApprovalPercent,"%"]})]})]})]}),e.scheduleVarianceDays!==void 0&&jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:s?"VARIACI\xD3N DE CRONOGRAMA":"SCHEDULE VARIANCE"}),(()=>{let i=e.scheduleVarianceDays??0,c=i>0,l=i<0,p=e.scheduleVarianceLabel||(c?`+${i} ${s?"D\xEDas ADELANTE":"Days AHEAD"}`:l?`${i} ${s?"D\xEDas ATR\xC1S":"Days BEHIND"}`:s?"EN TIEMPO":"ON TRACK");return jsx("div",{className:u("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",c&&"bg-[#3BF06E]/15 text-[#3BF06E]",l&&"bg-[#FF2D20]/15 text-[#FF2D20]",!c&&!l&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:p})})()]}),e.teams&&e.teams.length>0&&jsxs("div",{className:"px-5 py-4",children:[jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:s?"DISPONIBILIDAD DEL EQUIPO":"TEAM AVAILABILITY"}),jsx("div",{className:"space-y-3",children:e.teams.map((i,c)=>{let l=i.utilizationPercent>=100?"#FF2D20":i.utilizationPercent>=80?"#FFD60A":i.color||"#3BF06E";return jsxs("div",{children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:i.name}),jsxs("span",{className:u("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[i.utilizationPercent,"%"]})]}),jsx("div",{className:u("w-full h-1.5 rounded-full overflow-hidden",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(i.utilizationPercent,100)}%`,backgroundColor:l}})})]},`${i.name}-${c}`)})})]})]})}var Q1=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,visible:true,sortable:true,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true}];function Rg(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(...Rg(r.subtasks,t+1));return a}function Z1(e){let t=e.subtasks;if(!t?.length)return null;let a=new Date,r=0,o=0;for(let s of t){if(!s.startDate||!s.endDate)continue;let n=s.startDate.getTime(),c=s.endDate.getTime()-n;if(c<=0)continue;let p=Math.max(0,Math.min(a.getTime()-n,c))/c*100;if(p<=0)continue;let d=(s.progress||0)/p;r+=d,o++;}return o>0?r/o:null}function ew(e){return e.subtasks?.length?e.subtasks.filter(t=>t.teamLoad&&t.teamLoad.percentage>=100).length:0}function Sn(e){if(!e.subtasks?.length)return {spent:0,allocated:0,quoted:0};let t=0,a=0,r=0;for(let o of e.subtasks)if(o.subtasks?.length){let s=Sn(o);t+=s.spent,a+=s.allocated,r+=s.quoted;}else t+=o.timeLoggedMinutes??0,a+=o.effortMinutes??0,r+=o.soldEffortMinutes??0;return {spent:t,allocated:a,quoted:r}}function Dn(e){if(e<=0)return "0h";let t=Math.floor(e/60),a=e%60;return a>0?`${t}h ${a}m`:`${t}h`}function tw({value:e,onChange:t,isDark:a}){let[r,o]=useState(false),[s,n]=useState(String(e||""));return r?jsx("input",{autoFocus:true,type:"text",inputMode:"decimal",value:s,onClick:i=>i.stopPropagation(),onChange:i=>n(i.target.value.replace(/[^0-9.]/g,"")),onBlur:()=>{let i=parseFloat(s);!isNaN(i)&&i>=0&&i<=100?t(i):s===""&&t(0),o(false);},onKeyDown:i=>{i.key==="Enter"&&i.target.blur(),i.key==="Escape"&&(n(String(e||"")),o(false));},className:u("w-14 text-xs text-right font-mono px-1 py-0.5 rounded border outline-none",a?"bg-white/5 border-[#00E5CC]/50 text-white":"bg-gray-50 border-blue-400 text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"}}):jsx("button",{onClick:i=>{i.stopPropagation(),n(String(e||"")),o(true);},className:u("text-xs font-mono cursor-pointer hover:underline",e>0?a?"text-white/80":"text-gray-700":a?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:e>0?`${e}%`:"\u2014"})}function Og({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:i=[],customFields:c=[],toolbarRightContent:l}){let{theme:p="dark",locale:d="en",customTranslations:m,showSearch:g=true,showHierarchy:b=true,tableColumns:h,allowColumnCustomization:v=true,allowColumnResize:f=true,enableContextMenu:y=true,showCreateTaskButton:w=false,onCreateTask:x,persistFilter:T=false,financialBlur:k,healthSidebar:S,lens:C="hours",hourlyRate:I=0,aggregateParentHours:$=false,showProjectTotals:A=false}=t,_=Si(d,m),E=p==="dark",me=useCallback(()=>{if(!T||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let M=localStorage.getItem(T);if(M){let J=JSON.parse(M);return {statusFilter:J.statusFilter||"all",hideCompleted:J.hideCompleted||!1}}}catch(M){console.error("Error loading persisted filter:",M);}return {statusFilter:"all",hideCompleted:false}},[T]),L=useMemo(()=>{function M(J){let ye=0,Ie=0,$e=0;for(let B of J)if(B.subtasks&&B.subtasks.length>0){let z=M(B.subtasks);ye+=z.spent,Ie+=z.allocated,$e+=z.quoted;}else ye+=B.timeLoggedMinutes??0,Ie+=B.effortMinutes??0,$e+=B.soldEffortMinutes??0;return {spent:ye,allocated:Ie,quoted:$e}}return M(e)},[e]),X=useMemo(()=>{let M=new Map;function J(ye){let Ie=0;for(let $e of ye)if($e.subtasks&&$e.subtasks.length>0){let B=J($e.subtasks);M.set($e.id,B),Ie+=B;}else Ie+=$e.weight||0;return Ie}return J(e),M},[e]),ee=useMemo(()=>!S?.enabled||!S.data?S:{...S,data:{...S.data,totalHoursSpentMinutes:L.spent,totalHoursAllocatedMinutes:L.allocated}},[S,L]),[ze,O]=useState(true),[j,he]=useState("position"),[je,U]=useState("asc"),[oe,te]=useState(""),[Fe,we]=useState(()=>me().statusFilter),[Re,Ue]=useState(()=>me().hideCompleted),[Qe,ae]=useState(h||Q1),[tt,pe]=useState(false),[at,mt]=useState(false),[Ft,Te]=useState({isOpen:false,x:0,y:0,type:"task"}),[rt,lt]=useState("all"),[Ze,H]=useState(false),de=useRef(null),N=useRef(null),Y=useMemo(()=>{let M=0;function J(ye,Ie){for(let $e of ye)Ie>M&&(M=Ie),$e.subtasks?.length&&J($e.subtasks,Ie+1);}return J(e,1),M},[e]);useEffect(()=>{if(!Ze)return;let M=J=>{de.current?.contains(J.target)||N.current?.contains(J.target)||H(false);};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[Ze]),useEffect(()=>{if(rt==="all"){let ye=function(Ie){for(let $e of Ie)$e.subtasks?.length&&($e.isExpanded===false&&a.onTaskToggleExpand?.($e.id),ye($e.subtasks));};ye(e);}else {let ye=function(Ie,$e){for(let B of Ie)if(B.subtasks?.length){let z=$e<rt,ne=B.isExpanded!==false;z!==ne&&a.onTaskToggleExpand?.(B.id),ye(B.subtasks,$e+1);}};ye(e,1);}},[rt]);let[ie,ke]=useState(null),[V,re]=useState(0),[Ve,De]=useState(0),We=useRef(null),[Ne,Ke]=useState(null),[ht,dt]=useState(null);useEffect(()=>{h&&ae(h);},[h]),useEffect(()=>{if(!(!T||typeof window>"u"))try{localStorage.setItem(T,JSON.stringify({statusFilter:Fe,hideCompleted:Re}));}catch(M){console.error("Error persisting filter state:",M);}},[T,Fe,Re]);let nt=useMemo(()=>{let M=new Set;function J(ye){for(let Ie of ye)Ie.subtasks?.length&&(Ie.isExpanded!==false&&M.add(Ie.id),J(Ie.subtasks));}return J(e),M},[e]),et=useMemo(()=>Qe.filter(M=>M.visible),[Qe]),Lt=useCallback(M=>{a.onTaskToggleExpand?.(M);},[a]),Pt=useCallback(M=>{j===M?U(J=>J==="asc"?"desc":"asc"):(he(M),U("asc")),a.onSortChange?.({column:M,direction:je==="asc"?"desc":"asc"});},[j,je,a]),gt=useCallback(M=>{ae(M),a.onColumnsChange?.(M);},[a]),vt=useCallback(M=>{let J=Qe.map(ye=>ye.id===M?{...ye,visible:false}:ye);gt(J);},[Qe,gt]),ft=useCallback((M,J)=>{he(M),U(J);},[]),At=useCallback((M,J,ye)=>{y&&(M.preventDefault(),Te({isOpen:true,x:M.clientX,y:M.clientY,type:J?"task":"header",task:J,columnId:ye}));},[y]),Ge=useCallback(()=>{Te(M=>({...M,isOpen:false}));},[]),Oe=useCallback((M,J)=>{if(!f)return;M.preventDefault(),M.stopPropagation();let ye=Qe.find(Ie=>Ie.id===J);ye&&(ke(J),re(M.clientX),De(ye.width));},[Qe,f]);useEffect(()=>{if(!ie)return;let M=ye=>{let Ie=ye.clientX-V,$e=Math.max(50,Ve+Ie),B=Qe.map(z=>z.id===ie?{...z,width:$e}:z);ae(B);},J=()=>{ie&&a.onColumnsChange?.(Qe),ke(null);};return document.addEventListener("mousemove",M),document.addEventListener("mouseup",J),()=>{document.removeEventListener("mousemove",M),document.removeEventListener("mouseup",J);}},[ie,V,Ve,Qe,a]);let pt=useCallback((M,J)=>{if(J==="name"){M.preventDefault();return}Ke(J),M.dataTransfer.effectAllowed="move",M.dataTransfer.setData("text/plain",J),M.currentTarget instanceof HTMLElement&&(M.currentTarget.style.opacity="0.5");},[]),le=useCallback(M=>{M.currentTarget instanceof HTMLElement&&(M.currentTarget.style.opacity="1"),Ke(null),dt(null);},[]),fe=useCallback((M,J)=>{M.preventDefault(),J!=="name"&&(M.dataTransfer.dropEffect="move",dt(J));},[]),P=useCallback(()=>{dt(null);},[]),K=useCallback((M,J)=>{if(M.preventDefault(),!Ne||Ne===J||J==="name")return;let ye=[...Qe],Ie=ye.findIndex(z=>z.id===Ne),$e=ye.findIndex(z=>z.id===J);if(Ie===-1||$e===-1)return;let B=ye.splice(Ie,1);B[0]&&(ye.splice($e,0,B[0]),gt(ye),Ke(null),dt(null));},[Ne,Qe,gt]),q=useCallback(async M=>{if(a.onCreateCustomField){let J={...M,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(J);}mt(false);},[a]),ce=useCallback(M=>M.progress===100||M.status==="completed"?"completed":M.progress&&M.progress>0||M.status==="in-progress"?"in-progress":"todo",[]),Se=useMemo(()=>{let M=Rg(e);if(oe.trim()){let J=oe.toLowerCase();M=M.filter(ye=>ye.name.toLowerCase().includes(J));}return Fe!=="all"&&(M=M.filter(J=>ce(J)===Fe)),Re&&(M=M.filter(J=>ce(J)!=="completed")),M.sort((J,ye)=>{let Ie,$e;switch(j){case "name":Ie=J.name.toLowerCase(),$e=ye.name.toLowerCase();break;case "startDate":Ie=J.startDate?.getTime()||0,$e=ye.startDate?.getTime()||0;break;case "endDate":Ie=J.endDate?.getTime()||0,$e=ye.endDate?.getTime()||0;break;case "progress":Ie=J.progress||0,$e=ye.progress||0;break;case "status":Ie=J.status||"todo",$e=ye.status||"todo";break;case "priority":let B={urgent:0,high:1,medium:2,low:3,none:4};Ie=B[J.priority]??4,$e=B[ye.priority]??4;break;case "position":return 0;default:return 0}return Ie<$e?je==="asc"?-1:1:Ie>$e?je==="asc"?1:-1:0}),M},[e,oe,Fe,Re,j,je,ce]),Xe=useCallback((M,J)=>{let ye=B=>{a.onTaskUpdate?.({...M,...B});},Ie=B=>B?M.customFields?.find(ne=>ne.fieldId===B)?.value:void 0,$e=(B,z)=>{if(!B)return;let D=[...M.customFields||[]],Q=D.findIndex(Ce=>Ce.fieldId===B);Q>=0?D[Q]={fieldId:B,value:z}:D.push({fieldId:B,value:z}),ye({customFields:D});};switch(J.type){case "name":return null;case "status":return jsx(Dm,{value:M.status||(M.progress===100?"completed":M.progress&&M.progress>0?"in-progress":"todo"),onChange:z=>{ye({status:z,progress:z==="completed"?100:z==="in-progress"?50:0});},isDark:E,locale:d,translations:_.status});case "priority":return jsx(Em,{value:M.priority,onChange:z=>ye({priority:z}),isDark:E,locale:d});case "assignees":{let z=M.hasChildren,ne=M.assignees||[];if(z&&M.subtasks?.length){let D=new Map;(M.assignees||[]).forEach(Ce=>D.set(Ce.name,Ce));let Q=Ce=>{(Ce||[]).forEach(Ee=>{(Ee.assignees||[]).forEach(yt=>{D.has(yt.name)||D.set(yt.name,yt);}),Ee.subtasks?.length&&Q(Ee.subtasks);});};Q(M.subtasks),ne=Array.from(D.values());}return jsx(Am,{value:ne,availableUsers:i,onChange:D=>ye({assignees:D}),isDark:E,locale:d,disabled:z})}case "startDate":return jsx(Mi,{value:M.startDate,onChange:z=>ye({startDate:z}),isDark:E,locale:d,dateField:"start",startDate:M.startDate,endDate:M.endDate});case "endDate":return jsx(Mi,{value:M.endDate,onChange:z=>ye({endDate:z}),isDark:E,locale:d,dateField:"end",startDate:M.startDate,endDate:M.endDate});case "progress":return jsx($m,{value:M.progress||0,onChange:z=>{let ne=z===100?"completed":z>0?"in-progress":"todo";ye({progress:z,status:ne});},isDark:E});case "tags":return jsx(Xm,{value:M.tags||[],isDark:E});case "text":return jsx(Um,{value:Ie(J.customFieldId)||"",onChange:z=>$e(J.customFieldId,z),isDark:E});case "number":return jsx(Gm,{value:Ie(J.customFieldId)||0,onChange:z=>$e(J.customFieldId,z),isDark:E});case "date":let B=Ie(J.customFieldId);return jsx(Mi,{value:B?new Date(B):void 0,onChange:z=>$e(J.customFieldId,z),isDark:E,locale:d});case "dropdown":return jsx(_m,{value:Ie(J.customFieldId)||"",options:J.options||[],onChange:z=>$e(J.customFieldId,z),isDark:E});case "checkbox":return jsx(Km,{value:Ie(J.customFieldId)||false,onChange:z=>$e(J.customFieldId,z),isDark:E});case "estimatedTime":{let z=M.status==="completed"||M.progress===100;return jsx(tr,{value:M.estimatedTime,onChange:ne=>ye({estimatedTime:ne}),isDark:E,locale:d,disabled:z,lens:C,hourlyRate:I})}case "quotedTime":{let z=M.status==="completed"||M.progress===100,ne=k?.enabled&&(!k.columns||k.columns.includes("quotedTime"));return jsx(tr,{value:M.quotedTime,onChange:D=>ye({quotedTime:D}),isDark:E,locale:d,disabled:z,isBlurred:ne,lens:C,hourlyRate:I})}case "elapsedTime":{let z=M.status==="completed"||M.progress===100;return jsx(tr,{value:M.elapsedTime,onChange:ne=>ye({elapsedTime:ne}),isDark:E,locale:d,disabled:z,lens:C,hourlyRate:I})}case "effortMinutes":{if($&&M.subtasks&&M.subtasks.length>0){let{allocated:Q,quoted:Ce}=Sn(M);if(C==="financial"&&I&&Q>0&&Ce>0){let Ee=Math.round(Q/60*I),st=Math.round(Ce/60*I)-Ee;return jsxs("div",{className:"flex items-center gap-1.5",children:[jsx(tr,{value:Q>0?Q:void 0,isDark:E,locale:d,disabled:true,lens:C,hourlyRate:I}),st!==0&&jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap",st>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[st>0?"+":"",st>=1e3?`$${(st/1e3).toFixed(1)}K`:`$${st}`]})]})}return jsx(tr,{value:Q>0?Q:void 0,isDark:E,locale:d,disabled:true,lens:C,hourlyRate:I})}let z=M.status==="completed"||M.progress===100,ne=M.effortMinutes||0,D=M.soldEffortMinutes||0;if(C==="financial"&&I&&ne>0&&D>0){let Q=Math.round(ne/60*I),Ee=Math.round(D/60*I)-Q;return jsxs("div",{className:"flex items-center gap-1.5",children:[jsx(tr,{value:ne,onChange:yt=>ye({effortMinutes:yt}),isDark:E,locale:d,disabled:z,lens:C,hourlyRate:I}),Ee!==0&&jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap",Ee>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Ee>0?"+":"",Math.abs(Ee)>=1e3?`$${(Ee/1e3).toFixed(1)}K`:`$${Ee}`]})]})}return jsx(tr,{value:ne,onChange:Q=>ye({effortMinutes:Q}),isDark:E,locale:d,disabled:z,lens:C,hourlyRate:I})}case "timeLoggedMinutes":{if($&&M.subtasks&&M.subtasks.length>0){let{spent:ne}=Sn(M);return jsx(tr,{value:ne>0?ne:void 0,isDark:E,locale:d,disabled:true,lens:C,hourlyRate:I})}let z=M.status==="completed"||M.progress===100;return jsx(tr,{value:M.timeLoggedMinutes,onChange:a.onLogTime?ne=>{a.onLogTime?.(M,ne);}:void 0,isDark:E,locale:d,placeholder:d==="es"?"Agregar":"Add",disabled:z,lens:C,hourlyRate:I})}case "soldEffortMinutes":{if($&&M.subtasks&&M.subtasks.length>0){let{quoted:D}=Sn(M),Q=k?.enabled&&(!k.columns||k.columns.includes("soldEffortMinutes"));return jsx(tr,{value:D>0?D:void 0,isDark:E,locale:d,disabled:true,isBlurred:Q,lens:C,hourlyRate:I})}let z=M.status==="completed"||M.progress===100,ne=k?.enabled&&(!k.columns||k.columns.includes("soldEffortMinutes"));return jsx(tr,{value:M.soldEffortMinutes,onChange:D=>ye({soldEffortMinutes:D}),isDark:E,locale:d,disabled:z,isBlurred:ne,lens:C,hourlyRate:I})}case "scheduleVariance":{let z=M.effortMinutes||0,ne=M.soldEffortMinutes||0,D=M.timeLoggedMinutes||0,Q=z>0||ne>0||D>0;return jsx(eg,{startDate:M.startDate,endDate:M.endDate,scheduleVariance:M.scheduleVariance,isDark:E,locale:d,hasTimeAllocated:Q})}case "hoursBar":{if($&&M.hasChildren){let{spent:z,allocated:ne,quoted:D}=Sn(M),Q=z>ne&&ne>0;return jsxs("span",{className:u("text-[11px] font-mono flex items-center gap-1.5",E?"text-white/50":"text-gray-500"),children:[jsx("span",{className:u("font-bold",Q?"text-[#FF453A]":E?"text-white/80":"text-gray-800"),children:Dn(z)}),ne>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:E?"text-white/60":"text-gray-600",children:Dn(ne)})]}),D>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:E?"text-amber-400/70":"text-amber-600",children:Dn(D)})]})]})}return jsx(ag,{task:M,isDark:E,locale:d,onLogTime:a.onLogTime,onEstimateUpdate:a.onEstimateUpdate,onSoldEffortUpdate:a.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:a.onOpenTimeLog,lens:C,hourlyRate:I})}case "teamLoad":return jsx(og,{task:M,isDark:E,locale:d});case "blockers":return jsx(sg,{blockers:M.blockers,isDark:E,locale:d});case "weight":{let z=X.get(M.id);if(z!==void 0)return jsx("span",{className:u("text-xs font-mono",z>0?E?"text-white/50":"text-gray-400":E?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:z>0?`${Number(z.toFixed(2))}%`:"\u2014"});let ne=M.weight||0;return jsx(tw,{value:ne,onChange:D=>ye({weight:D}),isDark:E})}default:return jsx("span",{className:u("text-sm",E?"text-white/60":"text-gray-500"),children:"-"})}},[a,E,d,i,_,$,X]),_e=useCallback(M=>{let ye={name:_.columns.name,status:_.columns.status,priority:_.columns.priority,assignees:_.columns.assignees,startDate:_.columns.startDate,endDate:_.columns.endDate,progress:_.columns.progress,tags:_.columns.tags||(d==="es"?"Etiquetas":"Tags"),estimatedTime:_.columns.estimatedTime||(d==="es"?"Estimado":"Estimated"),quotedTime:_.columns.quotedTime||(d==="es"?"Ofertado":"Quoted"),elapsedTime:_.columns.elapsedTime||(d==="es"?"Ejecutado":"Executed"),soldEffortMinutes:_.columns.soldEffortMinutes||(d==="es"?"Ofertado":"Quoted"),effortMinutes:_.columns.effortMinutes||(d==="es"?"Estimado":"Estimated"),timeLoggedMinutes:_.columns.timeLoggedMinutes||(d==="es"?"Ejecutado":"Executed"),scheduleVariance:_.columns.scheduleVariance||(d==="es"?"Prog / Var":"Sched / Var"),hoursBar:_.columns.hoursBar||(d==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:_.columns.teamLoad||(d==="es"?"Equipo":"Team"),blockers:_.columns.blockers||(d==="es"?"Bloqueantes":"Blockers"),weight:_.columns.weight||(d==="es"?"Peso":"Weight")}[M.type]||M.label;return typeof ye=="string"?ye:String(ye||M.type)},[_,d]),Be=useMemo(()=>{let ye=et.reduce(($e,B)=>$e+B.width,0)+(v?48:0),Ie={};for(let $e of et)Ie[$e.id]=`${$e.width/ye*100}%`;return Ie},[et,v]);return r?jsx("div",{className:u("flex-1 flex items-center justify-center",E?"bg-[#0D0D0D]":"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-[#007BFF]"}),jsxs("p",{className:u("text-sm",E?"text-white/60":"text-gray-600"),children:[_.empty.noTasks,"..."]})]})}):o?jsx("div",{className:u("flex-1 flex items-center justify-center",E?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxs("div",{children:[jsx("h3",{className:u("text-lg font-semibold mb-2",E?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:u("text-sm",E?"text-white/60":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsx("div",{className:u("flex-1 flex items-center justify-center",E?"bg-[#0D0D0D]":"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-[#007BFF]/10 flex items-center justify-center",children:jsx(List,{className:"w-8 h-8 text-[#007BFF]"})}),jsx("h3",{className:u("text-lg font-semibold mb-2",E?"text-white":"text-gray-900"),children:_.empty.noTasks}),jsx("p",{className:u("text-sm",E?"text-white/60":"text-gray-600"),children:_.empty.addFirstTask})]})}):jsxs("div",{ref:We,className:u(E?"bg-[#0D0D0D]":"bg-white",ie&&"select-none",s),style:{display:"flex",flexDirection:"column",flex:"1 1 0%",width:"100%",height:"100%",overflow:"hidden",minHeight:0,...n},children:[jsx("div",{className:u("flex-shrink-0 px-6 py-4 border-b",E?"border-[#222]":"border-gray-200"),children:jsxs("div",{className:"flex items-center gap-4",children:[jsxs("div",{className:u("text-sm",E?"text-white/60":"text-gray-600"),children:[Se.length," ",_.pagination.tasks]}),g&&jsxs("div",{className:"relative flex-1 max-w-md",children:[jsx(Search,{className:u("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",E?"text-white/60":"text-gray-400")}),jsx("input",{type:"text",value:oe,onChange:M=>te(M.target.value),placeholder:_.toolbar.searchPlaceholder,className:u("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",E?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30 font-mono":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsx("div",{className:"flex-1"}),l&&jsx("div",{className:"flex items-center gap-2",children:l}),b&&Y>1&&jsxs("div",{className:"relative",children:[jsxs("button",{ref:de,onClick:()=>H(!Ze),className:u("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border transition-colors text-[11px] font-medium",E?Ze?"bg-blue-500/10 border-blue-500/40 text-blue-400":"bg-white/[0.03] border-[#333] text-white/50 hover:text-white/70 hover:bg-white/[0.05]":Ze?"bg-blue-50 border-blue-300 text-blue-600":"bg-gray-100 border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-200"),style:{fontFamily:"'JetBrains Mono', monospace"},children:[jsx(Layers,{className:"w-3.5 h-3.5"}),rt==="all"?d==="es"?"Todos":"All":`L${rt}`]}),Ze&&jsx("div",{ref:N,className:u("absolute top-full mt-1 right-0 w-24 rounded-lg border overflow-hidden z-50 shadow-lg",E?"bg-[#1A1A1A] border-[#333]":"bg-white border-gray-200"),children:[{value:"all",label:d==="es"?"Todos":"All"},...Array.from({length:Math.min(Y,5)},(M,J)=>({value:J+1,label:`L${J+1}`}))].map(M=>jsxs("button",{onClick:()=>{lt(M.value),H(false);},className:u("w-full px-3 py-2 text-left text-xs transition-colors flex items-center justify-between",E?rt===M.value?"bg-blue-500/10 text-blue-400":"text-white/60 hover:bg-white/[0.05] hover:text-white/80":rt===M.value?"bg-blue-50 text-blue-600":"text-gray-600 hover:bg-gray-100"),children:[jsx("span",{children:M.label}),rt===M.value&&jsx("span",{className:"text-blue-400",children:"\u2713"})]},String(M.value)))})]}),jsx(Eg,{value:Fe,hideCompleted:Re,onChange:we,onHideCompletedChange:Ue,isDark:E,locale:d}),ee?.enabled&&ee.data&&!ze&&jsx("button",{onClick:()=>O(true),className:u("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",E?"border-[#333] text-white/40 hover:text-white/70 hover:bg-white/[0.05]":"border-gray-200 text-gray-400 hover:text-gray-600 hover:bg-gray-100"),title:d==="es"?"Abrir panel de salud":"Open health panel",children:jsx(PanelRight,{className:"w-4 h-4"})}),w&&x&&jsxs(motion.button,{onClick:x,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-[transform,box-shadow]",style:{background:"linear-gradient(135deg, #007BFF 0%, #005FCC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 123, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 123, 255, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-4 h-4"}),jsx("span",{children:_.toolbar.newTask})]})]})}),jsxs("div",{style:{display:"flex",flex:"1 1 0%",overflow:"hidden",minHeight:0},children:[jsx("div",{style:{flex:"1 1 0%",overflow:"auto",minHeight:0},children:jsxs("div",{style:{width:"100%"},children:[jsxs("div",{className:u("flex-shrink-0 flex items-center border-b text-[9px] font-bold uppercase tracking-wider sticky top-0 z-10",E?"border-[#222] bg-[#1A1A1A] font-mono":"border-gray-200 bg-gray-50"),children:[et.map(M=>{let J=M.id!=="name",ye=ht===M.id&&Ne!==M.id;return jsxs("div",{className:u("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",E?"text-white/60":"text-gray-500",J&&"cursor-grab",Ne===M.id&&"opacity-50",ye&&(E?"bg-[#007BFF]/20 border-l-2 border-l-[#007BFF]":"bg-blue-50 border-l-2 border-l-blue-400")),style:{width:Be[M.id],minWidth:M.minWidth},draggable:J,onDragStart:J?Ie=>pt(Ie,M.id):void 0,onDragEnd:J?le:void 0,onDragOver:J?Ie=>fe(Ie,M.id):void 0,onDragLeave:J?P:void 0,onDrop:J?Ie=>K(Ie,M.id):void 0,onContextMenu:Ie=>At(Ie,void 0,M.id),children:[J&&jsx(GripVertical,{className:u("w-3 h-3 flex-shrink-0 transition-opacity",E?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),M.sortable?jsxs("button",{draggable:false,onClick:()=>Pt(M.id),className:"flex items-center gap-1 hover:text-[#007BFF]",children:[_e(M),jsx(ArrowUpDown,{className:u("w-3 h-3",j===M.id&&"text-[#007BFF]")})]}):jsx("span",{draggable:false,children:_e(M)}),f&&M.resizable&&jsx("div",{className:u("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#007BFF]",ie===M.id&&"bg-[#007BFF]"),onMouseDown:Ie=>Oe(Ie,M.id)})]},M.id)}),v&&jsxs("div",{className:"relative flex items-center justify-center px-3 py-0.5",children:[jsx("button",{onClick:M=>{M.stopPropagation(),pe(J=>!J);},className:u("p-0.5 rounded transition-colors",E?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",tt&&(E?"bg-white/[0.05]":"bg-gray-200")),title:d==="es"?"Agregar columna":"Add column",children:jsx(Plus,{className:"w-3 h-3"})}),jsx(wg,{isOpen:tt,onClose:()=>pe(false),columns:Qe,customFields:c,onColumnsChange:gt,onCreateCustomField:()=>{pe(false),mt(true);},isDark:E,locale:d})]})]}),jsx(AnimatePresence,{mode:"popLayout",children:Se.map((M,J)=>{let ye=nt.has(M.id),Ie=Math.min(J*.01,.2),$e=M.hasChildren&&M.level===0,B=M.subtasks?.length||0;if($e){let{spent:z,allocated:ne,quoted:D}=Sn(M),Q=Z1(M),Ce=ew(M);return jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:Ie},className:u("flex items-center border-y cursor-pointer",E?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100"),onClick:()=>a.onTaskClick?.(M),children:et.map(Ee=>jsx("div",{className:"flex items-center px-4 py-2.5",style:{width:Be[Ee.id],minWidth:Ee.minWidth},children:Ee.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[jsx("button",{onClick:yt=>{yt.stopPropagation(),Lt(M.id);},className:u("p-0.5 rounded flex-shrink-0",E?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:ye?jsx(ChevronDown,{className:u("w-4 h-4",E?"text-white/40":"text-gray-500")}):jsx(ChevronRight,{className:u("w-4 h-4",E?"text-white/40":"text-gray-500")})}),jsx("span",{onClick:yt=>{yt.stopPropagation(),Lt(M.id);},className:"flex-shrink-0 cursor-pointer",children:ye?jsx(FolderOpen,{className:"w-4 h-4",style:{color:E?"#FFD60A":"#B45309"}}):jsx(Folder,{className:"w-4 h-4",style:{color:E?"#FFD60A":"#B45309"}})}),M.wbsCode&&jsx("span",{className:"text-[10px] font-mono flex-shrink-0",style:{color:E?"#FFD60A":"#B45309"},children:M.wbsCode}),jsx("span",{title:M.name,className:u("text-[11px] font-semibold uppercase tracking-wide truncate",E?"text-white":"text-gray-800"),style:{fontFamily:"Inter, system-ui, sans-serif",WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"},children:M.name}),jsxs("span",{className:u("text-[10px] font-mono px-2 py-0.5 rounded-full flex-shrink-0",E?"text-white/30 bg-white/[0.05]":"text-gray-500 bg-gray-200"),children:["(",B," ",d==="es"?B===1?"Tarea":"Tareas":B===1?"Item":"Items",")"]}),Q!==null&&jsxs("span",{className:u("text-[10px] font-mono flex-shrink-0",Q>=1?"text-[#32D74B]":Q>=.8?"text-[#FFD60A]":"text-[#FF453A]"),children:["Avg SPI: ",Q.toFixed(2)]}),Ce>0&&jsxs("span",{className:"text-[10px] font-mono text-[#FF453A] flex-shrink-0",children:[d==="es"?"Conflicto":"Conflict",": ",Ce]})]}):Ee.type==="timeLoggedMinutes"?jsx(tr,{value:z>0?z:void 0,isDark:E,locale:d,disabled:true,lens:C,hourlyRate:I}):Ee.type==="soldEffortMinutes"?jsx(tr,{value:D>0?D:void 0,isDark:E,locale:d,disabled:true,lens:C,hourlyRate:I}):Ee.type==="effortMinutes"?jsx(tr,{value:ne>0?ne:void 0,isDark:E,locale:d,disabled:true,lens:C,hourlyRate:I}):Xe(M,Ee)},Ee.id))},M.id)}return jsxs(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:Ie},className:u("flex items-center border-b transition-colors",E?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50"),onClick:()=>a.onTaskClick?.(M),onDoubleClick:()=>a.onTaskDoubleClick?.(M),onContextMenu:z=>At(z,M),children:[et.map(z=>jsx("div",{className:"flex items-center px-4 py-3 min-h-[56px]",style:{width:Be[z.id],minWidth:z.minWidth},children:z.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[b&&M.level>0&&jsx("div",{style:{width:`${M.level*24}px`},className:"flex-shrink-0"}),b&&M.hasChildren&&jsx("button",{onClick:ne=>{ne.stopPropagation(),Lt(M.id);},className:u("p-0.5 rounded flex-shrink-0",E?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:ye?jsx(ChevronDown,{className:u("w-4 h-4",E?"text-white/60":"text-gray-400")}):jsx(ChevronRight,{className:u("w-4 h-4",E?"text-white/60":"text-gray-400")})}),b&&!M.hasChildren&&jsx("div",{className:"w-5 flex-shrink-0"}),jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(M.wbsCode||M.taskCode)&&jsxs("div",{className:"flex items-center gap-1.5",children:[M.wbsCode&&jsx("span",{className:u("text-[10px] font-mono",E?"text-[#007BFF]":"text-blue-600"),children:M.wbsCode}),M.taskCode&&jsx("span",{className:u("text-[10px] font-mono",E?"text-white/40":"text-gray-400"),children:M.taskCode})]}),jsx("span",{className:u("truncate font-bold text-[13px]",M.progress===100?E?"line-through text-white/50":"line-through text-gray-400":E?"text-white":"text-gray-900"),children:M.name}),M.tags?.[0]&&jsx("span",{className:"text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",style:{backgroundColor:`${M.tags[0].color}20`,color:M.tags[0].color},children:M.tags[0].name})]})]}):Xe(M,z)},z.id)),v&&jsx("div",{className:"w-12 flex-shrink-0"})]},M.id)})}),A&&Se.length>0&&(()=>{let{spent:M,allocated:J,quoted:ye}=L,Ie=J-M,$e=Ie<0,B=$e?`+${Dn(Math.abs(Ie))} ${d==="es"?"EXCEDIDO":"OVER"}`:`-${Dn(Ie)} ${d==="es"?"AHORRADO":"SAVED"}`,z=C==="financial"&&I>0,ne=Ce=>z?`$${(Ce/60*I).toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:0})}`:Dn(Ce),D=z?Math.abs(Ie/60*I):0,Q=z?`${$e?"+":"-"}$${D.toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:0})} ${$e?d==="es"?"EXCEDIDO":"OVER":d==="es"?"AHORRADO":"SAVED"}`:B;return jsxs("div",{className:u("flex items-center sticky bottom-0 z-10",E?"border-t border-[#2A2A3A]":"border-t border-gray-300"),style:{backgroundColor:E?"rgba(13, 17, 23, 0.95)":"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[et.map(Ce=>jsx("div",{className:"flex items-center px-4 py-3",style:{width:Be[Ce.id],minWidth:Ce.minWidth},children:Ce.type==="name"?jsx("span",{className:u("text-[11px] font-black uppercase tracking-widest",E?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:d==="es"?"TOTAL PROYECTO":"TOTAL PROJECT"}):Ce.type==="hoursBar"?jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsx("span",{className:u("text-[12px] font-bold",E?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:ne(M)}),jsx("span",{className:u("text-[11px]",E?"text-white/40":"text-gray-400"),children:"/"}),jsx("span",{className:u("text-[11px]",E?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:ne(J)}),J>0&&jsx("span",{className:u("text-[10px] font-semibold ml-1",$e?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:z?Q:B})]}):Ce.type==="soldEffortMinutes"?jsx("span",{className:u("text-[12px] font-bold",E?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:ye>0?ne(ye):"\u2013"}):Ce.type==="effortMinutes"?(()=>{if(z&&ye>0&&J>0){let Ee=Math.round(ye/60*(I||25)),yt=Math.round(J/60*(I||25)),st=Ee-yt,ta=Ee>0?Math.round(st/Ee*100):0;return jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:u("text-[12px] font-bold",E?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:ne(J)}),jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap",st>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[st>=0?"+":"",Math.abs(st)>=1e3?`$${(st/1e3).toFixed(1)}K`:`$${st}`,jsxs("span",{className:"ml-0.5 opacity-60",children:["(",ta,"%)"]})]})]})}return jsx("span",{className:u("text-[12px] font-bold",E?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:J>0?ne(J):"\u2013"})})():Ce.type==="timeLoggedMinutes"?jsx("span",{className:u("text-[12px] font-bold",E?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:M>0?ne(M):"\u2013"}):Ce.type==="progress"?(()=>{let Ee=e||[],yt=0,st=0,ta=0,oa=0;for(let Ut of Ee){let pa=Ut.weight||X.get(Ut.id)||0,Mn=Ut.progress||0;pa>0&&(yt+=Mn*pa,st+=pa),ta+=Mn,oa++;}let va=st>0?Math.round(yt/st*10)/10:oa>0?Math.round(ta/oa):0;return jsxs("span",{className:u("text-[12px] font-bold font-mono",E?"text-[#00E5CC]":"text-cyan-600"),style:{fontFamily:"JetBrains Mono, monospace"},children:[va,"%"]})})():Ce.type==="weight"?(()=>{let Ee=e||[],yt=[],st=Ut=>{for(let pa of Ut)yt.push(pa),pa.subtasks?.length&&st(pa.subtasks);};st(Ee);let oa=yt.filter(Ut=>!Ut.subtasks?.length||Ut.subtasks.length===0).reduce((Ut,pa)=>Ut+(pa.weight||0),0),va=Math.abs(oa-100)<.1;return jsxs("span",{className:u("text-[12px] font-bold font-mono",va?E?"text-[#22C55E]":"text-green-600":"text-[#EF4444]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Number(oa.toFixed(1)),"%"]})})():jsx("span",{className:u("text-[11px]",E?"text-white/30":"text-gray-300"),children:"\u2013"})},Ce.id)),v&&jsx("div",{className:"w-12 flex-shrink-0"})]})})(),Se.length===0&&oe&&jsx("div",{className:"flex items-center justify-center py-12",children:jsxs("div",{className:"text-center",children:[jsx(List,{className:u("w-12 h-12 mx-auto mb-4",E?"text-white/30":"text-gray-400")}),jsx("p",{className:u(E?"text-white/60":"text-gray-600"),children:_.empty.noResults})]})})]})}),ee?.enabled&&ee.data&&ze&&jsx(Mg,{data:ee.data,isDark:E,locale:d,onClose:()=>O(false),lens:t?.lens})]}),jsx(cg,{state:Ft,onClose:Ge,isDark:E,locale:d,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:vt,onColumnSort:ft,availableUsers:i,onOpenTimeLog:a.onOpenTimeLog,onReportBlocker:a.onReportBlocker,onCopyTaskLink:a.onCopyTaskLink}),jsx(Tg,{isOpen:at,onClose:()=>mt(false),onSave:q,isDark:E,locale:d})]})}var $g=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,visible:true,sortable:true,resizable:true},{id:"priority",type:"priority",label:"Priority",width:100,visible:false,sortable:true,resizable:true},{id:"assignees",type:"assignees",label:"Assignees",width:150,visible:false,sortable:false,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true},{id:"tags",type:"tags",label:"Tags",width:150,visible:false,sortable:false,resizable:true},{id:"soldEffortMinutes",type:"soldEffortMinutes",label:"Quoted",width:100,visible:false,sortable:true,resizable:true},{id:"effortMinutes",type:"effortMinutes",label:"Estimated",width:100,visible:false,sortable:true,resizable:true},{id:"timeLoggedMinutes",type:"timeLoggedMinutes",label:"Executed",width:100,visible:false,sortable:true,resizable:true},{id:"scheduleVariance",type:"scheduleVariance",label:"Sched / Var",width:180,visible:false,sortable:true,resizable:true},{id:"hoursBar",type:"hoursBar",label:"Hours",width:200,visible:false,sortable:true,resizable:true},{id:"teamLoad",type:"teamLoad",label:"Team Load",width:160,visible:false,sortable:true,resizable:true},{id:"blockers",type:"blockers",label:"Blockers",width:150,visible:false,sortable:false,resizable:true},{id:"weight",type:"weight",label:"Weight",width:80,visible:false,sortable:true,resizable:true}],Hg=[{type:"name",labelKey:"columns.name",icon:"Type"},{type:"status",labelKey:"columns.status",icon:"CircleDot"},{type:"priority",labelKey:"columns.priority",icon:"Flag"},{type:"assignees",labelKey:"columns.assignees",icon:"Users"},{type:"startDate",labelKey:"columns.startDate",icon:"Calendar"},{type:"endDate",labelKey:"columns.endDate",icon:"CalendarCheck"},{type:"progress",labelKey:"columns.progress",icon:"BarChart"},{type:"tags",labelKey:"columns.tags",icon:"Tag"},{type:"effortMinutes",labelKey:"columns.effortMinutes",icon:"Clock"},{type:"timeLoggedMinutes",labelKey:"columns.timeLoggedMinutes",icon:"Timer"},{type:"soldEffortMinutes",labelKey:"columns.soldEffortMinutes",icon:"FileText"},{type:"scheduleVariance",labelKey:"columns.scheduleVariance",icon:"CalendarClock"},{type:"hoursBar",labelKey:"columns.hoursBar",icon:"BarChart3"},{type:"teamLoad",labelKey:"columns.teamLoad",icon:"Users"},{type:"blockers",labelKey:"columns.blockers",icon:"AlertTriangle"},{type:"weight",labelKey:"columns.weight",icon:"Scale"}],zg=[{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 jd={bgPrimary:"#0D0D0D",bgSecondary:"#141414",bgHover:"rgba(255,255,255,0.05)",bgSelected:"#0D131E",bgAlternate:"#141414",border:"#222222",borderLight:"#1A1A1A",textPrimary:"rgba(255,255,255,0.9)",textSecondary:"rgba(255,255,255,0.6)",textMuted:"rgba(255,255,255,0.3)",accent:"#007BFF",accentHover:"#2979FF",accentLight:"rgba(0,123,255,0.15)",statusTodo:"rgba(255,255,255,0.4)",statusInProgress:"#007BFF",statusCompleted:"#34D399",focusRing:"#007BFF",checkboxBg:"#1A1A1A",checkboxChecked:"#007BFF",bgGroupHeader:"#222222",headerBg:"#1A1A1A",neonRed:"#FF2D20",neonGreen:"#3BF06E",neonAmber:"#FFD60A",neonBlue:"#3B9EFF"},Kd={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgSelected:"#dbeafe",bgAlternate:"#f9fafb",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",checkboxBg:"#ffffff",checkboxChecked:"#0969da",bgGroupHeader:"#F3F4F6",headerBg:"#F9FAFB",neonRed:"#DC2626",neonGreen:"#16A34A",neonAmber:"#D97706",neonBlue:"#2E94FF"},Yd={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgSelected:"#0f4c7520",bgAlternate:"#1a1a2e80",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1",checkboxBg:"#1f3460",checkboxChecked:"#6366f1",bgGroupHeader:"#1f3460",headerBg:"#16213e",neonRed:"#EF4444",neonGreen:"#34D399",neonAmber:"#FBBF24",neonBlue:"#6366F1"},$i={dark:jd,light:Kd,neutral:Yd};function Ug(e){return $i[e]||$i.dark}var qd={navigation:{today:"Today",previous:"Previous",next:"Next",month:"Month",week:"Week",day:"Day"},weekdays:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},weekdaysFull:{sunday:"Sunday",monday:"Monday",tuesday:"Tuesday",wednesday:"Wednesday",thursday:"Thursday",friday:"Friday",saturday:"Saturday"},months:{january:"January",february:"February",march:"March",april:"April",may:"May",june:"June",july:"July",august:"August",september:"September",october:"October",november:"November",december:"December"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{allDay:"All day",moreEvents:"+{count} more",noEvents:"No tasks",newTask:"New Task",viewAll:"View all",week:"Week",backlogTitle:"BACKLOG / UNSCHEDULED",systemStatus:"SYSTEM STATUS",budgetUtil:"Budget Util.",variance:"VARIANCE",cost:"COST",estimate:"Est",sold:"Sold",cashOut:"Cash Out",typeToAdd:"Type to add (e.g., Crane Inspection)",critical:"CRITICAL",blocker:"Blocker",risk:"Risk",delay:"delay",days:"Days"},tooltips:{progress:"Progress",status:"Status",assignees:"Assignees",duration:"Duration",days:"days"}},Xd={navigation:{today:"Hoy",previous:"Anterior",next:"Siguiente",month:"Mes",week:"Semana",day:"D\xEDa"},weekdays:{sun:"Dom",mon:"Lun",tue:"Mar",wed:"Mi\xE9",thu:"Jue",fri:"Vie",sat:"S\xE1b"},weekdaysFull:{sunday:"Domingo",monday:"Lunes",tuesday:"Martes",wednesday:"Mi\xE9rcoles",thursday:"Jueves",friday:"Viernes",saturday:"S\xE1bado"},months:{january:"Enero",february:"Febrero",march:"Marzo",april:"Abril",may:"Mayo",june:"Junio",july:"Julio",august:"Agosto",september:"Septiembre",october:"Octubre",november:"Noviembre",december:"Diciembre"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{allDay:"Todo el d\xEDa",moreEvents:"+{count} m\xE1s",noEvents:"Sin tareas",newTask:"Nueva Tarea",viewAll:"Ver todo",week:"Semana",backlogTitle:"BACKLOG / SIN FECHA",systemStatus:"ESTADO DEL SISTEMA",budgetUtil:"Util. Presupuesto",variance:"VARIANZA",cost:"COSTO",estimate:"Est",sold:"Vendido",cashOut:"Desembolso",typeToAdd:"Escribe para agregar (ej: Inspecci\xF3n)",critical:"CR\xCDTICO",blocker:"Bloqueador",risk:"Riesgo",delay:"retraso",days:"D\xEDas"},tooltips:{progress:"Progreso",status:"Estado",assignees:"Asignados",duration:"Duraci\xF3n",days:"d\xEDas"}},Hi={en:qd,es:Xd};function ls(e){return Hi[e]||Hi.en}function zi(e,t){let a=ls(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 Wg(e){let t=ls(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 Vg(e,t=0,a=true){let r=ls(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 cs(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 Qd(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 jg({task:e,isDark:t}){return e.progress===100||e.status==="completed"?jsx(CheckCircle2,{className:"w-3 h-3 text-emerald-400 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsx(PlayCircle,{className:"w-3 h-3 text-[#007FFF] flex-shrink-0"}):jsx(Circle,{className:u("w-3 h-3 flex-shrink-0",t?"text-white/40":"text-gray-400")})}var qg=26,dw=22,cw=10;function Kg(e,t){let a=Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()),r=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate());return Math.round((a-r)/(1e3*60*60*24))}function Zd(e,t="hours",a=0){if(!e||e<=0)return null;if(t==="financial"&&a>0){let o=Math.round(e/60*a);return o>=1e3?`$${(o/1e3).toFixed(1)}k`:`$${o}`}let r=Math.round(e/480);return r>0?`${r}d`:null}function Xg(e,t="hours",a=0){if(e.soldEffortMinutes==null||e.effortMinutes==null)return null;let r=e.soldEffortMinutes-e.effortMinutes;if(r===0)return null;let o=r<0,s;if(t==="financial"&&a>0){let n=Math.round(Math.abs(r/60)*a);s=n>=1e3?`$${(n/1e3).toFixed(1)}k`:`$${n}`;}else {let n=Math.round(Math.abs(r)/60);s=n>=1e3?`$${(n/1e3).toFixed(1)}k`:`$${n}`;}return {text:`${o?"-":"+"}${s}`,isNegative:o}}function Yg(e,t="hours",a=0){if(t==="financial"&&a>0){let o=Math.round(Math.abs(e/60)*a);return o>=1e3?`$${(o/1e3).toFixed(1)}k`:`$${o}`}let r=Math.round(Math.abs(e)/60);return r>=1e3?`$${(r/1e3).toFixed(1)}k`:`$${r}`}function uw({segment:e,isDark:t,onClick:a,blurFinancials:r,isSelected:o,t:s,lens:n="hours",hourlyRate:i=0}){let{task:c,spanCols:l,lane:p,isStart:d,isEnd:m}=e,g=c.progress===100||c.status==="completed",b=c.isCriticalPath,h=d&&m?"rounded":d?"rounded-l":m?"rounded-r":"",v=m?Zd(c.effortMinutes,n,i):null,f=m?Xg(c,n,i):null,y=m?c.blockers?.find(w=>w.severity==="critical"):null;return jsxs(motion.button,{onClick:w=>{w.stopPropagation(),a();},whileHover:{scale:1.005},className:u("absolute flex items-center gap-1.5 px-2 text-xs cursor-pointer overflow-hidden",h,g?t?"text-emerald-400":"bg-emerald-500/10 text-emerald-600 border border-emerald-200":b?t?"text-white/90":"bg-red-50 border border-red-200 text-red-700 hover:border-red-300":t?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:{top:`${p*qg}px`,left:"1px",width:`calc(${l*100}% - 2px)`,height:`${dw}px`,zIndex:10,...t?g?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:b?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:{},borderLeftWidth:d?"3px":void 0,borderLeftColor:d?b?"#EF4444":g?"#10B981":"#1264FF":void 0,...o?{boxShadow:t?"0 0 0 1.5px rgba(0, 229, 255, 0.7), 0 0 12px rgba(0, 229, 255, 0.3)":"0 0 0 1.5px rgba(59, 130, 246, 0.7), 0 0 12px rgba(59, 130, 246, 0.2)",zIndex:20}:{}},children:[b&&d&&jsxs("span",{className:"text-[9px] font-mono font-bold text-red-400 uppercase tracking-wider flex-shrink-0",children:[s.labels.critical,":"]}),jsx("span",{className:"truncate flex-1 text-left font-medium",children:c.name}),m&&(v||f)&&jsxs("span",{className:"flex items-center gap-1 flex-shrink-0 text-[9px] font-mono text-white/35 ml-1",children:[v&&jsxs("span",{children:[s.labels.estimate,": ",v]}),f&&jsxs(Fragment,{children:[jsx("span",{className:"text-white/15",children:"|"}),jsx("span",{className:u(f.isNegative?"text-red-400":"text-emerald-400",r&&"blur-sm select-none"),children:f.text})]})]}),y&&jsxs("span",{className:"flex-shrink-0 text-[8px] font-mono px-1.5 py-0.5 rounded bg-red-500/20 text-red-400 border border-red-500/30 ml-1",children:[s.labels.blocker,": ",y.type]}),c.progress>0&&c.progress<100&&jsx("div",{className:"absolute bottom-0 left-0 h-[2px] bg-[#1264FF]",style:{width:`${c.progress}%`}})]})}function Jg({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:i,availableTags:c=[],onCreateTag:l,attachmentsByTask:p,comments:d,onAddComment:m,currentUser:g,mentionableUsers:b,onUploadCommentAttachments:h,onTaskOpen:v,enableTimeTracking:f,timeTrackingSummary:y,timeEntries:w,timerState:x,onLogTime:T,onUpdateEstimate:k,onUpdateSoldEffort:S,onStartTimer:C,onStopTimer:I,onDiscardTimer:$,blurFinancials:A=false,suppressDetailModal:_=false,lens:E="hours",hourlyRate:me=0}){let{theme:L="dark",locale:X$1="en",customTranslations:ee,showBacklog:ze=true}=t,O=zi(X$1,ee),j=L==="dark"||L==="neutral",[he,je]=useState(r||new Date),[U,oe]=useState(null),[te,Fe]=useState(null),[we,Re]=useState(null),[Ue,Qe]=useState({}),ae=3,tt=3,pe=useCallback(V=>{Fe(V.id),_||oe(V),v?.(V.id);},[_,v]),[at,mt]=useState(null),Ft=useCallback(()=>{je(new Date(he.getFullYear(),he.getMonth()-1,1));},[he]),Te=useCallback(()=>{je(new Date(he.getFullYear(),he.getMonth()+1,1));},[he]),rt=useCallback(()=>{je(new Date);},[]),lt=useMemo(()=>{let V=he.getFullYear(),re=he.getMonth(),Ve=new Date(V,re,1),De=new Date(V,re+1,0),We=Ve.getDay(),Ne=De.getDate(),Ke=cs(e),ht=new Date;ht.setHours(0,0,0,0);let dt=[],nt=We,et=new Date(V,re,0).getDate();for(let Pt=nt-1;Pt>=0;Pt--){let gt=new Date(V,re-1,et-Pt);dt.push({date:gt,isCurrentMonth:false,isToday:false,isWeekend:gt.getDay()===0||gt.getDay()===6,events:Ke.filter(vt=>Qd(gt,vt)).map(vt=>({id:vt.id,title:vt.name,start:vt.startDate,end:vt.endDate,task:vt}))});}for(let Pt=1;Pt<=Ne;Pt++){let gt=new Date(V,re,Pt),vt=gt.getTime()===ht.getTime();dt.push({date:gt,isCurrentMonth:true,isToday:vt,isWeekend:gt.getDay()===0||gt.getDay()===6,events:Ke.filter(ft=>Qd(gt,ft)).map(ft=>({id:ft.id,title:ft.name,start:ft.startDate,end:ft.endDate,task:ft}))});}let Lt=42-dt.length;for(let Pt=1;Pt<=Lt;Pt++){let gt=new Date(V,re+1,Pt);dt.push({date:gt,isCurrentMonth:false,isToday:false,isWeekend:gt.getDay()===0||gt.getDay()===6,events:Ke.filter(vt=>Qd(gt,vt)).map(vt=>({id:vt.id,title:vt.name,start:vt.startDate,end:vt.endDate,task:vt}))});}return dt},[he,e]),Ze=useMemo(()=>cs(e).filter(V=>!V.startDate||!V.endDate),[e]),H=useMemo(()=>{let V=cs(e),re=0,Ve=0,De=0,We=0,Ne=0;V.forEach(et=>{et.effortMinutes&&(re+=et.effortMinutes),et.soldEffortMinutes&&(Ve+=et.soldEffortMinutes),et.scheduleVariance!=null&&(De+=et.scheduleVariance,We++),et.soldEffortMinutes&&et.effortMinutes&&(Ne+=et.soldEffortMinutes-et.effortMinutes);});let Ke=Ve>0?Math.min(100,Math.round(re/Ve*100)):0,ht=We>0?Math.round(De/We):0,nt=`${Ne<0?"-":"+"}${Yg(Ne,E,me)}`;return {budgetUtil:Ke,avgVariance:ht,costDisplay:nt,hasCostData:Ve>0}},[e,E,me]),de=useMemo(()=>{let V=[0,0,0,0,0,0];return lt.forEach((re,Ve)=>{let De=Math.floor(Ve/7);re.events.forEach(We=>{if(We.task.startDate&&We.task.soldEffortMinutes){let Ne=new Date(We.task.startDate),Ke=re.date;Ne.getFullYear()===Ke.getFullYear()&&Ne.getMonth()===Ke.getMonth()&&Ne.getDate()===Ke.getDate()&&De<V.length&&(V[De]-=We.task.soldEffortMinutes);}});}),V},[lt]),N=useMemo(()=>{let V=cs(e),re=new Map,Ve=new Set,De=[0,0,0,0,0,0];if(lt.length===0)return {segmentsByCell:re,multiDayTaskIds:Ve,maxLanesPerRow:De};let We=nt=>new Date(nt.getFullYear(),nt.getMonth(),nt.getDate()),Ne=We(lt[0].date),Ke=We(lt[lt.length-1].date),ht=[];for(let nt of V){if(!nt.startDate||!nt.endDate)continue;let et=We(nt.startDate),Lt=We(nt.endDate);if(et.getTime()===Lt.getTime()||Lt<Ne||et>Ke)continue;let Pt=et<Ne?Ne:et,gt=Lt>Ke?Ke:Lt,vt=Kg(Pt,Ne),ft=Kg(gt,Ne);vt<0||vt>41||ft<0||ft>41||vt!==ft&&(Ve.add(nt.id),ht.push({task:nt,startIdx:vt,endIdx:ft}));}ht.sort((nt,et)=>nt.startIdx!==et.startIdx?nt.startIdx-et.startIdx:et.endIdx-et.startIdx-(nt.endIdx-nt.startIdx));let dt=[[],[],[],[],[],[]];for(let{task:nt,startIdx:et,endIdx:Lt}of ht){let Pt=Math.floor(et/7),gt=Math.floor(Lt/7),vt=We(nt.startDate),ft=We(nt.endDate),At=false;for(let Ge=Pt;Ge<=gt;Ge++){let Oe=Ge===Pt?et%7:0,pt=Ge===gt?Lt%7:6,le=pt-Oe+1,fe=0,P=dt[Ge]??[];for(dt[Ge]||(dt[Ge]=P);fe<P.length&&(P[fe]??-1)>=Oe;)fe++;if(fe>=cw){At=true;break}fe>=P.length?P.push(pt):P[fe]=pt,De[Ge]=Math.max(De[Ge]??0,fe+1);let K=Ge===Pt&&vt>=Ne,q=Ge===gt&&ft<=Ke,ce=Ge*7+Oe,Se={taskId:nt.id,task:nt,rowIndex:Ge,startCol:Oe,endCol:pt,spanCols:le,lane:fe,isStart:K,isEnd:q};re.has(ce)||re.set(ce,[]),re.get(ce).push(Se);}At&&(Ve.delete(nt.id),re.forEach((Ge,Oe)=>{let pt=Ge.filter(le=>le.taskId!==nt.id);pt.length===0?re.delete(Oe):re.set(Oe,pt);}));}return {segmentsByCell:re,multiDayTaskIds:Ve,maxLanesPerRow:De}},[lt,e]),Y=X$1==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],ie=he.toLocaleDateString(X$1==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),ke=ie.charAt(0).toUpperCase()+ie.slice(1);return o?jsx("div",{className:u("flex-1 flex items-center justify-center",j?"bg-[#050505]":"bg-white",n),style:i,children:jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#007FFF]"}),jsxs("p",{className:u("text-sm font-mono",j?"text-white/30":"text-gray-600"),children:[O.labels.noEvents,"..."]})]})}):s?jsx("div",{className:u("flex-1 flex items-center justify-center",j?"bg-[#050505]":"bg-white",n),style:i,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:u("w-12 h-12 rounded-full flex items-center justify-center",j?"bg-red-500/10 border border-red-500/20":"bg-red-500/10"),children:jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxs("div",{children:[jsx("h3",{className:u("text-lg font-semibold mb-2",j?"text-white/90":"text-gray-900"),children:"Error"}),jsx("p",{className:u("text-sm",j?"text-white/40":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsx("div",{className:u("flex-1 flex items-center justify-center",j?"bg-[#050505]":"bg-white",n),style:i,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:u("w-16 h-16 mx-auto mb-4 rounded-2xl flex items-center justify-center",j?"bg-[#007FFF]/10 border border-[#007FFF]/20":"bg-blue-500/10"),children:jsx(Calendar,{className:u("w-8 h-8",j?"text-[#007FFF]":"text-blue-500")})}),jsx("h3",{className:u("text-lg font-semibold mb-2",j?"text-white/90":"text-gray-900"),children:O.labels.noEvents}),jsx("p",{className:u("text-sm",j?"text-white/30":"text-gray-600"),children:O.labels.newTask})]})}):jsxs("div",{className:u("flex-1 flex flex-col w-full h-full overflow-hidden",j?"bg-[#050505]":"bg-white",n),style:i,children:[jsxs("div",{className:"flex flex-1 overflow-hidden relative",children:[jsxs("div",{className:"flex-1 flex flex-col min-w-0 relative overflow-hidden",children:[jsxs("div",{className:u("flex-shrink-0 h-10 flex items-center justify-between px-4 z-20",j?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[jsxs("div",{className:u("flex items-center gap-1.5 pl-2.5 pr-2 py-1 rounded-md text-xs transition-all",j?"bg-[#111] border border-white/10":"bg-gray-100 border border-gray-200"),children:[jsx(Calendar,{className:u("w-3.5 h-3.5",j?"text-[#007FFF]":"text-blue-500")}),jsx("span",{className:u("font-medium",j?"text-white":"text-gray-900"),children:X$1==="es"?"Calendario":"Calendar"})]}),jsx("div",{className:u("h-4 w-px",j?"bg-white/10":"bg-gray-200")}),jsxs("div",{className:"flex items-center gap-1.5 select-none",children:[jsx("button",{onClick:Ft,className:u("w-6 h-6 flex items-center justify-center rounded transition-colors",j?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-3.5 h-3.5"})}),jsx("span",{className:u("text-sm font-semibold tracking-tight min-w-[150px] text-center",j?"text-white":"text-gray-900"),children:ke}),jsx("button",{onClick:Te,className:u("w-6 h-6 flex items-center justify-center rounded transition-colors",j?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsx(ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[t.toolbarRightContent&&jsxs(Fragment,{children:[t.toolbarRightContent,jsx("div",{className:u("h-4 w-px",j?"bg-white/10":"bg-gray-200")})]}),jsx("button",{onClick:rt,className:u("px-2.5 py-1 text-xs rounded-md transition-all font-medium",j?"bg-white/5 border border-white/10 text-white/70 hover:bg-white/10 hover:text-white":"bg-gray-100 border border-gray-200 text-gray-700 hover:bg-gray-200"),children:O.navigation.today})]})]}),jsx("div",{className:u("grid grid-cols-7 sticky top-0 z-10",j?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:Y.map(V=>jsx("div",{className:u("py-2 text-center text-[10px] font-bold uppercase tracking-widest",j?"text-white/60 font-mono":"text-gray-500"),children:V},V))}),jsx("div",{className:"flex-1 overflow-y-auto",children:jsx("div",{className:u("grid grid-cols-7 min-h-[800px]",j?"bg-[#050505]":"bg-white"),style:{gridAutoRows:"minmax(140px, auto)"},onClick:()=>Fe(null),children:lt.map((V,re)=>{let Ve=re%7===6,De=re>=35;return jsxs("div",{className:u("min-h-[140px] p-2 transition-colors flex flex-col relative group overflow-visible",!Ve&&(j?"border-r border-[#222]":"border-r border-gray-200"),!De&&(j?"border-b border-[#222]":"border-b border-gray-200"),j?V.isCurrentMonth?"bg-[#050505] hover:bg-white/[0.02]":"bg-[#080808] opacity-50":V.isCurrentMonth?"bg-white hover:bg-gray-50":"bg-gray-50 opacity-50",V.isToday&&j&&"ring-1 ring-[#007FFF]/40 ring-inset bg-[#007FFF]/[0.03]",V.isToday&&!j&&"ring-2 ring-blue-500 ring-inset"),children:[jsx("span",{className:u("text-xs font-mono select-none relative z-20",V.isToday?j?"text-[#007FFF] font-bold":"text-blue-600 font-bold":V.isCurrentMonth?j?"text-white/60":"text-gray-900":j?"text-white/20":"text-gray-400"),children:String(V.date.getDate()).padStart(2,"0")}),(()=>{let We=Math.floor(re/7),Ne=(N.maxLanesPerRow[We]??0)*qg,Ke=N.segmentsByCell.get(re);return Ne===0&&!Ke?null:jsx("div",{className:"relative -mx-2 overflow-visible",style:{minHeight:`${Ne}px`,zIndex:5},children:Ke?.map(ht=>jsx(uw,{segment:ht,isDark:j,blurFinancials:A,isSelected:te===ht.taskId,t:O,lens:E,hourlyRate:me,onClick:()=>{pe(ht.task),a.onEventClick?.({id:ht.task.id,title:ht.task.name,start:ht.task.startDate,end:ht.task.endDate,task:ht.task});}},ht.taskId))})})(),(()=>{let We=V.events.filter(Ne=>Ne.task.isMilestone&&!N.multiDayTaskIds.has(Ne.id));return We.length===0?null:jsxs("div",{className:"flex items-center gap-1 mt-0.5 px-0.5",children:[We.slice(0,4).map(Ne=>jsx("div",{className:"w-2 h-2 rounded-full bg-red-500 flex-shrink-0 cursor-pointer",title:Ne.title,onClick:Ke=>{Ke.stopPropagation(),pe(Ne.task);}},Ne.id)),We.length>4&&jsxs("span",{className:u("text-[8px] font-mono",j?"text-white/30":"text-gray-400"),children:["+",We.length-4]})]})})(),(()=>{let We=[];V.events.forEach(Ke=>{Ke.task.blockers?.forEach(ht=>{(ht.severity==="warning"||ht.severity==="critical")&&We.push({taskId:Ke.id,type:ht.type,severity:ht.severity,variance:Ke.task.scheduleVariance});});});let Ne=We[0];return Ne?jsx("div",{className:"mt-0.5 px-0.5",children:jsxs("div",{className:u("text-[8px] font-mono px-1.5 py-0.5 rounded flex items-center gap-1",Ne.severity==="critical"?"bg-red-500/15 text-red-400 border border-red-500/20":"bg-amber-500/15 text-amber-400 border border-amber-500/20"),children:[jsx("span",{children:"\u26A0"}),jsxs("span",{className:"truncate",children:[O.labels.risk,": ",Ne.type,Ne.variance?` (+${Math.abs(Ne.variance)}d ${O.labels.delay})`:""]})]})}):null})(),(()=>{let We=V.events.filter(dt=>!N.multiDayTaskIds.has(dt.id)),Ne=Ue[re]||ae,Ke=We.slice(0,Ne),ht=We.length-Ne;return jsxs("div",{className:"mt-1 space-y-0.5 flex-1",children:[Ke.map(dt=>jsxs(motion.button,{onClick:()=>{pe(dt.task),a.onEventClick?.(dt);},whileHover:{scale:1.01},className:u("w-full flex items-center gap-1.5 px-1.5 py-1 rounded text-[11px] transition-all text-left",dt.task.progress===100||dt.task.status==="completed"?j?"text-emerald-400":"bg-emerald-500/10 text-emerald-600":j?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:j?dt.task.progress===100||dt.task.status==="completed"?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:dt.task.isCriticalPath?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:void 0,children:[jsx("span",{className:u("flex-shrink-0 text-[9px]",dt.task.isMilestone?j?"text-amber-400":"text-amber-600":dt.task.isCriticalPath?"text-red-400":j?"text-[#1264FF]":"text-gray-400"),children:dt.task.isMilestone?"\u25C6":"\u25CF"}),jsx("span",{className:"truncate flex-1",children:dt.title})]},dt.id)),ht>0&&jsxs("button",{onClick:dt=>{dt.stopPropagation(),Qe(nt=>({...nt,[re]:Ne+tt}));},className:u("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",j?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:["+",ht," ",X$1==="es"?"m\xE1s":"more"]}),Ne>ae&&We.length>ae&&jsx("button",{onClick:dt=>{dt.stopPropagation(),Qe(nt=>({...nt,[re]:ae}));},className:u("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",j?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:X$1==="es"?"menos":"less"})]})})(),V.isCurrentMonth&&a.onTaskCreate&&jsx("div",{className:"flex items-center justify-end mt-1",children:(()=>{let We=re>=28,Ne=re%7>=5;return jsxs("div",{className:"relative",children:[jsx("button",{onClick:Ke=>{Ke.stopPropagation(),mt(at===re?null:re);},className:u("w-5 h-5 rounded flex items-center justify-center transition-all",at===re?"opacity-100 bg-[#007FFF] text-white":"opacity-0 group-hover:opacity-100",j?"hover:bg-[#007FFF] text-white/30 hover:text-white":"hover:bg-blue-500 text-gray-400 hover:text-white"),children:jsx(Plus,{className:u("w-3.5 h-3.5 transition-transform",at===re&&"rotate-45")})}),jsx(AnimatePresence,{children:at===re&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>mt(null)}),jsx(motion.div,{initial:{opacity:0,y:We?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:We?-5:5,scale:.95},transition:{duration:.12},className:u("absolute w-[320px] rounded-lg shadow-2xl z-50",We?"bottom-full mb-1":"top-full mt-1",Ne?"right-0":"left-0",j?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08] shadow-[0_8px_32px_rgba(0,0,0,0.6)]":"bg-white border border-gray-200 shadow-xl"),children:jsx(Io,{onSubmit:Ke=>{a.onTaskCreate?.({name:Ke.name,startDate:Ke.startDate||V.date,endDate:Ke.endDate||V.date,priority:Ke.priority,assignees:Ke.assignee?[Ke.assignee]:void 0}),mt(null);},onCancel:()=>mt(null),availableUsers:t.availableUsers,isDark:j,locale:X$1==="es"?"es":"en",defaultDate:V.date,dropdownDirection:We?"up":"down"})})]})})]})})()}),re%7===6&&(()=>{let We=Math.floor(re/7),Ne=de[We];if(!Ne||Ne===0)return null;let Ke=Yg(Ne,E,me);return jsxs("div",{className:u("absolute bottom-1 right-2 text-[9px] font-mono font-bold tabular-nums z-20",Ne<0?"text-red-400":"text-emerald-400",A&&"blur-sm select-none"),children:[O.labels.cashOut,": ",Ne<0?"-":"+",Ke]})})()]},re)})})})]}),ze&&jsxs("aside",{className:u("w-[280px] flex-shrink-0 flex flex-col overflow-hidden",j?"bg-[#050505] border-l border-[#222]":"bg-white border-l border-gray-200"),children:[jsxs("div",{className:u("flex-shrink-0 h-14 flex items-center justify-between px-4",j?"bg-[#080808] border-b border-[#222]":"bg-gray-50 border-b border-gray-200"),children:[jsx("span",{className:u("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",j?"text-white/40":"text-gray-500"),children:O.labels.backlogTitle}),jsx("div",{className:"flex items-center gap-2",children:jsx("span",{className:u("text-[10px] font-mono tabular-nums",j?"text-white/20":"text-gray-400"),children:Ze.length})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:Ze.length===0?jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[jsx("div",{className:u("w-10 h-10 rounded-xl flex items-center justify-center mb-3",j?"bg-white/5":"bg-gray-100"),children:jsx(Calendar,{className:u("w-5 h-5",j?"text-white/20":"text-gray-400")})}),jsx("p",{className:u("text-xs font-mono",j?"text-white/20":"text-gray-400"),children:X$1==="es"?"Sin tareas pendientes":"No unscheduled tasks"})]}):Ze.map(V=>jsxs("button",{onClick:()=>{pe(V);},className:u("w-full text-left rounded-md p-3 transition-all group/card",j?"bg-[#0A0A0A] border border-white/[0.05] hover:border-white/[0.12] hover:bg-[#0E0E0E]":"bg-white border border-gray-100 hover:border-gray-200 hover:shadow-sm"),children:[jsxs("div",{className:"flex items-start gap-2 mb-2",children:[jsx("div",{className:u("w-1 h-1 rounded-full mt-1.5 flex-shrink-0",j?"bg-white/20":"bg-gray-300")}),jsx("span",{className:u("text-sm font-medium leading-snug line-clamp-2",j?"text-white/80 group-hover/card:text-white":"text-gray-800"),children:V.name})]}),V.tags&&V.tags.length>0&&jsxs("div",{className:"flex flex-wrap gap-1 ml-3",children:[V.tags.slice(0,3).map(re=>jsx("span",{className:"text-[9px] font-mono uppercase tracking-wider px-1.5 py-0.5 rounded",style:{backgroundColor:`${re.color}15`,color:re.color,border:`1px solid ${re.color}30`},children:re.name},re.id)),V.tags.length>3&&jsxs("span",{className:u("text-[9px] font-mono px-1 py-0.5",j?"text-white/20":"text-gray-400"),children:["+",V.tags.length-3]})]}),(V.effortMinutes||V.soldEffortMinutes)&&jsxs("div",{className:u("flex items-center gap-2 mt-1.5 ml-3 text-[9px] font-mono",j?"text-white/25":"text-gray-400",A&&"blur-sm select-none"),children:[Zd(V.effortMinutes,E,me)&&jsxs("span",{children:[O.labels.estimate,": ",Zd(V.effortMinutes,E,me)]}),(()=>{let re=Xg(V,E,me);return re?jsx("span",{className:re.isNegative?"text-red-400":"text-emerald-400",children:re.text}):null})()]}),jsxs("div",{className:"flex items-center justify-between mt-2 ml-3",children:[jsxs("div",{className:"flex items-center gap-1.5",children:[V.priority&&jsx(Flag,{className:u("w-3 h-3",V.priority==="urgent"||V.priority==="high"?"text-red-400":V.priority==="medium"?"text-yellow-400":"text-green-400")}),jsx(jg,{task:V,isDark:j})]}),V.assignees&&V.assignees.length>0&&jsx("div",{className:"flex -space-x-1",children:V.assignees.slice(0,2).map((re,Ve)=>jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[8px] font-mono font-bold text-white ring-1 ring-[#050505]",style:{backgroundColor:re.color||"#007FFF"},title:re.name,children:re.initials||re.name?.slice(0,2).toUpperCase()},Ve))})]})]},V.id))}),a.onTaskCreate&&jsx("div",{className:u("flex-shrink-0 px-3 py-2.5 border-t",j?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:jsx("input",{type:"text",placeholder:O.labels.typeToAdd,className:u("w-full text-[11px] font-mono bg-transparent outline-none",j?"text-white/70 placeholder:text-white/15":"text-gray-700 placeholder:text-gray-400"),onKeyDown:V=>{V.key==="Enter"&&V.target.value.trim()&&(a.onTaskCreate?.({name:V.target.value.trim()}),V.target.value="");}})}),H.hasCostData&&jsxs("div",{className:u("flex-shrink-0 px-4 py-3 border-t space-y-2.5",j?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:[jsxs("div",{className:u("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",j?"text-white/40":"text-gray-500"),children:["\u25C8 ",O.labels.systemStatus]}),jsxs("div",{children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:u("text-[10px] font-mono",j?"text-white/40":"text-gray-500"),children:O.labels.budgetUtil}),jsxs("span",{className:u("text-[10px] font-mono font-bold tabular-nums",j?"text-white/60":"text-gray-700",A&&"blur-sm select-none"),children:[H.budgetUtil,"%"]})]}),jsx("div",{className:u("h-1.5 rounded-full overflow-hidden",j?"bg-white/5":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${H.budgetUtil}%`,background:H.budgetUtil>90?"#EF4444":H.budgetUtil>70?"#F59E0B":"linear-gradient(to right, #2E94FF, #8B5CF6)"}})})]}),jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxs("div",{className:u("rounded-md px-2 py-1.5 text-center",j?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsx("div",{className:u("text-[8px] font-mono uppercase tracking-wider mb-0.5",j?"text-white/25":"text-gray-400"),children:O.labels.variance}),jsxs("div",{className:u("text-[11px] font-mono font-bold tabular-nums",H.avgVariance>0?"text-emerald-400":H.avgVariance<0?"text-red-400":j?"text-white/50":"text-gray-600"),children:[H.avgVariance>0?"+":"",H.avgVariance," ",O.labels.days]})]}),jsxs("div",{className:u("rounded-md px-2 py-1.5 text-center",j?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsx("div",{className:u("text-[8px] font-mono uppercase tracking-wider mb-0.5",j?"text-white/25":"text-gray-400"),children:O.labels.cost}),jsx("div",{className:u("text-[11px] font-mono font-bold tabular-nums",H.costDisplay.startsWith("-")?"text-red-400":"text-emerald-400",A&&"blur-sm select-none"),children:H.costDisplay})]})]})]})]})]}),!_&&jsx(qr,{task:U,isOpen:!!U,onClose:()=>oe(null),onTaskUpdate:V=>{a.onTaskUpdate?.(V),oe(V);},theme:L==="dark"?"dark":"light",locale:X$1,availableUsers:t.availableUsers?.map(V=>({id:V.id,name:V.name,avatar:V.avatar,initials:V.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:c,onCreateTag:l,attachments:U?p?.get(U.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:cs(e).filter(V=>V.id!==U?.id),comments:d?.filter(V=>V.taskId===U?.id).map(V=>({...V,createdAt:V.createdAt instanceof Date?V.createdAt:new Date(V.createdAt),updatedAt:V.updatedAt instanceof Date?V.updatedAt:V.updatedAt?new Date(V.updatedAt):void 0})),onAddComment:m,currentUser:g,mentionableUsers:b,onUploadCommentAttachments:h,enableTimeTracking:f,timeTrackingSummary:y,timeEntries:w,isTimerRunning:x?.isRunning,timerElapsedSeconds:x?.elapsedSeconds,onTimeLog:T,onEstimateUpdate:k,onSoldEffortUpdate:S,onTimerStart:C,onTimerStop:I,onTimerDiscard:$,blurFinancials:A}),jsx(AnimatePresence,{children:we&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>Re(null),className:"fixed inset-0 bg-black/50 z-40"}),jsxs(motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:u("fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[320px] max-h-[400px] rounded-xl shadow-2xl z-50 overflow-hidden",j?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08]":"bg-white border border-gray-200"),children:[jsxs("div",{className:u("px-4 py-3 border-b flex items-center justify-between",j?"border-white/[0.08] bg-[#080808]":"border-gray-200"),children:[jsx("span",{className:u("font-medium text-sm",j?"text-white/90":"text-gray-900"),children:we.date.toLocaleDateString(X$1==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsx("button",{onClick:()=>Re(null),className:u("p-1 rounded",j?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-4 h-4"})})]}),jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-1.5",children:we.events.map(V=>jsxs("button",{onClick:()=>{Re(null),pe(V.task);},className:u("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",j?"hover:bg-white/5 border border-white/5":"hover:bg-gray-50 border border-gray-100"),children:[jsx(jg,{task:V.task,isDark:j}),jsx("span",{className:u("text-sm truncate flex-1",j?"text-white/80":"text-gray-900"),children:V.title}),(V.task.priority==="high"||V.task.priority==="urgent")&&jsx(Flag,{className:"w-3.5 h-3.5 text-red-400"})]},V.id))})]})]})})]})}var ec={bgPrimary:"#050505",bgSecondary:"#080808",bgHover:"rgba(255, 255, 255, 0.02)",bgToday:"rgba(0, 127, 255, 0.08)",bgWeekend:"#050505",bgOtherMonth:"#080808",border:"#222222",borderLight:"#1a1a1a",textPrimary:"rgba(255, 255, 255, 0.90)",textSecondary:"rgba(255, 255, 255, 0.60)",textMuted:"rgba(255, 255, 255, 0.30)",textToday:"#007FFF",accent:"#007FFF",accentHover:"#3399FF",accentLight:"rgba(0, 127, 255, 0.15)",statusTodo:"rgba(255, 255, 255, 0.40)",statusInProgress:"#007FFF",statusCompleted:"#34D399",focusRing:"#007FFF",glass:"rgba(20, 20, 20, 0.6)",glassBorder:"rgba(255, 255, 255, 0.08)",glassHover:"rgba(255, 255, 255, 0.05)",neonRed:"#FF2E2E",glowBlue:"0 0 10px rgba(0, 127, 255, 0.3)",glowRed:"0 0 10px rgba(255, 46, 46, 0.4)"},tc={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgToday:"#dbeafe",bgWeekend:"#f9fafb",bgOtherMonth:"#f3f4f680",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",textToday:"#0969da",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",glass:"rgba(255, 255, 255, 0.8)",glassBorder:"rgba(0, 0, 0, 0.08)",glassHover:"rgba(0, 0, 0, 0.04)",neonRed:"#DC2626",glowBlue:"0 0 10px rgba(0, 127, 255, 0.15)",glowRed:"0 0 10px rgba(220, 38, 38, 0.2)"},ac={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgToday:"#6366f120",bgWeekend:"#16213e80",bgOtherMonth:"#1a1a2e50",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",textToday:"#818cf8",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1",glass:"rgba(26, 26, 46, 0.6)",glassBorder:"rgba(255, 255, 255, 0.06)",glassHover:"rgba(255, 255, 255, 0.04)",neonRed:"#EF4444",glowBlue:"0 0 10px rgba(99, 102, 241, 0.3)",glowRed:"0 0 10px rgba(239, 68, 68, 0.3)"},Vi={dark:ec,light:tc,neutral:ac};function Qg(e){return Vi[e]||Vi.dark}function mw({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:i}){let[c,l]=useState(false),p=useMemo(()=>t.filter(g=>e.cardIds.includes(g.id)),[t,e.cardIds]),d=useMemo(()=>{let g=p.length,b=new Set(p.flatMap(f=>f.assignedUserIds||[])).size,h=p.map(f=>f.priority).filter(Boolean),v=new Set(p.flatMap(f=>f.labels||[])).size;return {totalCards:g,uniqueAssignees:b,priorities:h,labels:v}},[p]),m=()=>{o?.(e.id);};return jsxs("div",{className:u("card-stack",!e.isExpanded&&"card-stack-collapsed",i),onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxs("div",{className:"card-stack-header",onClick:m,children:[jsxs("div",{className:"card-stack-header-left",children:[jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:u("card-stack-chevron",e.isExpanded&&"expanded"),children:jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsx("h3",{className:"card-stack-title",children:e.title}),jsx("div",{className:"card-stack-badge",children:d.totalCards}),jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),c&&jsx("div",{className:"card-stack-actions",children:jsx("button",{className:"card-stack-action",onClick:g=>{g.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(g=>jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsx("div",{onClick:()=>r?.(g),children:a(g)}):jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(g),children:[jsx("h4",{children:g.title}),g.description&&jsxs("p",{children:[g.description.substring(0,100),"..."]})]}),jsx("button",{className:"card-stack-unstack-btn",onClick:b=>{b.stopPropagation(),s?.(e.id,g.id);},"aria-label":"Remove from stack",children:jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},g.id))})})]})}var e0={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function ps(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 ms(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 t0(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 a0({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:i}){let c=useMemo(()=>({...e0,...n}),[n]),[l,p]=useState(new Set),d=useRef(null),m=useMemo(()=>{if(!c.groupByDay)return [{date:null,events:e}];let y=new Map;return e.forEach(w=>{let x=w.timestamp.toISOString().split("T")[0],T=y.get(x);T?T.push(w):y.set(x,[w]);}),Array.from(y.entries()).sort((w,x)=>x[0].localeCompare(w[0])).map(([w,x])=>({date:new Date(w),events:x.sort((T,k)=>k.timestamp.getTime()-T.timestamp.getTime())}))},[e,c.groupByDay]),{uniqueUsers:g,uniqueTypes:b}=useMemo(()=>{let y=new Set,w=new Set;return e.forEach(x=>{y.add(x.userId),w.add(x.type);}),{uniqueUsers:Array.from(y),uniqueTypes:Array.from(w)}},[e]),h=y=>{p(w=>{let x=new Set(w);return x.has(y)?x.delete(y):x.add(y),x});},v=y=>{let x=new Date().getTime()-y.getTime(),T=Math.floor(x/6e4),k=Math.floor(x/36e5),S=Math.floor(x/864e5);return T<1?"just now":T<60?`${T}m ago`:k<24?`${k}h ago`:S<7?`${S}d ago`:y.toLocaleDateString()},f=useMemo(()=>{let y=0;return t.types&&t.types.length>0&&y++,t.users&&t.users.length>0&&y++,t.dateRange&&y++,t.searchTerm&&y++,y},[t]);return useEffect(()=>{if(s&&d.current){let y=d.current.querySelector(`[data-event-id="${s}"]`);y&&y.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxs("div",{className:u("history-timeline-empty",i),children:[jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxs("div",{className:u("history-timeline",c.compact&&"compact",i),children:[jsxs("div",{className:"history-timeline-filters",children:[jsxs("div",{className:"history-timeline-filter-group",children:[jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:y=>{let w=y.target.value;a({...t,types:w?[w]:void 0});},children:[jsx("option",{value:"",children:"All Events"}),b.map(y=>jsxs("option",{value:y,children:[ms(y)," ",y.replace("_"," ")]},y))]}),g.length>1&&jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:y=>{let w=y.target.value;a({...t,users:w?[w]:void 0});},children:[jsx("option",{value:"",children:"All Users"}),g.map(y=>jsx("option",{value:y,children:y},y))]}),jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:y=>a({...t,searchTerm:y.target.value})})]}),f>0&&jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",f,")"]})]}),jsx("div",{className:"history-timeline-container",ref:d,children:m.map(y=>jsxs("div",{className:"history-timeline-group",children:[c.groupByDay&&y.date&&jsxs("div",{className:"history-timeline-day-header",children:[jsx("span",{className:"history-timeline-day-date",children:y.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxs("span",{className:"history-timeline-day-count",children:[y.events.length," events"]})]}),jsx("div",{className:"history-timeline-events",children:y.events.map((w,x)=>{let T=l.has(w.id),k=s===w.id,S=t0(w.type);return jsxs("div",{"data-event-id":w.id,className:u("history-timeline-event",T&&"expanded",k&&"selected"),onClick:()=>o?.(w),children:[jsxs("div",{className:"history-timeline-line",children:[jsx("div",{className:"history-timeline-dot",style:{backgroundColor:S},children:c.showIcons&&jsx("span",{className:"history-timeline-dot-icon",children:ms(w.type)})}),x<y.events.length-1&&jsx("div",{className:"history-timeline-connector",style:{borderColor:S}})]}),jsxs("div",{className:"history-timeline-event-content",children:[jsxs("div",{className:"history-timeline-event-header",children:[jsxs("div",{className:"history-timeline-event-header-left",children:[c.showAvatars&&w.userAvatar&&jsx("img",{src:w.userAvatar,alt:w.userName||w.userId,className:"history-timeline-event-avatar"}),jsxs("div",{className:"history-timeline-event-description",children:[jsx("span",{className:"history-timeline-event-user",children:w.userName||w.userId}),jsx("span",{className:"history-timeline-event-action",children:ps(w)})]})]}),jsx("div",{className:"history-timeline-event-time",children:c.useRelativeTime?v(w.timestamp):w.timestamp.toLocaleString()})]}),Object.keys(w.changes).length>0&&jsxs("button",{className:"history-timeline-event-toggle",onClick:C=>{C.stopPropagation(),h(w.id);},children:[T?"\u25BC":"\u25B6"," Show changes"]}),T&&jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(w.changes).map(([C,I])=>jsxs("div",{className:"history-timeline-event-change",children:[jsxs("span",{className:"history-timeline-event-change-key",children:[C,":"]}),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)})]})]},C)),w.metadata&&Object.keys(w.metadata).length>0&&jsxs("div",{className:"history-timeline-event-metadata",children:[jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(w.metadata).map(([C,I])=>jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxs("span",{className:"history-timeline-event-metadata-key",children:[C,":"]}),jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(I)})]},C))]})]})]})]},w.id)})})]},y.date?.toISOString()||"all"))})]})}function o0({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:i,onSpeedChange:c,className:l}){let p=[.5,1,1.5,2,3],d=useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),m=useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxs("div",{className:u("history-replay-empty",l),children:[jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxs("div",{className:u("history-replay",l),children:[jsxs("div",{className:"history-replay-current-event",children:[jsx("div",{className:"history-replay-event-icon",children:d&&ms(d.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:d&&ps(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:g=>i(parseInt(g.target.value))}),jsx("div",{className:"history-replay-progress-fill",style:{width:`${m}%`}}),jsx("div",{className:"history-replay-progress-markers",children:t.map((g,b)=>jsx("div",{className:u("history-replay-progress-marker",b===e.currentIndex&&"active"),style:{left:`${b/(e.totalEvents-1)*100}%`},onClick:()=>i(b),title:ps(g)},g.id))})]}),jsxs("div",{className:"history-replay-controls",children:[jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick: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(g=>jsxs("button",{className:u("history-replay-speed-btn",e.speed===g&&"active"),onClick:()=>c(g),children:[g,"x"]},g))})]}),jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxs("div",{className:"history-replay-shortcuts",children:[jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2190"})," Previous"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2192"})," Next"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxs("div",{className:"history-replay-card-preview",children:[jsxs("div",{className:"history-replay-card-preview-header",children:[jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsx("span",{className:"history-replay-card-preview-time",children: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(g=>jsx("span",{className:"history-replay-card-preview-label-tag",children:g},g))})]})]})]})]}):jsxs("div",{className:u("history-replay-start",l),children:[jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsx("span",{children:"Start Time Travel"})]}),jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function rc(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 oc(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 n0(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 s0(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function xw(e,t,a,r,o,s=100){let n=e.map(c=>({...c,x:c.x??a/2+Math.random()*100-50,y:c.y??r/2+Math.random()*100-50,vx:0,vy:0})),i=new Map(n.map(c=>[c.id,c]));for(let c=0;c<s;c++){let l=1-c/s;n.forEach(p=>{let d=a/2,m=r/2;p.vx+=(d-p.x)*o.centerForce*l,p.vy+=(m-p.y)*o.centerForce*l,n.forEach(g=>{if(p.id===g.id)return;let b=p.x-g.x,h=p.y-g.y,v=Math.sqrt(b*b+h*h)||1,f=o.chargeStrength*l/(v*v);p.vx+=b/v*f,p.vy+=h/v*f;});}),t.forEach(p=>{let d=i.get(typeof p.source=="string"?p.source:p.source.id),m=i.get(typeof p.target=="string"?p.target:p.target.id);if(!d||!m)return;let g=m.x-d.x,b=m.y-d.y,h=Math.sqrt(g*g+b*b)||1,v=(h-o.linkDistance)/h*o.forceStrength*l;d.vx+=g*v,d.vy+=b*v,m.vx-=g*v,m.vy-=b*v;}),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 i0({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:i,className:c}){let l=useRef(null),[p,d]=useState([]),[m,g]=useState(null),[b,h]=useState(null),[v,f]=useState(null),[y,w]=useState(1),[x,T]=useState({x:0,y:0});useEffect(()=>{if(e.length===0)return;let E=xw(e,t,a.width,a.height,a,150);d(E);},[e,t,a]);let k=useCallback((E,me)=>{a.enableDragging&&(me.stopPropagation(),g(E));},[a.enableDragging]),S=useCallback(E=>{if(!m||!l.current)return;let L=l.current.getBoundingClientRect(),X=(E.clientX-L.left-x.x)/y,ee=(E.clientY-L.top-x.y)/y;d(ze=>ze.map(O=>O.id===m?{...O,x:X,y:ee,fx:X,fy:ee}:O));},[m,y,x]),C=useCallback(()=>{g(null);},[]),I=useCallback((E,me)=>{me.stopPropagation(),i?.({type:"node-click",node:E,position:{x:me.clientX,y:me.clientY}});},[i]),$=useCallback((E,me)=>{me.stopPropagation(),i?.({type:"edge-click",edge:E,position:{x:me.clientX,y:me.clientY}});},[i]),A=useCallback(E=>{let me=p.find(L=>L.id===E);return me?{x:me.x,y:me.y}:{x:0,y:0}},[p]),_=useCallback(E=>{if(E.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return E.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let me=E.card.priority;return me==="URGENT"?"#ef4444":me==="HIGH"?"#f59e0b":me==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return E.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxs("div",{className:u("relationships-graph-empty",c),children:[jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxs("div",{className:u("relationships-graph",c),children:[jsxs("div",{className:"relationships-graph-controls",children:[jsxs("div",{className:"relationships-graph-stats",children:[jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:n.totalNodes}),jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:n.totalEdges}),jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>w(E=>Math.min(E+.2,3)),children:"+"}),jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(y*100),"%"]}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>w(E=>Math.max(E-.2,.5)),children:"\u2212"}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{w(1),T({x:0,y:0});},children:"Reset"})]})]}),jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(E=>E.type))).map(E=>jsxs("div",{className:"relationships-graph-legend-item",children:[jsx("div",{className:"relationships-graph-legend-color",style:{background:rc(E)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[n0(E)," ",oc(E)]})]},E))}),jsxs("svg",{ref:l,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:S,onMouseUp:C,onMouseLeave:C,children:[jsxs("g",{transform:`translate(${x.x}, ${x.y}) scale(${y})`,children:[jsx("g",{className:"relationships-graph-edges",children:t.map(E=>{let me=A(typeof E.source=="string"?E.source:E.source.id),L=A(typeof E.target=="string"?E.target:E.target.id),X=s0(E.type),ee=v===E.id,ze=E.onCriticalPath;return jsxs("g",{className:u("relationships-graph-edge",ee&&"hovered",ze&&"critical"),onMouseEnter:()=>f(E.id),onMouseLeave:()=>f(null),onClick:O=>$(E,O),children:[jsx("line",{x1:me.x,y1:me.y,x2:L.x,y2:L.y,stroke:rc(E.type),strokeWidth:ze?a.edgeWidth*2:a.edgeWidth,strokeOpacity:ee?1:.6,markerEnd:X?"url(#arrowhead)":void 0}),a.showEdgeLabels&&ee&&jsx("text",{x:(me.x+L.x)/2,y:(me.y+L.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:oc(E.type)})]},E.id)})}),jsx("g",{className:"relationships-graph-nodes",children:p.map(E=>{let me=b===E.id,L=E.onCriticalPath;return jsxs("g",{className:u("relationships-graph-node",me&&"hovered",L&&"critical"),transform:`translate(${E.x}, ${E.y})`,onMouseDown:X=>k(E.id,X),onMouseEnter:()=>h(E.id),onMouseLeave:()=>h(null),onClick:X=>I(E,X),children:[jsx("circle",{r:L?a.nodeSize*1.2:a.nodeSize,fill:_(E),stroke:L?"#fbbf24":"#ffffff",strokeWidth:L?3:2,opacity:me?1:.9}),a.showLabels&&jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:E.card.title.length>20?E.card.title.substring(0,20)+"...":E.card.title})]},E.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 c0({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=useState(""),[i,c]=useState(false),[l,p]=useState(null),[d,m]=useState(null),g=useRef(null),b=i||o;useEffect(()=>{e&&g.current&&g.current.focus();},[e]),useEffect(()=>{let y=w=>{w.key==="Escape"&&!b&&h();};if(e)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[e,b]);let h=()=>{b||(n(""),p(null),m(null),t());},v=async()=>{if(!(!s.trim()||b)){c(true),p(null),m(null);try{let y=await r(s.trim());m(y);}catch(y){p(y instanceof Error?y.message:"Failed to generate plan");}finally{c(false);}}},f=()=>{d&&(a(d),h());};return e?jsxs(Ht,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:h}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:y=>y.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsx("button",{onClick:h,disabled:b,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:d?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),d.explanation&&jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsx("p",{className:"text-sm text-white/90",children:d.explanation})}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",d.columns.length,")"]}),jsx("div",{className:"flex gap-2 flex-wrap",children:d.columns.map((y,w)=>jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:y.title},w))})]}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",d.cards.length,")"]}),jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[d.cards.slice(0,10).map((y,w)=>jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsx("p",{className:"text-sm font-medium text-white/90",children:y.title}),y.description&&jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:y.description})]}),y.priority&&jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${y.priority==="URGENT"?"bg-red-500/20 text-red-400":y.priority==="HIGH"?"bg-orange-500/20 text-orange-400":y.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:y.priority})]})},w)),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:g,value:s,onChange:y=>n(y.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:b}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),l&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:l}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((y,w)=>jsx("button",{onClick:()=>n(y),disabled:b,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:y},w))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:b&&jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:h,disabled:b,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),d?jsx("button",{onClick: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:v,disabled:!s.trim()||b,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#ffffff"},children:b?"Generating...":"Generate Plan"})]})]})]})})]}):null}var nc={"gpt-4-turbo":{provider:"openai",name:"GPT-4 Turbo",contextWindow:128e3,costPer1kInput:.01,costPer1kOutput:.03,supportsVision:true,supportsJSON:true},"gpt-4":{provider:"openai",name:"GPT-4",contextWindow:8192,costPer1kInput:.03,costPer1kOutput:.06,supportsVision:false,supportsJSON:true},"gpt-3.5-turbo":{provider:"openai",name:"GPT-3.5 Turbo",contextWindow:16385,costPer1kInput:5e-4,costPer1kOutput:.0015,supportsVision:false,supportsJSON:true},"claude-3-5-sonnet-20241022":{provider:"anthropic",name:"Claude 3.5 Sonnet",contextWindow:2e5,costPer1kInput:.003,costPer1kOutput:.015,supportsVision:true,supportsJSON:true},"claude-3-opus-20240229":{provider:"anthropic",name:"Claude 3 Opus",contextWindow:2e5,costPer1kInput:.015,costPer1kOutput:.075,supportsVision:true,supportsJSON:true},"claude-3-haiku-20240307":{provider:"anthropic",name:"Claude 3 Haiku",contextWindow:2e5,costPer1kInput:25e-5,costPer1kOutput:.00125,supportsVision:true,supportsJSON:true}};var ww={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},kw={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 Cw(e,t,a){let r=nc[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function gs(e){return `$${e.toFixed(4)}`}var sc=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=Cw(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,m)=>d+m.cost,0),s=a.reduce((d,m)=>d+m.inputTokens,0),n=a.reduce((d,m)=>d+m.outputTokens,0),i=a.filter(d=>d.success),c=a.reduce((d,m)=>d+m.duration,0),l={},p={};return a.forEach(d=>{l[d.feature]=(l[d.feature]||0)+1,p[d.feature]=(p[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:l,costsByFeature:p,averageDuration:r>0?c/r:0,successRate:r>0?i.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 i=this.operations.filter(p=>p.timestamp>=n).length,c=Math.max(0,o-i),l=i/o*100;return {used:i,limit:o,remaining:c,percentUsed:l,isExceeded:i>=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)}},Vo=new sc;function m0({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=useState(Vo.getStats()),[s,n]=useState(Vo.checkLimit(a));if(useEffect(()=>{if(!e)return;let c=setInterval(()=>{o(Vo.getStats()),n(Vo.checkLimit(a));},1e3);return ()=>clearInterval(c)},[e,a]),useEffect(()=>{let c=l=>{l.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,t]),!e)return null;let i=Vo.getRecentOperations(5);return jsxs(Ht,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:c=>c.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-blue-500/10 to-purple-500/10 border border-blue-500/30",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:gs(r.totalCost)})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:r.totalOperations})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([c,l])=>{let p=r.costsByFeature[c]||0,d=r.totalOperations>0?l/r.totalOperations*100:0;return jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:c.replace(/([A-Z])/g," $1").trim()}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[l," ops"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:gs(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}%`}})})]},c)})})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),i.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:i.map(c=>jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:c.feature.replace(/([A-Z])/g," $1").trim()}),jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(c.timestamp).toLocaleTimeString()," \u2022"," ",c.duration,"ms"]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[c.inputTokens+c.outputTokens," tokens"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:gs(c.cost)}),jsx("div",{className:`w-2 h-2 rounded-full ${c.success?"bg-green-400":"bg-red-400"}`})]})]},c.id))})]})]}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80",children:"Close"})]})]})})]})}function b0({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,i]=useState(""),[c,l]=useState(""),[p,d]=useState(""),[m,g]=useState(false),[b,h]=useState(null),[v,f]=useState(null),[y,w]=useState(null),x=useRef(null),T=m||o;useEffect(()=>{e&&x.current&&x.current.focus();},[e]),useEffect(()=>{let $=A=>{A.key==="Escape"&&!T&&k();};if(e)return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[e,T]);let k=()=>{T||(i(""),l(""),d(""),h(null),f(null),w(null),t());},S=async()=>{if(!(!n.trim()||T)){g(true),h(null),f(null),w(null);try{let $=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:c||void 0,endDate:p||void 0});f($.tasks.tasks),w({from_cache:$.from_cache,tokens_used:$.tokens_used,mock_mode:$.mock_mode,similarity:$.similarity,tokens_saved:$.tokens_saved});}catch($){h($ instanceof Error?$.message:"Failed to generate tasks");}finally{g(false);}}},C=()=>{v&&(a(v),k());};if(!e)return null;let I=y?.similarity?((y.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:k}),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:$=>$.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:k,disabled:T,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:v?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxs("div",{className:"flex flex-wrap gap-2",children:[y?.mock_mode&&jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),y?.from_cache?jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",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:[y?.tokens_used||0," tokens"]}),y?.tokens_saved&&jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-indigo-500/20 text-indigo-400 border border-indigo-500/30",children:[y.tokens_saved," tokens saved"]}),jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[v.length," tasks"]})]}),jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:v.map(($,A)=>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:["#",A+1]}),jsx("p",{className:"text-sm font-medium text-white/90",children:$.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"})]}),$.start," \u2192 ",$.end]}),jsxs("span",{children:[$.duration," days"]}),$.dependencies.length>0&&jsxs("span",{className:"text-blue-400",children:["Depends: ",$.dependencies.join(", ")]})]})]}),jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${$.priority==="high"?"bg-red-500/20 text-red-400":$.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:$.priority})]})},$.id))})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsx("textarea",{ref:x,value:n,onChange:$=>i($.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:T}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsx("input",{type:"date",value:c,onChange:$=>l($.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:T})]}),jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsx("input",{type:"date",value:p,onChange:$=>d($.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:T})]})]}),b&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:b}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map(($,A)=>jsx("button",{onClick:()=>i($),disabled:T,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:$},A))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:T&&jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:k,disabled:T,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),v?jsx("button",{onClick:C,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:S,disabled:!n.trim()||T,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#ffffff"},children:T?"Generating...":"Generate Tasks"})]})]})]})})]})}function ji({initialBoard:e,onPersist:t}){let[a,r]=useState(e),o=useCallback(v=>{t&&Es(()=>Promise.resolve(t(v)),{maxAttempts:3,initialDelay:1e3,onRetry:(f,y,w)=>{console.warn(`Retry attempt ${y} after ${w}ms: ${f.message}`);}}).then(f=>{f.success||console.error(`Failed to persist board after ${f.attempts} attempts:`,f.error);});},[t]),s=useCallback(async(v,f,y)=>{r(w=>{let x=w.cards.find($=>$.id===v);if(!x)return w;let T=x.columnId,k={...x,columnId:f,position:y},S=w.cards.map($=>$.id===v?k:$),C=w.columns.map($=>{if($.id===T)return {...$,cardIds:$.cardIds.filter(A=>A!==v)};if($.id===f){let A=S.filter(_=>_.columnId===f).sort((_,E)=>_.position-E.position);return {...$,cardIds:A.map(_=>_.id)}}return $}),I={...w,cards:S,columns:C};return o(I),I});},[o]),n=useCallback(async(v,f)=>{r(y=>{let w=y.cards.map(T=>T.id===v?{...T,...f}:T),x={...y,cards:w};return o(x),x});},[o]),i=useCallback(async v=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(y=>{let w={...v,id:f},x=y.columns.map(k=>k.id===v.columnId?{...k,cardIds:[...k.cardIds,f]}:k),T={...y,cards:[...y.cards,w],columns:x};return o(T),T});},[o]),c=useCallback(async v=>{r(f=>{let y=f.cards.find(k=>k.id===v);if(!y)return f;let w=f.cards.filter(k=>k.id!==v),x=f.columns.map(k=>k.id===y.columnId?{...k,cardIds:k.cardIds.filter(S=>S!==v)}:k),T={...f,cards:w,columns:x};return o(T),T});},[o]),l=useCallback(async v=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(y=>{let w={...v,id:f,cardIds:[]},x={...y,columns:[...y.columns,w]};return o(x),x});},[o]),p=useCallback(async(v,f)=>{r(y=>{let w=y.columns.map(T=>T.id===v?{...T,...f}:T),x={...y,columns:w};return o(x),x});},[o]),d=useCallback(async v=>{r(f=>{let y=f.cards.filter(T=>T.columnId!==v),w=f.columns.filter(T=>T.id!==v),x={...f,cards:y,columns:w};return o(x),x});},[o]),m=useCallback(v=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(v),f},[i]),g=useCallback(v=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(v),f},[l]),b=useCallback(()=>{r(v=>{let f={...v,cards:[],columns:[]};return o(f),f});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:i,onCardDelete:c,onColumnCreate:l,onColumnUpdate:p,onColumnDelete:d},setBoard:r,helpers:{addCard:m,addColumn:g,deleteCard:c,deleteColumn:d,clearBoard:b}}}function y0({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=ji({initialBoard:e,onPersist:a}),n=useMemo(()=>({addCard:(c,l,p={})=>{s.addCard({title:l,columnId:c,position:r.cards.filter(d=>d.columnId===c).length,...p});},addColumn:(c,l)=>{let p=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:c,position:l??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 fs={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},v0={by:"none",order:"asc"};function w0({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=useState({...fs,...e}),[s,n]=useState({...v0,...t}),i=useCallback(h=>{o(v=>({...v,...h}));},[]),c=useCallback(h=>{n(v=>({...v,...h}));},[]),l=useCallback(()=>{o(fs),n(v0);},[]),p=useCallback(()=>{a&&o({...fs,assignees:[a]});},[a]),d=useCallback(()=>{o({...fs,dateFilter:"overdue"});},[]),m=useCallback(()=>{o({...fs,priorities:["HIGH","URGENT"]});},[]),g=useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),b=useCallback(h=>{let v=[...h];if(r.search){let f=r.search.toLowerCase();v=v.filter(y=>y.title.toLowerCase().includes(f)||y.description?.toLowerCase().includes(f));}if(r.dateFilter!=="all"){let f=new Date,y=f.getFullYear(),w=String(f.getMonth()+1).padStart(2,"0"),x=String(f.getDate()).padStart(2,"0"),T=`${y}-${w}-${x}`;v=v.filter(k=>{if(!k.endDate&&!k.dueDate)return false;let S=k.endDate||k.dueDate;if(!S)return false;let C;if(typeof S=="string")C=S.split("T")[0]||S;else {let I=S.getUTCFullYear(),$=String(S.getUTCMonth()+1).padStart(2,"0"),A=String(S.getUTCDate()).padStart(2,"0");C=`${I}-${$}-${A}`;}switch(r.dateFilter){case "overdue":return C<T;case "today":return C===T;case "this-week":let I=new Date(T+"T00:00:00"),$=new Date(C+"T00:00:00"),A=new Date(I);return A.setDate(A.getDate()+7),$>=I&&$<=A;case "custom":if(r.dateRange){let _=typeof S=="string"?new Date(S):S;return _>=r.dateRange.start&&_<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(v=v.filter(f=>f.priority&&r.priorities.includes(f.priority))),r.assignees.length>0&&(v=v.filter(f=>(f.assignedUserIds||(f.assigneeId?[f.assigneeId]:[])).some(w=>r.assignees.includes(w)))),r.labels.length>0&&(v=v.filter(f=>f.labels&&f.labels.some(y=>r.labels.includes(y)))),r.columns.length>0&&(v=v.filter(f=>r.columns.includes(f.columnId))),s.by!=="none"&&v.sort((f,y)=>{let w=0;switch(s.by){case "created":let x=f.createdAt?new Date(f.createdAt).getTime():0,T=y.createdAt?new Date(y.createdAt).getTime():0;w=x-T;break;case "priority":let k={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},S=k[f.priority||"LOW"],C=k[y.priority||"LOW"];w=S-C;break;case "dueDate":let I=f.endDate||f.dueDate,$=y.endDate||y.dueDate;if(!I)return 1;if(!$)return -1;let A=typeof I=="string"?new Date(I).getTime():I.getTime(),_=typeof $=="string"?new Date($).getTime():$.getTime();w=A-_;break;case "title":w=f.title.localeCompare(y.title);break;case "estimate":let E=f.estimatedTime||0,me=y.estimatedTime||0;w=E-me;break;default:w=0;}return s.order==="asc"?w:-w}),v},[r,s]);return {filters:r,sort:s,setFilters:i,setSort:c,resetFilters:l,filterMyTasks:p,filterOverdue:d,filterHighPriority:m,applyFilters:b,hasActiveFilters:g}}var C0,T0;if(typeof window<"u")try{let e=Ns("ai");C0=e.generateObject,T0=e.generateText;}catch{}function N0(e={}){let[t,a]=useState(false),[r,o]=useState(null),s=!!(C0&&T0&&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(m){let g=m instanceof Error?m:new Error("Failed to generate plan");throw o(g),g}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("Suggesting assignee for:",d.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(m){let g=m instanceof Error?m:new Error("Failed to suggest assignee");throw o(g),g}finally{a(false);}},[s]),c=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(m){let g=m instanceof Error?m:new Error("Failed to predict risks");throw o(g),g}finally{a(false);}},[s]),l=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("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(m){let g=m instanceof Error?m:new Error("Failed to generate subtasks");throw o(g),g}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(m){let g=m instanceof Error?m:new Error("Failed to estimate effort");throw o(g),g}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:i,onPredictRisks:c,onGenerateSubtasks:l,onEstimateEffort:p,isAvailable:s,isLoading:t,error:r}}function lc(){let[e,t]=useState(()=>selectionStore.getState());useEffect(()=>selectionStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{selectionStore.setState(r);},[]);return [e,a]}function D0(e){let{cards:t}=e,[a,r]=lc(),o=useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=useCallback((d,m)=>{if(!m){r({selectedCardIds:[d],lastSelectedCardId:d});return}let g=m.ctrlKey||m.metaKey,b=m.shiftKey;if(g)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(h=>h!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(b&&a.lastSelectedCardId){let h=t.find(f=>f.id===d),v=t.find(f=>f.id===a.lastSelectedCardId);if(h&&v&&h.columnId===v.columnId){let f=t.filter(C=>C.columnId===h.columnId).sort((C,I)=>C.position-I.position),y=f.findIndex(C=>C.id===a.lastSelectedCardId),w=f.findIndex(C=>C.id===d),[x,T]=y<w?[y,w]:[w,y],k=f.slice(x,T+1).map(C=>C.id),S=Array.from(new Set([...a.selectedCardIds,...k]));r({selectedCardIds:S,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(m=>m!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),i=useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),c=useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),l=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:i,selectAll:c,toggleCard:l,getSelectedCards:p}}var S0={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function E0(e){let{cards:t,config:a,aiService:r}=e,o=useMemo(()=>({...S0,...a}),[a]),[s,n]=useState([]),i=useCallback((h,v,f,y,w)=>{if(v.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let x={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:h,cardIds:v,columnId:f,strategy:y,color:w,isExpanded:true,position:s.filter(T=>T.columnId===f).length,createdAt:new Date};n(T=>[...T,x]);},[o.minCardsPerStack,s]),c=useCallback(h=>{n(v=>v.filter(f=>f.id!==h));},[]),l=useCallback(h=>{n(v=>v.map(f=>f.id===h?{...f,isExpanded:!f.isExpanded}:f));},[]),p=useCallback((h,v)=>{n(f=>f.map(y=>y.id===h&&!y.cardIds.includes(v)?{...y,cardIds:[...y.cardIds,v]}:y));},[]),d=useCallback((h,v)=>{n(f=>f.map(y=>{if(y.id===h){let w=y.cardIds.filter(x=>x!==v);return w.length<o.minCardsPerStack?null:{...y,cardIds:w}}return y}).filter(y=>y!==null));},[o.minCardsPerStack]),m=useCallback(h=>s.filter(v=>v.columnId===h).sort((v,f)=>v.position-f.position),[s]),g=useCallback(async h=>{let v=t.filter(T=>T.columnId===h);if(v.length<o.minCardsPerStack*2)return [];let f=[],y=new Map;v.forEach(T=>{T.labels&&T.labels.length>0&&T.labels.forEach(k=>{y.has(k)||y.set(k,[]),y.get(k).push(T);});}),y.forEach((T,k)=>{T.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F4CC} ${k}`,cardIds:T.map(S=>S.id),columnId:h,strategy:"labels",color:"#3b82f6"},reason:`${T.length} cards with label "${k}"`,confidence:.85});});let w=new Map;v.forEach(T=>{T.assignedUserIds&&T.assignedUserIds.length>0&&T.assignedUserIds.forEach(k=>{w.has(k)||w.set(k,[]),w.get(k).push(T);});}),w.forEach((T,k)=>{T.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F464} Assigned to user-${k.slice(-4)}`,cardIds:T.map(S=>S.id),columnId:h,strategy:"assignee",color:"#8b5cf6"},reason:`${T.length} cards assigned to the same user`,confidence:.8});});let x=new Map;if(v.forEach(T=>{T.priority&&(x.has(T.priority)||x.set(T.priority,[]),x.get(T.priority).push(T));}),x.forEach((T,k)=>{if(T.length>=o.minCardsPerStack){let S={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[k.toLowerCase()]||"\u26AA";f.push({stack:{title:`${S} ${k} Priority`,cardIds:T.map(C=>C.id),columnId:h,strategy:"priority",color:k==="high"||k==="urgent"?"#ef4444":"#10b981"},reason:`${T.length} cards with ${k} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let T of v){let S=(await r.findSimilar(T,v)).filter(C=>C.similarity>=o.autoStackConfidenceThreshold);if(S.length>=o.minCardsPerStack-1){let C=[T.id,...S.map($=>$.card.id)],I=S.reduce(($,A)=>$+A.similarity,0)/S.length;f.push({stack:{title:`\u2728 Similar to "${T.title.substring(0,30)}${T.title.length>30?"...":""}"`,cardIds:C,columnId:h,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${S.length+1} similar tasks`,confidence:I});}}return f.filter(T=>T.confidence>=o.autoStackConfidenceThreshold).sort((T,k)=>k.confidence-T.confidence).slice(0,5)},[t,o,r]),b=useCallback(h=>{i(h.stack.title,h.stack.cardIds,h.stack.columnId,h.stack.strategy,h.stack.color);},[i]);return useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(v=>v.columnId)).forEach(async v=>{let f=await g(v),y=f[0];f.length>0&&y&&y.confidence>=.9&&b(y);});},[]),{stacks:s,createStack:i,deleteStack:c,toggleStack:l,addToStack:p,removeFromStack:d,getStacksForColumn:m,getSuggestions:g,applySuggestion:b,config:o}}var F0=createContext(null);function M0({children:e,initialData:t,onStateChange:a}){let r=useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(c=>{let{Column:l}=Ns("@libxai/core");s.set(c.id,new l(c));}),t?.cards?.forEach(c=>{let{Card:l}=Ns("@libxai/core");n.set(c.id,new l(c));});let i=null;if(t?.board){let{Board:c}=Ns("@libxai/core");i=new c(t.board);}r.current=new BoardStore({board:i,columns:s,cards:n});}let o=r.current;return useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsx(F0.Provider,{value:{store:o},children:e})}function Ki(){let e=useContext(F0);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function hs(){let e=Ki(),[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 i=useCallback(y=>{e.updateBoard(y);},[e]),c=useCallback(y=>{e.addColumn(y);},[e]),l=useCallback((y,w)=>{e.updateColumn(y,w);},[e]),p=useCallback(y=>{e.deleteColumn(y);},[e]),d=useCallback(y=>e.getColumn(y),[e]),m=useCallback(y=>{e.addCard(y);},[e]),g=useCallback((y,w)=>{e.updateCard(y,w);},[e]),b=useCallback(y=>{e.deleteCard(y);},[e]),h=useCallback((y,w,x)=>{e.moveCard(y,w,x);},[e]),v=useCallback(y=>e.getCard(y),[e]),f=useCallback(y=>e.getCardsByColumn(y),[e]);return {board:t,columns:r,cards:s,updateBoard:i,addColumn:c,updateColumn:l,deleteColumn:p,getColumn:d,addCard:m,updateCard:g,deleteCard:b,moveCard:h,getCard:v,getCardsByColumn:f}}function A0(e){let{cards:t}=hs();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 L0(e="position",t="asc"){let{cards:a}=hs();return useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let i={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},c=o.priority?i[o.priority]:0,l=s.priority?i[s.priority]:0;n=c-l;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 Yi=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=qc.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 i=await Promise.resolve(n.apply(s,a));i!==void 0&&(o=i,a[0]=i);}catch(i){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,i,{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);}},zw=new Yi;function B0({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:i=0,getItemKey:c}){let l=useRef(null),p=useVirtualizer({count:e.length,getScrollElement:()=>l.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:i}),d=p.getVirtualItems(),m={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},g=n?{width:`${p.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${p.getTotalSize()}px`,width:"100%",position:"relative"};return jsx("div",{ref:l,style:m,className:o,children:jsx("div",{style:g,children:d.map(b=>{let h=e[b.index];if(!h)return null;let v=c?c(h,b.index):b.index,f={position:"absolute",top:n?0:b.start,left:n?b.start:0,width:n?b.size:"100%",height:n?"100%":b.size};return jsx("div",{style:f,"data-index":b.index,children:r(h,b.index)},v)})})})}function R0(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 $0({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:i=16,getItemKey:c,horizontal:l=true}){let p=useRef(null),d=useVirtualizer({horizontal:l,count:e.length,getScrollElement:()=>p.current,estimateSize:()=>r,overscan:n,gap:i}),m=d.getVirtualItems(),g={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},b={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsx("div",{ref:p,style:g,className:s,children:jsx("div",{style:b,children:m.map(h=>{let v=e[h.index];if(!v)return null;let f=c?c(v,h.index):h.index,y={position:"absolute",top:0,left:h.start,width:h.size,height:"100%"};return jsx("div",{style:y,"data-index":h.index,children:o(v,h.index)},f)})})})}function H0(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 z0(e,t=10){return e>t}var pc={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},mc={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},gc={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},fc={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},bc={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},hc={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},yc={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},xc={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)"},vc={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)"},wc={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},kc={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}},Cc={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}},qi={spacing:pc,borderRadius:mc,fontSize:gc,fontWeight:fc,lineHeight:bc,zIndex:hc,duration:yc,easing:xc,shadows:vc,opacity:wc,kanban:kc,gantt:Cc};function U0(e,t,a){return e[t]??a}function Tc(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)?Tc(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function Vw(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Nc(e="asakaa"){let t=Tc(qi),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=Vw(o);a.push(` ${s}: ${n};`);}return `:root {
|
|
414
414
|
${a.join(`
|
|
415
415
|
`)}
|
|
416
|
-
}`}function
|
|
416
|
+
}`}function ys(e,t="asakaa"){let a=[],r=Tc(e);for(let[o,s]of Object.entries(r)){let n=`--${t}-color-${o}`;a.push(` ${n}: ${s};`);}return `:root {
|
|
417
417
|
${a.join(`
|
|
418
418
|
`)}
|
|
419
|
-
}`}var
|
|
419
|
+
}`}var Xi={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"}},Dc={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"}},Sc={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 Ec(e=Xi,t="asakaa"){let a=Nc(t),r=ys(e,t);return `${a}
|
|
420
420
|
|
|
421
|
-
${r}`}function
|
|
421
|
+
${r}`}function W0(){return `/**
|
|
422
422
|
* ASAKAA Design Tokens
|
|
423
423
|
* Auto-generated from design-tokens.ts
|
|
424
424
|
* Do not edit this file directly
|
|
425
425
|
*/
|
|
426
426
|
|
|
427
|
-
${
|
|
427
|
+
${Ec(Xi)}
|
|
428
428
|
|
|
429
429
|
/* Light theme */
|
|
430
430
|
[data-theme="light"] {
|
|
431
|
-
${
|
|
431
|
+
${ys(Dc,"asakaa").split(`
|
|
432
432
|
`).slice(1,-1).join(`
|
|
433
433
|
`)}
|
|
434
434
|
}
|
|
435
435
|
|
|
436
436
|
/* Neutral theme */
|
|
437
437
|
[data-theme="neutral"] {
|
|
438
|
-
${
|
|
438
|
+
${ys(Sc,"asakaa").split(`
|
|
439
439
|
`).slice(1,-1).join(`
|
|
440
440
|
`)}
|
|
441
441
|
}
|
|
442
|
-
`}var
|
|
443
|
-
export{
|
|
442
|
+
`}var Gw=({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 V0({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=un();return jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([n,i])=>{let c=n,l=c===r;return jsxs("button",{onClick:()=>o(c),className:`theme-switcher__button ${l?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${i.displayName} theme`,"aria-pressed":l,title:i.displayName,children:[jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsx(Gw,{theme:c})}),e&&!t&&jsx("span",{className:"theme-switcher__label",children:i.displayName})]},c)})})}
|
|
443
|
+
export{m0 as AIUsageDashboard,kw as AI_FEATURES,nc as AI_MODELS,Ll as AddCardButton,El as AddColumnButton,Ur as AttachmentUploader,M0 as BoardProvider,Js as BulkOperationsToolbar,_l as BurnDownChart,zg as CUSTOM_FIELD_TYPES,Jg as CalendarBoard,Kr as Card,Hl as CardDetailModal,Wl as CardDetailModalV2,o0 as CardHistoryReplay,a0 as CardHistoryTimeline,i0 as CardRelationshipsGraph,mw as CardStack,Ql as CardTemplateSelector,il as CircuitBreaker,rn as Column,si as ColumnManager,Rl as CommandPalette,ad as ConfigMenu,bn as ContextMenu,Yn as DEFAULT_SHORTCUTS,$g as DEFAULT_TABLE_COLUMNS,Jl as DEFAULT_TEMPLATES,In as DateRangePicker,Rn as DependenciesSelector,Qn as DependencyLine,jl as DistributionCharts,fl as EditableColumnTitle,sn as ErrorBoundary,ed as ExportImportModal,td as FilterBar,hm as GANTT_AI_SYSTEM_PROMPT,ki as GanttAIAssistant,pm as GanttBoard,mn as GanttI18nContext,hi as GanttMilestone,ni as GanttToolbar,b0 as GenerateGanttTasksDialog,c0 as GeneratePlanModal,ql as GroupBySelector,wl as HealthBar,po as KanbanBoard,Dl as KanbanToolbar,_n as KanbanViewAdapter,Xl as KeyboardShortcutsHelp,Og as ListView,Xt as MenuIcons,Yi as PluginManager,Fo as PrioritySelector,kl as ProfitabilityReport,Io as QuickTaskCreate,ww as RATE_LIMITS,Hg as STANDARD_FIELDS,Kl as SwimlaneBoardView,hl as TagBadge,Au as TagList,lo as TagPicker,pi as TaskBar,qr as TaskDetailModal,bm as TaskFormModal,di as TaskGrid,sd as ThemeModal,Fp as ThemeProvider,V0 as ThemeSwitcher,$r as TimeInputPopover,yl as TimePill,xl as TimePopover,xi as Timeline,Po as UserAssignmentSelector,Gl as VelocityChart,$0 as VirtualGrid,B0 as VirtualList,Vo as aiUsageTracker,mc as borderRadius,Ss as calculatePosition,ec as calendarDarkTheme,qd as calendarEnTranslations,Xd as calendarEsTranslations,tc as calendarLightTheme,ac as calendarNeutralTheme,Vi as calendarThemes,Hi as calendarTranslations,Ni as cardToGanttTask,Tm as cardsToGanttTasks,u as cn,lp as createKanbanView,Tf as createRetryWrapper,rd as darkTheme,Xi as darkTokenTheme,Zs as defaultTheme,qi as designTokens,yc as duration,xc as easing,W0 as exportTokensToCSS,to as findTaskByName,gc as fontSize,fc as fontWeight,gs as formatCost,ti as ganttEnTranslations,Pp as ganttEsTranslations,Cm as ganttTaskToCardUpdate,ct as ganttThemes,Cc as ganttTokens,id as ganttTranslations,Ae as ganttUtils,Nc as generateCSSVariables,Ec as generateCompleteCSS,vf as generateInitialPositions,ym as generateTasksContext,ys as generateThemeVariables,Qg as getCalendarTheme,ls as getCalendarTranslations,Ug as getListViewTheme,Ed as getListViewTranslations,Wg as getMonthNames,U0 as getToken,Ap as getTranslations,Vg as getWeekdayNames,kc as kanbanTokens,od as lightTheme,Dc as lightTokenTheme,bc as lineHeight,jd as listViewDarkTheme,Dd as listViewEnTranslations,Sd as listViewEsTranslations,Kd as listViewLightTheme,Yd as listViewNeutralTheme,$i as listViewThemes,Di as listViewTranslations,zi as mergeCalendarTranslations,Si as mergeListViewTranslations,ld as mergeTranslations,nd as neutralTheme,Sc as neutralTokenTheme,wc as opacity,wm as parseLocalCommand,Cd as parseNaturalDate,Td as parseNaturalDuration,Nd as parseProgress,vm as parseStatus,zw as pluginManager,Cf as retrySyncOperation,Es as retryWithBackoff,vc as shadows,z0 as shouldVirtualizeGrid,pc as spacing,Oo as themes,N0 as useAI,y0 as useBoard,hs as useBoardCore,Ki as useBoardStore,E0 as useCardStacking,Tl as useDragState,A0 as useFilteredCards,w0 as useFilters,Er as useGanttI18n,ji as useKanbanState,Dp as useKeyboardShortcuts,D0 as useMultiSelect,lc as useSelectionState,L0 as useSortedCards,un as useTheme,H0 as useVirtualGrid,R0 as useVirtualList,km as validateAIResponse,Il as withErrorBoundary,Ms as wouldCreateCircularDependency,hc as zIndex};//# sourceMappingURL=index.js.map
|
|
444
444
|
//# sourceMappingURL=index.js.map
|